Commit graph

896 commits

Author SHA1 Message Date
Pedro Algarvio
7f98810ea6
Merge 3006.x into 3007.x 2024-03-28 13:50:44 +00:00
Pedro Algarvio
6fb74a0d1a
Reap child processes after each of the ssh tests in case of timeouts 2024-03-27 18:44:44 +00:00
Shane Lee
87d3344a7a Fix failing package tests 2024-03-26 19:49:35 +00:00
Pedro Algarvio
dfb87cdf57
Merge branch '3007.x' of github.com:saltstack/salt into hotfix/merge-forward-into-3007.x 2024-03-20 07:30:32 +00:00
Shane Lee
35bc5fc46b Revert weird change 2024-03-19 19:07:20 +00:00
Shane Lee
559ad14f54 Make the tests run on Windows 2024-03-19 19:07:20 +00:00
Shane Lee
92d6d41f0c Revert weird change 2024-03-19 16:07:31 +00:00
Shane Lee
76d750dce9 Make the tests run on Windows 2024-03-19 16:07:31 +00:00
Shane Lee
487424408d Fix package tests 2024-03-19 16:07:31 +00:00
Pedro Algarvio
f7570047bd
Merge 3006.x into 3007.x 2024-03-14 13:06:00 +00:00
Shane Lee
fdfb0e1310 Fix test_log_beacon.py::test_log_match test on Windows 2024-03-06 15:19:54 +00:00
Gareth J. Greenaway
7ad348dd48 increase test coverage for textfsm module. 2024-03-06 15:19:54 +00:00
Pedro Algarvio
b7630f3b08
Merge 3006.x into 3007.x 2024-02-29 14:25:24 +00:00
Pedro Algarvio
f4549113b1
Update pre-commit hook versions 2024-02-29 12:30:49 +00:00
Pedro Algarvio
c920ba443d
Remove all kitchen and jenkins related resources
The salt-project hasn't been using them for a very long time.
2024-02-29 10:27:02 +00:00
Pedro Algarvio
03ad4c6337 Update code to be Py3.7+ to reduce merge forward conflicts 2024-02-29 10:16:58 +00:00
Pedro Algarvio
3dea2eb541 Update pre-commit hook versions 2024-02-29 10:16:58 +00:00
Pedro Algarvio
0d6d4cfb36 Remove all kitchen and jenkins related resources
The salt-project hasn't been using them for a very long time.
2024-02-29 10:16:58 +00:00
Daniel A. Wozniak
060a192cc7 Fix linter 2024-02-29 06:29:17 +00:00
Daniel A. Wozniak
a589667304 test fix 2024-02-29 06:29:17 +00:00
Daniel A. Wozniak
afb794a7e4 test fix 2024-02-28 16:49:31 -07:00
Pedro Algarvio
5f48635fe8 Improve logic to account for Alma Linux 2024-02-28 11:24:14 +00:00
Pedro Algarvio
b9be2dec1b Update and remove obsolete pylint plugins 2024-02-27 08:07:04 +00:00
Pedro Algarvio
2631170a6f
Fix tests not properly fixed during the merge-forward
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2024-01-26 06:20:11 +00:00
Pedro Algarvio
890df5021b
Exit the process cleanly
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2024-01-26 05:54:45 +00:00
Pedro Algarvio
5ea370c1fb
Merge 3006.x into 3007.x 2024-01-25 09:47:57 +00:00
Insoo Ha
a395534469 Resolve lint failed 2024-01-24 16:00:41 +00:00
Insoo Ha
4708fe8900 Fix missing error handling. 2024-01-24 16:00:41 +00:00
Insoo Ha
10b9aeda05 fix pre-commit 2024-01-24 16:00:41 +00:00
Insoo Ha
13cfa9341f Revert "fix pre-commit"
This reverts commit 9f779c68cfef5683fc8ffc2cf7f39a94366a4fe1.
2024-01-24 16:00:41 +00:00
Insoo Ha
95bccf06c2 fix pre-commit 2024-01-24 16:00:41 +00:00
Insoo Ha
98c92a3fac Use send_multipart instead of send when sending multipart message. 2024-01-24 16:00:41 +00:00
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
33925e7ad0
Remove duplicated function(and pytest helper)
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-14 15:08:37 +00:00
Pedro Algarvio
e3ba31dc7a
Merge 3006.x into 3007.x 2023-12-14 11:32:20 +00:00
Pedro Algarvio
41be0d8fba Exitcode 3 just means the service is not running.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-12 15:29:41 -07:00
Pedro Algarvio
6a33783dfb Fix the daemons path on the generated .plist files on MacOS
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-12 15:29:41 -07:00
Pedro Algarvio
7ef07bc709 Fail early when failing to extract the version from the packages
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-12 15:29:41 -07:00
Pedro Algarvio
59f4904e29 Reduce duplication, de-clutter, simplify
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-12 15:29:41 -07:00
Pedro Algarvio
fd563dcba5 Remove some duplicate fixtures
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-12 15:29:41 -07:00
Pedro Algarvio
a420d94431
Merge 3006.x into master 2023-11-26 16:10:40 +00:00
Pedro Algarvio
4ee029f1f7 Move the install salt routine to the custom salt minion class implementation
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-26 13:05:11 +00:00
Pedro Algarvio
066afb90f0 Skip tests which can't run, or even pass on FIPS enabled platforms
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-14 20:42:57 +00:00
Pedro Algarvio
265ec5becf Cannot currently create virtual environments on a FIPS enabled platforms
See https://github.com/saltstack/salt/issues/65444

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-14 20:42:57 +00:00
Pedro Algarvio
b213670518 Install Salt in the container before starting any of Salt's daemons
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-10-12 19:07:46 +01:00
Pedro Algarvio
8e07f20ef0
Merge 3006.x into master 2023-10-04 21:25:32 +01:00
Pedro Algarvio
37ca0c08d0 Upgrade to mock==5.1.0
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-10-04 20:54:42 +01:00
Pedro Algarvio
72976d6a0b Typo
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-10-04 20:54:42 +01:00
Pedro Algarvio
023bd39eb5
Run pyupgrade against changed files from merge forward
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-09-26 12:00:37 +01:00
Pedro Algarvio
b85da8d8b0
Merge 3006.x into master 2023-09-26 07:01:03 +01:00