[BUG] 3004.1 broke syndication
Description After upgrading both the syndication master and other masters to 3004.1, I can no longer interact with the masters through the syndication master.
The masters have the following in /var/log/salt/syndic:
2022-03-28 14:04:36,269 [salt.pillar :245 ][ERROR ][16055] Pillar payload signature failed to validate.
2022-03-28 14:04:36,270 [salt.minion :3444][ERROR ][16055] Error while bringing up syndic for multi-syndic. Is the master at dc6-unix-salt-syndic-dev-01.nvidia.com responding?
2022-03-28 14:04:39,074 [salt.minion :3490][ERROR ][16055] Unable to call _fire_master on dc6-unix-salt-syndic-dev-01.nvidia.com, that syndic is not connected
2022-03-28 14:04:39,074 [salt.minion :3501][CRITICAL][16055] Unable to call _fire_master on any masters!
Versions Report
root@dc6-unix-salt-syndic-dev-01:~# salt-master --versions-report
Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: 1.15.0
cherrypy: 18.6.0
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
Jinja2: 2.10
libgit2: 0.26.0
M2Crypto: 0.31.0
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: 2.6.1
pycryptodome: 3.4.7
pygit2: 0.26.2
Python: 3.6.9 (default, Mar 15 2022, 13:55:28)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 17.1.2
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: ubuntu 18.04 Bionic Beaver
locale: UTF-8
machine: x86_64
release: 4.15.0-140-generic
system: Linux
version: Ubuntu 18.04 Bionic Beaver
root@dc6-unix-salt-dev-01:~# salt-syndic --versions-report
Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: 1.14.5
cherrypy: 18.6.1
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
Jinja2: 2.10
libgit2: 1.1.0
M2Crypto: 0.31.0
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: 2.6.1
pycryptodome: 3.9.8
pygit2: 1.5.0
Python: 3.6.9 (default, Mar 15 2022, 13:55:28)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 17.1.2
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
Salt Extensions:
SSEAPE: 8.4.2+4
System Versions:
dist: ubuntu 18.04 Bionic Beaver
locale: UTF-8
machine: x86_64
release: 4.15.0-140-generic
system: Linux
version: Ubuntu 18.04 Bionic Beaver
I have the same issue on 3003.4.
Additional logs on the syndic:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 262, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 507, in render_jinja_tmpl
raise SaltRenderError("Jinja variable {}{}".format(exc, out), buf=tmplstr)
salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'kernel'
2022-03-29 09:49:11,271 [salt.pillar :900 ][CRITICAL][18851] Rendering SLS 'common.operatingsystems' failed, render error:
Jinja variable 'dict object' has no attribute 'kernel'
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 500, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'kernel'
It seems pillar rendering is broken
salt versions:
Salt Version:
Salt: 3003.4
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 17.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: centos 7 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-1160.53.1.el7.x86_64
system: Linux
version: CentOS Linux 7 Core
I looked into this for a while yesterday afternoon but didn't come up with anything definitive. Digging into it more now.
I'm pretty sure this is due to the minion signing issue. I was seeing this error in my syndic logs:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/salt/pki/minion/minion_master.pub'
I didn't have a minion_master.pub file in that directory, because the relationship is actually a syndic<-->master. Looks like it should be possible to workaround this by creating a symlink.
cd /etc/salt/pki/minion
ln -s syndic_master.pub minion_master.pub
@ebusto @mguegan could you see if that workaround... works?
@waynew, it works. Many thanks! But you must first move the old minion_master.pub to another folder.
The minion_master might be necessary if you're running a minion on the same box as the syndic. I'll be working on finding a correct fix for this.
Indeed, I am running a minion on the same box as the syndic.
ls -l /etc/salt/pki/minion/
total 16
-rw-r--r--. 1 root root 450 Feb 25 2020 minion_master.pub
-r--------. 1 root root 1678 Feb 25 2020 minion.pem
-rw-r--r--. 1 root root 450 Feb 25 2020 minion.pub
-rw-r--r--. 1 root root 451 Jan 29 2021 syndic_master.pub
We had a strange issue with this. We tried the work around with a symlink but that didn't work. Deleting the symlink and restoring the minion_master.pb fixed our issue.
We also did two environments at the same time and that caused our MOM to throw logs of a possible "replay attack" on all minions of that environment. We needed to do one at a time. Hope this helps track it down.
Is there a general multi-master issue? We are experiencing that 3004.1 multi-masters setup with https://docs.saltproject.io/en/latest/topics/tutorials/multimaster_pki.html that 3004.1 minions are only able to connect to one master.
The symlink workaround didn't work in our environment. We run a minion on each master, pointing to localhost.
However, if I replace the master keys on the syndication master with those used on the rest of our masters, then it works.
It looks like syndic is interchanging its key with minion key. If I save the syndic_master.pub to minion_master.pub, the syndication works. But not the minion, because it has a wrong master pub key.
I used this as a dirty patch workaround for now:
--- /tmp/zeromq.py 2022-04-04 10:27:24.307557047 -0700
+++ /usr/lib/python3/dist-packages/salt/transport/zeromq.py 2022-04-04 10:29:14.054840943 -0700
@@ -382,6 +382,8 @@
# Validate the master's signature.
master_pubkey_path = os.path.join(self.opts["pki_dir"], "minion_master.pub")
+ if "__role" in self.opts and self.opts["__role"] == "syndic":
+ master_pubkey_path = os.path.join(self.opts["pki_dir"], "syndic_master.pub")
if not salt.crypt.verify_signature(
master_pubkey_path, signed_msg["data"], signed_msg["sig"]
):
I used this as a dirty patch workaround
Confirmed - working.
hello,
Would it be possible to have a fix-release with this bugfix ?
Thank you
I'm not quite sure what is the purpose of the code if config option verify_master_pubkey_sign and always_verify_signature is already enabled. Unfortunately adding the extra lines of code didn't remove the error for me and I had to remove all that part of the code. I'll wait for a proper fix to add it again.
I'm pretty sure this is due to the minion signing issue. I was seeing this error in my syndic logs:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/salt/pki/minion/minion_master.pub'I didn't have a
minion_master.pubfile in that directory, because the relationship is actually a syndic<-->master. Looks like it should be possible to workaround this by creating a symlink.cd /etc/salt/pki/minion ln -s syndic_master.pub minion_master.pub@ebusto @mguegan could you see if that workaround... works?
Work for me, i am using 3004.1
mv minion_master.pub minion_master.pub_bkp
ln -s syndic_master.pub minion_master.pub
salt-syndic -l debug
[DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.29.24:4506
[DEBUG ] Trying to connect to: tcp://192.168.29.24:4506
[INFO ] Syndic successfully connected to 192.168.29.24
@waynew waynew Thx man
@waynew do you know if you plan to release an official fix / package about this issue ?
Just as a note, this also affects 3003.4 instances. Performing the workaround from https://github.com/saltstack/salt/issues/61868#issuecomment-1123113765 worked for us. However, unless this issue isn't going away and the recommended approach is to do the hotfix, we don't want to implement a workaround that will then need to be removed when an official patch is released.
Is there a general multi-master issue? We are experiencing that 3004.1 multi-masters setup with https://docs.saltproject.io/en/latest/topics/tutorials/multimaster_pki.html that 3004.1 minions are only able to connect to one master.
@sastorsl did you ever get this issue resolved? We're seeing it on a multi-master setup as well.
Is there a general multi-master issue? We are experiencing that 3004.1 multi-masters setup with https://docs.saltproject.io/en/latest/topics/tutorials/multimaster_pki.html that 3004.1 minions are only able to connect to one master.
@sastorsl did you ever get this issue resolved? We're seeing it on a multi-master setup as well.
@nicholasmhughes We ended up having to use the same key on both masters in each of our pairs, as we use/abuse salt a bit here. The minions have to be able to communicate with both "at the same time". With different keys they could only ever talk to one master at a time, so when the second master (the one the minion did not authenticate and connect to on startup) asked the minion to perform a task it refused to return properly.
Different keys for the masters in a pair (with key verify/sign) where both masters could send/receive tasks worked up until 3004.1.
this seems to be fixed in 3003.5 and 3004.2