salt: [BUG] 3006.7 broke my setup. Doesn't follow symlinks
Description After an update to 3006.7 the salt-master could no longer apply states to minions. The following error was returned:
**Comment: No Top file or master_tops data matches found. Please see master log for details.**
Minions could still be contacted and commands worked (e.g. salt minion cmd.run hostname)
Logs did not show any information at all indicating what the problem could be, not even when running loglevel trace.
Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
- on-prem machine
- VM ESXi
- VM running on a cloud service, please be explicit and add details
- container (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
- classic packaging - apt install on ubuntu 22.04
- onedir packaging
- used bootstrap to install
Steps to Reproduce the behavior Have the salt state config in /opt/config, make a symlink at /src/salt/top.sls pointing to /opt/config/top.sls run salt <minion> state.apply
Expected behavior The state is applied correctly.
Screenshots If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3006.7
Python Version:
Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.3
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.15.1
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 22.04.4 jammy
locale: utf-8
machine: x86_64
release: 5.15.0-97-generic
system: Linux
version: Ubuntu 22.04.4 jammy
Additional context If i copy top.sls to the location the error goes to the next level, it seems like it does not follow any symlinks at all. This was not the behaviour in the previous version.
minion:
Data failed to compile:
----------
No matching sls found for 'generic-config-internal' in env 'base'
Removing the symlinks and simply going direct files breaks other things so not really an easy fix.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 18 (8 by maintainers)
Commits related to this issue
- fixes #66133 path verification for symlinks with destination outside of root — committed to hurzhurz/salt by hurzhurz 3 years ago
@alan-cugler I’m pretty sure it was not intended to disallow symlinks, it is just a side effect of the fix for a critical CVE: https://saltproject.io/security-announcements/2024-01-31-advisory/index.html
And by the way, there is already a similar setting fileserver_followsymlinks. While it has another purpose, it could be useful for optional weakening of the path check.
Here is a suggestion for a slightly relaxed version of the clean_path function, which is used to verify the path:
From my testing, it seems to fix the CVE while symlinks still work.
I would argue more power to the end user.
If there was a good reason to not allow symlinks in this way, then lets document that and then make
allow_symlink_in_fileroots = Truein themaster.confsettings. Now its a feature that can be enabled and they can document the main downside of why they removed that ability by default like we do for all other features that have a reasonable downside for utilizing.Appears to be broken in 3007.0 as well.
That’s what I was guessing too. The changes made in 3006.6 were intentional. However, I do understand the reasoning behind wanting symlinks to work.
This has impacted on 3005.5 badly as well. We do use to follow symlinks for let’sencrypt/certbot key/cert pairs deployments. That bit of code worked very well. Thank you!