Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2017 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3010a741d5bc3872ac89899100f18676 to your computer and use it in GitHub Desktop.
Save anonymous/3010a741d5bc3872ac89899100f18676 to your computer and use it in GitHub Desktop.
sls file
--------
/etc/pki:
file.directory: []
/etc/pki/tls/private/localhost.key:
x509.private_key_managed:
- bits: 4096
- backup: True
- require:
- file: /etc/pki
/etc/pki/tls/certs/localhost.crt:
x509.certificate_managed:
- signing_private_key: /etc/pki/tls/private/localhost.key
- Email: redacted
- CN: {{ grains['nodename'] }}
- C: redacted
- ST: redacted
- L: redacted
- O: redacted
- basicConstraints: "critical CA:true"
- keyUsage: "critical cRLSign, keyCertSign"
- subjectKeyIdentifier: hash
- authorityKeyIdentifier: keyid,issuer:always
- days_valid: 3650
- days_remaining: 30
- backup: True
- require:
- x509: /etc/pki/tls/private/localhost.key
Error with M2Crypto 0.27.0 installed
------------------------------------
redacted:
----------
ID: /etc/pki/tls/certs/localhost.crt
Function: x509.certificate_managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/states/x509.py", line 464, in certificate_managed
current = __salt__['x509.read_certificate'](certificate=name)
File "/usr/lib/python2.7/site-packages/salt/modules/x509.py", line 549, in read_certificate
'Subject': _parse_subject(cert.get_subject()),
File "/usr/lib/python2.7/site-packages/salt/modules/x509.py", line 333, in _parse_subject
val = getattr(subject, nid_name)
File "/usr/lib64/python2.7/site-packages/M2Crypto/X509.py", line 321, in __getattr__
return util.py3str(m2.x509_name_by_nid(self.x509_name, self.nid[attr]))
File "/usr/lib64/python2.7/site-packages/M2Crypto/util.py", line 66, in py3str
raise TypeError('No string argument provided')
TypeError: No string argument provided
Started: 13:30:35.180261
Duration: 8.537 ms
Changes:
Error with stock salt-minion 2017.7.1 on RHEL 6.9
-------------------------------------------------
redacted:
----------
ID: /etc/pki/tls/private/localhost.key
Function: x509.private_key_managed
Result: False
Comment: State 'x509.private_key_managed' was not found in SLS 'configuration.tls'
Reason: 'x509' __virtual__ returned False: Could not load x509 state: m2crypto unavailable
Changes:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment