Commit graph

486 commits

Author SHA1 Message Date
jeanluc
f2121e5ade
Rewrite vault core, issue AppRoles to minions (#62684)
* Rewrite vault core, orchestrate AppRoles for minions

This commit represents a fundamental rewrite in how Salt interacts with
Vault. The master should still be compatible with minions running the
old code. There should be no breaking changes to public interfaces and
the old configuration format should still apply.

Core:
- Issue AppRoles to minions
- Manage entities with templatable metadata for minions
- Use inbuilt Salt cache
- Separate config cache from token cache
- Cache: introduce connection-scope vs global scope

Utility module:
- Support being imported (__utils__ deprecation)
- Raise exceptions on queries to simplify response handling
- Add classes to wrap complexity, especially regarding KV v2
- Lay some groundwork for renewing tokens

Execution module:
- Add patch_secret
- Add version support to delete_secret
- Allow returning listed keys only in list_secret
- Add policy_[fetch/write/delete] and policies_list
- Add query for arbitrary API queries

State module:
- Make use of execution module
- Change output format

Docs:
- Update for new configuration format
- Correct examples
- Add configuration examples
- Add required policies

* Fix linting for rewritten vault integration

* Add pytest unit tests for utils.vault, fix found issues

* Fix old vault runner tests

* Rewrite vault sdb tests, migrate to pytests

* Adapt vault ext_pillar tests

* Adapt vault execution module tests, migrate to pytests

* Add more vault execution module unit tests

* Support python <3.7 (vault util), time-independent tests

* Add/migrate vault runner unit tests (pytest)

* Add vault state module pytests

* Fix tests lint

* Refactor Vault container fixture, move to session scope

* Fix for existing vault execution/sdb module integration tests

* Improve existing vault runner integration tests

* Fix vault test support, add list policies

* Add more functional execution module tests, fix deprecated warning

* Refactor vault pytest support

* Add integration tests, improve/fix caching/issue_params

* Improve caching behavior, fix tests

* Always use session cache as well
* Also flush session cache when requested
* Make KV metadata caching behavior configurable
* Update tests to account for changes from prev commit

* Allow to autodiscover platform default CA bundle

* Remove runner approle param overrides

There is no simple way to ensure they are kept.

* Add clear_cache runner function

* Also manage token metadata for issued secret IDs

* Cleanup tests

* Cleanup code, pylint logging suggestions

* Do not always invalidate config when verify=default

* Ensure concatted metadata lists are sorted

* Add changelog (partly)

* Work with legacy peer_run configuration as well

* Consume a token use regardless of status code

* Correct verify semantics

* Refine token uses handling, add changelog/tests for old issues

* Add changelog for main features

* Add test for issue 58580

* Fix vault docs

* Provide all old make_request functionality, add tests

* Allow token use override, add docstrings to query funcs

* Simplify config_location merge

* Cleanup

* Fix make_request warning

* Attempt to fix memory issues during CI test run

* Increase documented version

* Improve lease handling

* Refine lease ttl handling/add token lifecycle management

* Fix docs build

* Adapt formatting

* assert what you get against what you expect
* drop empty parentheses after wrapper
* use `is` to compare against strictly boolean vars

* Fix issue param overrides

* during pillar rendering, they were always reset by the master (for
  AppRoles)
* overrides were only respected for some settings (AppRoles)
* old config syntax was using the old syntax internally (tech debt)

* Introduce session-scoped cache

* Tokens with a single use left are unrenewable

* Allow override of flushing of cached leases during lookup

* Refactor cache classes, save lease data

* Rename session token cache key

* Add lease management utility

* Fix runner integration tests

after renaming the token cache key

* Do not overwrite data of cached leases after renewal

* Pass token_lifecycle to minions

* Do not fail syncing multiple approles/entities with pillar templates

* Ensure config cache expiration can be disabled

* Rename changelog files (.md)

* Declare vaultpolicylexer as parallel read safe

* Correct meta[data] payload key

For tokens it is `meta`, but for secret IDs, `metadata`.

* Reuse TCP connection

* Refactor utils module

* Ensure client is recreated after clearing cache

* Always use unwrap_client config as expected server

This should fix the test failure in the runner integration test
TestAppRoleIssuance::test_server_switch_does_not_break_minion_auth

* Ensure client is recreated after clearing cache 2

* Simulate patch for KV v1 or missing `patch` capability

* Add `patch` option to Vault SDB driver

* Reduce lease validity when revocation fails

* Extract AppRole/Identity API from runner into utils

* Revoke tokens, fire events, improve cache/exception handling

* Tokens (and therefore associated leases) are revoked when cleared by default
* It's possible to disable clearing cache when a perfectly valid token
  is available, but a PermissionDeniedError is encountered.
* UnwrapExceptions always cause an event to be fired
* It's possible to enable sending of events when
    a) cache is cleared
    b) a lease is requested from cache, but it is/will be invalid
* A VaultAuthException does not immediately lead to clearing
  the connection cache
* get_authd_client and others: multiple small enhancements and fixes

* Allow updating cached config w/o closing session

* Homogenize funcs, update docs, cleanup

* Minor internal fixes

`is_valid_for` is present on all lease-like objects, while `is_valid`
specifically should account for more, e.g. the number of uses.

The Vault API does not return 404 when a lookup fails.

* Add release note

* Address review remarks

* Fix release notes

* Remove loading minion_mods from factory

* Address other review remarks

* Add inline specification of trusted CA root cert

* Small QoL additions

* Fix lint

* Fix lint for Python >=3.8 support

* Add missing fixes

* Fix unit tests

In some cases, the `spec` calls were failing because the underlying
object was already patched

---------

Co-authored-by: Thomas Phipps <tphipps@vmware.com>
2023-12-15 21:42:08 -07:00
Pedro Algarvio
d14de602b1 When a release doc only exists as a template, copy it into the right path
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-16 16:53:31 +00:00
Pedro Algarvio
6cfbd27473 Show warning on modules which are getting deprecated into extensions
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-16 16:53:31 +00:00
MKLeb
bee29be6dd
Merge remote-tracking branch 'upstream/3006.x' into mf/master/3006.x 2023-09-08 16:25:39 -04:00
ScriptAutomate
be49ded863 Update Slack Community invite link 2023-09-05 17:21:35 -07:00
MKLeb
2b8f7d3669 replace do with set _ = 2023-08-29 17:33:49 +01:00
MKLeb
2d214c8e48 Replace some set statements with do and add jinja2.ext.do as an extension in docs/conf.py 2023-08-29 17:33:49 +01:00
Pedro Algarvio
112cbda97a
Merge 3006.x into master 2023-07-21 18:11:52 +01:00
ScriptAutomate
22d7145d4f Update Slack invite link and VMware Aria ref 2023-07-19 12:40:50 +01:00
natalieswork
bd10d94449 removing references to Azure from existing files 2023-05-22 16:07:26 -04:00
Pedro Algarvio
442cadbd37 Remove code and references to the disabled Sphinx extension shorturls
It has been disabled since 2018.3.4

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-28 07:40:38 +00:00
Pedro Algarvio
5176520713 Add a spellcheck docs build
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-18 17:38:23 +00:00
Pedro Algarvio
91fba51349 Add linkcheck to docs build jobs
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-18 17:38:23 +00:00
Pedro Algarvio
c4beeb8fb9 Fix doc builds
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-18 17:38:23 +00:00
Pedro Algarvio
a749ec551a Start writing the release notes in markdown.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-17 05:28:37 +00:00
Pedro Algarvio
cea048be5f Update docs related requirements
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-02-04 14:11:36 +00:00
Daniel A. Wozniak
682777e1d1 Add tools docs 2023-01-27 07:35:00 -07:00
Megan Wilhite
4b209e3ee3 Update latest_version in doc/conf.py to include .0 2022-12-09 07:19:53 -07:00
Pedro Algarvio
2f6844f621 A few additional replacements for `SaltStack, Inc` 2022-04-06 15:35:31 -04:00
Benjamin Drung
f2201bb260 docs: Support building documentation locally
Building the documentation locally without Internet access will fail,
because sphinx will try to download the intersphinx inventory from
http://docs.python.org/3/objects.inv.

Support building the documentation locally without Internet access by
searching for locally installed intersphinx inventory first.

Bug-Debian: https://bugs.debian.org/755026
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-12-13 14:49:33 -05:00
Gareth J. Greenaway
4b2bce83b8 Deprecating and removing salt-unity. 2021-12-07 16:15:56 -05:00
ScriptAutomate
c7a1d471f9 Setting up CSE search values through 3006 2021-08-30 14:22:51 -04:00
Bryce Larson
73cc8d6120 change repo.saltstack.com to repo.saltproject.io 2021-08-16 14:20:43 -04:00
ScriptAutomate
3f53193a9a Update Slack links 2021-04-29 10:58:05 -07:00
ScriptAutomate
b4dd6c8a26 Remove conditional or from latest release var 2021-03-19 06:30:57 -04:00
ScriptAutomate
6e503e9b7c Add back version var used by Sphinx 2021-03-19 06:30:57 -04:00
Pedro Algarvio
44ca6f6e69 Use the checkout major version as the latest release 2021-03-19 06:30:57 -04:00
ScriptAutomate
2ebb741ae8 Updating default fallback for latest_release 2021-03-19 06:30:57 -04:00
Pedro Algarvio
b7de268ee6 Remove old/dead/unnecessary code 2021-02-26 11:30:23 -05:00
Pedro Algarvio
75c29e7d51 Use .format() instead 2021-02-24 11:04:06 -05:00
Bryce Larson
db97de58e9 convert images when needed 2021-02-08 06:09:08 -05:00
Bryce Larson
3e65e080ad add newer versions of google custom search engines 2020-09-10 08:55:31 -07:00
ScriptAutomate
9547e54ece Auto-changes made to conf.py by pre-commit 2020-09-04 15:23:53 -07:00
ScriptAutomate
0ef1c50a3f Removing Python 2 references on latest minion 2020-09-04 15:23:53 -07:00
Bryce Larson
4c374a8ff3 don't overwrite rst files with autodoc 2020-06-06 21:00:50 -07:00
Pedro Algarvio
fe075aaace Distro is now a hard dependency
Refs #55310
Refs #55835
2020-05-11 19:06:03 -07:00
Derek Ardolf
5a73ef699f
Various Link Redirect and HTTP/HTTPS Fixes in docs (#56655)
* Fixing various redirected links

* Change links to https

* Reintroduced macro link reference

* Change man page to original at master; revert added line
2020-05-04 01:28:38 -07:00
Daniel Wozniak
bd47db7026
Merge pull request #55963 from bdrung/master-fix-doc-import-kubernetesmod
Mock kubernetes when building the documentation
2020-04-22 12:08:20 -07:00
Bryce Larson
bba8405c6b
update sphinx to 3.0.1 2020-04-17 16:49:14 -06:00
Benjamin Drung
afc209f794 Mock kubernetes when building the documentation
Importing kubernetesmod fails, when building the documentation:

```
doc/ref/modules/all/index.rst:20: WARNING: failed to import kubernetesmod
doc/ref/modules/all/index.rst:20: WARNING: toctree references unknown document 'ref/modules/all/kubernetesmod'
WARNING: autodoc: failed to import module 'kubernetesmod' from module
'salt.modules'; the following exception was raised:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc/importer.py", line 154, in import_module
    __import__(modname)
  File "salt/modules/kubernetesmod.py", line 71, in <module>
    import kubernetes  # pylint: disable=import-self
  File "/usr/lib/python3/dist-packages/kubernetes/__init__.py", line 20, in <module>
    import kubernetes.config
  File "/usr/lib/python3/dist-packages/kubernetes/config/__init__.py", line 17, in <module>
    from .kube_config import (list_kube_config_contexts, load_kube_config,
  File "/usr/lib/python3/dist-packages/kubernetes/config/kube_config.py", line 27, in <module>
    from requests_oauthlib import OAuth2Session
  File "/usr/lib/python3/dist-packages/requests_oauthlib/__init__.py", line 11, in <module>
    if requests.__version__ < '2.0.0':
TypeError: '<' not supported between instances of 'module' and 'str'
```

Therefore also mock `kubernetes` and `kubernetes.config`.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2020-04-14 15:58:20 +02:00
Blacken Salt
0b2a5613b3
Blacken salt 2020-04-03 13:05:41 -05:00
Bryce Larson
789dc10a94
set release versions with environment variables in the docs 2020-01-17 11:01:34 -07:00
Frode Gundersen
406af6c46b
Update release version 2020-01-14 19:39:34 +00:00
Bryce Larson
1f9bc58950
update docs to build off master instead of develop 2019-10-28 14:02:02 -06:00
Pedro Algarvio
14bde12b9d
Fill in the configurable branch at build time 2019-10-25 18:28:53 +01:00
Pedro Algarvio
9bf2d0d524
f1 2019-10-24 16:58:12 +01:00
Pedro Algarvio
adef6a4a17
Have the repo primary branch configurable for docs 2019-10-24 16:56:06 +01:00
Frode
8359af4b13
Update release versions for the master branch 2019-10-23 17:26:58 +00:00
Bryce Larson
e9a2a700bc
update version numbers to be correct 2019-10-04 17:09:03 -06:00
Gareth J. Greenaway
94a1e3bf25
Porting PR #52752 to 2019.2.1 2019-10-04 16:10:35 -06:00