Commit graph

1873 commits

Author SHA1 Message Date
Barney Sowood
6bdbae00d7 Calculaate python version 2023-08-16 15:53:29 -07:00
Barney Sowood
215975bac0 Fix call to sys.stdout.flush() 2023-08-16 15:53:29 -07:00
Barney Sowood
76df410a36 Add support for fixing old pkg perms
Adds support for fixing old package (3006.0/3006.1) perms that used the
salt user too widely.
Without doing this, tests don't pass for upgrades.
2023-08-16 15:53:29 -07:00
Barney Sowood
39b464a58d Remove some perms checks in conftest.py
Remove checks for perms on /var/log/salt/master and /var/run/salt/master
in the salt_master fixture as they may not existing during an upgrade
test and it's not critical to test them in the fixture.
2023-08-16 15:53:29 -07:00
Barney Sowood
b3d2a55535 Removing check on /etc/salt/minion.d
Removes check on /etc/salt/minion.d - it's causing issues in CI
that I can't reproduce locally and we'll deal with it in #64235
anyway.
2023-08-16 15:53:29 -07:00
Barney Sowood
ae40410dee Ensure salt-api service is enabled
Ensure salt-api service is enabled now we've added a postinst script
2023-08-16 15:53:29 -07:00
Barney Sowood
cc7611e1db Handle pytest-salt-factories permission changes
Handles permission changes caused by test suite running as root and
the creation of /var/cache/salt/master/.root_key.

Running the test suite as root means that /etc/salt/pki/master subdirs
get their ownership changed to root - clean that up in conftest.py.
No longer need to fix /var/log/salt as we handle the files in there
individually.

Adds exclusion for /var/cache/salt/master/.root_key as that gets created
by salt* cli tools running as root.
2023-08-16 15:53:29 -07:00
Barney Sowood
5d3ffc9e77 Handle creation of /var/log/salt/key 2023-08-16 15:53:29 -07:00
Barney Sowood
94adcd1b2c Remove group test for files
Removes group test for ownership on files by the salt user. Files that
are created by the salt-master process can be owned by salt:root, rather
than salt:salt and that's valid
2023-08-16 15:53:29 -07:00
Barney Sowood
b6661011d2 Add tests for package directory and file ownership
Adds test that checks that files and directories created by the packages
that should be owned by salt:salt are owned by that user and that the
other files/directories created are owned by root:root.
2023-08-16 15:53:29 -07:00
Barney Sowood
194e1a4603 Create empty log for salt-api
Creates empty log for salt-api owned by salt user in same way we do for
the master and salt-cloud
2023-08-16 15:53:29 -07:00
Barney Sowood
25c5a8e8d8 Move log creation and chown to posttrans
Moves log creation for /var/log/salt/master and /var/log/salt/cloud
and setting ownership to salt:salt to the %posttrans scriplets.
Whilst using %post work fine for fresh installs, upgrading means that
the previous package %postun removes those files. Using %posttrans
ensures the logs are created at the end of the full install/upgrade
transaction.
2023-08-16 15:53:29 -07:00
Barney Sowood
1aa8276e6c Correct docstrings for salt user test_salt_user
Corrects docstrings for salt user tests - they were all the same.
2023-08-16 15:53:29 -07:00
Barney Sowood
dc2e10b855 Create /var/run/salt/master
Creates /var/run/salt/master directory - if we don't create that
specifically the postinst script will fail
2023-08-16 15:53:29 -07:00
Barney Sowood
cd93818c86 Update files to verify in pkg tests
Updates lists of files to check in package tests when starting master.
We now set the following as owned by salt:salt in master postinst

* /etc/salt/pki/master
* /etc/salt/master.d
* /var/log/salt/master
* /var/cache/salt/master
* /var/run/salt/master
2023-08-16 15:53:29 -07:00
Barney Sowood
da6cfc99ab Reduce perms for salt user on other salt dirs
Reduces the permissions granted to the salt user used to run the
salt-master:

* Under /etc/salt limit ownership to  /etc/salt/pki/master and
  /etc/salt/master.d
* Until #64219 is resolved also include /etc/salt/minion.d
* Under /var/cache/salt and /var/run/salt only give ownership on
  master directories
* Under /var/log/salt, ensure /var/log/salt/master exists and give
  ownership oof that. Also update logrotate config to create that with
  correct ownership and perms and install that on debian packages.
2023-08-16 15:53:29 -07:00
Barney Sowood
af9ee1a9c6 Update packages for python modules owned by root
Updates Debian and RPM packages so that /opt/saltstack/salt and the
python packages don't have to be owned by salt user.

It shouldn't be necessary for salt user, used to run salt-master to be
able to write/modify files in that directory hierarchy.

Add postinst scripts to call the python compileall module to create
byte-compiled python modules. This should preserve performance whilst
not requiring write access for salt user.

Also cleans up .pyc files and __pycache__ dirs on removal.
2023-08-16 15:53:29 -07:00
Clay Oster
f4efa4fb79 Fix salt user login shell path in Debian packages 2023-08-16 12:49:45 +00:00
Caleb Beard
9e4e36bf0b
Merge pull request #64959 from MKLeb/mf/3006.2/3006.x
[3006.x] Merge 3006.2 into 3006.x
2023-08-14 17:30:28 -04:00
MKLeb
bbeffed460 Add Breaks and Replaces statements to debian/control 2023-08-14 13:02:09 -04:00
David Murphy
f0743ec9a8 Added tests for ufw allow salt 2023-08-11 10:22:09 +01:00
David Murphy
bd17823792 Add salt.ufw to salt-master install on Debian and Ubuntu 2023-08-11 10:22:09 +01:00
Salt Project Packaging
8f750fa7ae Release v3006.2 2023-08-09 12:08:57 +00:00
Felippe Burk
9f34aa38dc adding obsoletes to rpm.spec for photon3 packages
Signed-off-by: Felippe Burk <burkf@vmware.com>
2023-08-03 15:36:37 +01:00
Felippe Burk
fff6078c29 adding obsoletes to rpm.spec for photon3 packages
Signed-off-by: Felippe Burk <burkf@vmware.com>
2023-08-01 09:31:26 -07:00
Daniel A. Wozniak
3877900698 Upgrade relenv to 0.13.2 and Python to 3.10.12.
Addresses multiple CVEs in dependencies: https://docs.python.org/release/3.10.12/whatsnew/changelog.html#python-3-10-12

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-07-28 06:54:45 +01:00
Daniel A. Wozniak
7d2e4b0692 Upgrade relenv to 0.13.2 and Python to 3.10.12.
Addresses multiple CVEs in dependencies: https://docs.python.org/release/3.10.12/whatsnew/changelog.html#python-3-10-12

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-07-28 05:59:32 +01:00
Pedro Algarvio
a95af1ec77 Properly upgrade Debian based systems unattended
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-07-27 19:19:26 +01:00
Pedro Algarvio
a9bbfd0e47 Properly upgrade Debian based systems unattended
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-07-27 16:26:25 +01:00
Pedro Algarvio
7cd5ad6a31 Update .github/, cicd/, pkg/ and tools/ to latest 3006.x
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-07-19 08:49:10 +01:00
MKLeb
e11d6a478a More fixes for upgrades of NSIS packages from relenv-based previous versions 2023-06-29 13:01:04 -07:00
MKLeb
d007ebd8d9 Some more fixes for the NSIS package tests 2023-06-29 13:01:04 -07:00
MKLeb
0d622479b2 Additional fixes for mac and windows upgrade tests 2023-06-29 13:01:04 -07:00
MKLeb
f952418e90 Use download_file for the windows packages as well 2023-06-29 13:01:04 -07:00
MKLeb
0ec60c70d2 Fix mac upgrade test urls 2023-06-29 13:01:04 -07:00
MKLeb
9a4e026d59 The major version needs to be cast to an int for comparison 2023-06-29 13:01:04 -07:00
MKLeb
7aadeaf792 Account for upgrades from new relenv-based repos 2023-06-29 13:01:04 -07:00
Pedro Algarvio
ba733b3a63 Don't hide output
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-06-28 07:26:05 +01:00
Pedro Algarvio
fb9f0bc54a Don't hardcode the python version on pkg/debian/salt-cloud.postinst
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-06-28 07:26:05 +01:00
Pedro Algarvio
e4876d2e49 Don't hardcode the python version in the test.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-06-28 07:26:05 +01:00
twangboy
e7832f772d Add suggested docs fixes 2023-06-20 19:41:59 +00:00
twangboy
f036af2953 Quote spaces in the script path 2023-06-20 19:41:59 +00:00
twangboy
d516d17840 Quote path to salt-bin 2023-06-20 19:41:59 +00:00
twangboy
901708cf09 Add tests for multi-minion script 2023-06-20 19:41:59 +00:00
twangboy
b0d14780fa Add docs, don't run as service 2023-06-20 19:41:59 +00:00
twangboy
7a802fbb6e Add scripts to installer, clean msi files 2023-06-20 19:41:59 +00:00
Twangboy
2f07a4e3af Fix name of cmd script from master to minion 2023-06-20 19:41:59 +00:00
Twangboy
c016b46029 Remove BOM to fix pre-commit 2023-06-20 19:41:59 +00:00
Twangboy
97e6ff7a1a Add scripts for setting up multi-minion on Windows 2023-06-20 19:41:59 +00:00
Pedro Algarvio
40d8564265
The fixture should be session scoped
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-06-17 20:45:41 +01:00