Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x509.certificate_managed throw exception with Python3 #53316

Closed
cifvts opened this issue May 30, 2019 · 1 comment
Closed

x509.certificate_managed throw exception with Python3 #53316

cifvts opened this issue May 30, 2019 · 1 comment
Labels
Duplicate Duplicate of another issue or PR - will be closed

Comments

@cifvts
Copy link

cifvts commented May 30, 2019

Description of Issue

Using the state function x509.certificate_managed throw and exception when using SaltStack with Python3 support

Setup

/etc/openvpn/server/server1.crt :
    x509.certificate_managed :
        - ca_server         : ca_server
        - signing_policy    : openvpnserver
        - public_key        : /etc/openvpn/server1/server1.key
        - CN                : server1
        - days_remaining    : 90
        - days_valid        : 720
        - backup            : True
        - require           :
            - x509          : /etc/openvpn/server/server1.key
            - pkg           : openvpn

Steps to Reproduce Issue

(Debian 9.9)

  • Install salt-minion from Python3 repo
  • Install python3-pip
  • Install m2crypto using pip3
  • Execute the state
----------
          ID: /etc/openvpn/server/server1.crt
    Function: x509.certificate_managed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python3/dist-packages/salt/state.py", line 1933, in call
                  **cdata['kwargs'])
                File "/usr/lib/python3/dist-packages/salt/loader.py", line 1939, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python3/dist-packages/salt/states/x509.py", line 502, in certificate_managed
                  new = __salt__['x509.create_certificate'](testrun=True, **kwargs)
                File "/usr/lib/python3/dist-packages/salt/modules/x509.py", line 1383, in create_certificate
                  passphrase=kwargs['public_key_passphrase']).replace('\n', '')
              TypeError: a bytes-like object is required, not 'str'
     Started: 17:16:32.801267
    Duration: 9.888 ms
     Changes:   

Versions Report

Master is running Python2 version

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.33.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.4.3
ZMQ: 4.2.1

System Versions:
dist: debian 9.9
locale: UTF-8
machine: x86_64
release: 4.9.0-9-amd64
system: Linux
version: debian 9.9

@dmurphy18 dmurphy18 added the Duplicate Duplicate of another issue or PR - will be closed label May 30, 2019
@dmurphy18
Copy link
Contributor

@cifvts Marking this as a duplicate of #53294 , x509.py needs to be revised for Python 3 encode / decode handling, etc. for str / bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Duplicate of another issue or PR - will be closed
Projects
None yet
Development

No branches or pull requests

2 participants