You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When using x509_v2 in salt 3006.9, the x509.certificate_managed state returns binary data in the payload. This causes any api event stream client to fail (including salt-run state.event), with error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte
Traceback
Exception occurred in runner state.event: Traceback (most recent call last):
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/mixins.py", line 388, in low
data["return"] = func(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
ret = _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/state.py", line 312, in event
return statemod["state.event"](
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
ret = _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/state.py", line 2594, in event
salt.utils.data.decode(ret["data"]),
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/data.py", line 252, in decode
return decode_dict(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/data.py", line 365, in decode_dict
value = decode_list(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/data.py", line 482, in decode_list
item = decode_dict(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/data.py", line 411, in decode_dict
value = decode(
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/data.py", line 293, in decode
data = _decode_func(data, encoding, errors, normalize)
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/stringutils.py", line 113, in to_unicode
return _normalize(to_str(s, encoding, errors))
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/stringutils.py", line 89, in to_str
raise exc # pylint: disable=raising-bad-type
File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/stringutils.py", line 82, in to_str
return _normalize(s.decode(enc, errors))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte
Setup
Install salt, salt-master, salt-api and salt-minion rpms on a Rocky 8 VM
Configure the minion for x509_v2
Add configuration for signing x509 certificates
Set up a local certificate authority
Create a salt state that will issue a signed certificate
Start the salt-master: systemctl start salt-master
Start the salt-minion, and accept the key: systemctl start salt-minion; sleep 11; salt-key -A
Apply the setup state to create the CA files: salt-call state.apply setup; systemctl restart salt-master; systemctl restart salt-minion
Steps to Reproduce the behavior
Start an event stream listener: salt-run state.event pretty=True
Apply a state to issue a certificate: salt-call state.apply test
Expected behavior
Certificate is issued, event stream does not crash
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 3006.9Python Version:
Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0]Dependency Versions:
cffi: 1.14.6cherrypy: unknowncryptography: 42.0.5dateutil: 2.8.1docker-py: Not Installedgitdb: Not Installedgitpython: Not InstalledJinja2: 3.1.4libgit2: Not Installedlooseversion: 1.0.2M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.2msgpack-pure: Not Installedmysql-python: Not Installedpackaging: 22.0pycparser: 2.21pycrypto: Not Installedpycryptodome: 3.19.1pygit2: Not Installedpython-gnupg: 0.4.8PyYAML: 6.0.1PyZMQ: 23.2.0relenv: 0.17.0smmap: Not Installedtimelib: 0.2.4Tornado: 4.5.3ZMQ: 4.3.4System Versions:
dist: rocky 8.10 Green Obsidianlocale: utf-8machine: x86_64release: 4.18.0-553.16.1.el8_10.cloud.0.1.x86_64system: Linuxversion: Rocky Linux 8.10 Green Obsidian
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Description
When using x509_v2 in salt 3006.9, the
x509.certificate_managed
state returns binary data in the payload. This causes any api event stream client to fail (includingsalt-run state.event
), with error:Traceback
Setup
/etc/salt/master.d/test.conf
/etc/salt/minion.d/test.conf
/srv/salt/setup.sls
/srv/salt/test.sls
systemctl start salt-master
systemctl start salt-minion; sleep 11; salt-key -A
salt-call state.apply setup; systemctl restart salt-master; systemctl restart salt-minion
Steps to Reproduce the behavior
salt-run state.event pretty=True
salt-call state.apply test
Expected behavior
Certificate is issued, event stream does not crash
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: