hbldh / pybankid

BankID Relying Party client for Python
https://pybankid.readthedocs.io
MIT License
48 stars 19 forks source link

Openssl version changed in OSX High Sierra #10

Closed moodh closed 6 years ago

moodh commented 6 years ago

OSX High sierra seems to have changed openssl implementations to LibreSSL which causes a check in pybankid to crash.

(flow) moodh:~/pybankid$ which openssl /usr/bin/openssl

(flow) moodh:~/pybankid$ openssl version LibreSSL 2.2.7

Here's the relevant code: https://github.com/hbldh/pybankid/blob/master/bankid/certutils.py#L76

        p = subprocess.Popen(['openssl', 'version'], stdout=subprocess.PIPE)
        sout, serr = p.communicate()
        if not sout.decode().lower().startswith('openssl'):
            raise NotImplementedError(
                "OpenSSL executable could not be found. "
                "Splitting cannot be performed.")
        print(sout.strip())
        openssl_executable = 'openssl'

I guess both has to be supported. I can fix a PR if you'd like but since the change is trivial you might just want to fix it yourself. :)

Thanks!

hbldh commented 6 years ago

Interesting; will get this done shortly. The certutils has not really been a prioritized part of PyBankID, more like a convenience tool for splitting certs that hopefully works for most people. The check that fails is pretty hacky to begin with, so it is not surprising that it fails.

hbldh commented 6 years ago

@moodh Just to make sure; you have tried changing to startswith('libressl') and made sure that it works? I have no Mac to test it with myself...

moodh commented 6 years ago

No, I added the homebrew path before i ran the script :) I'll try adapting the real code and let you know!

hbldh commented 6 years ago

Clone the repo and use the latest commit on the develop branch; implemented a fix there.

On 10 Nov 2017, at 18:32, Kalle Moodh notifications@github.com wrote:

No, I added the homebrew path before i ran the script :) I'll try adapting the real code and let you know!

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.

moodh commented 6 years ago

Just tested it and the split_certificate function works. Thanks!

hbldh commented 6 years ago

Fixed in cfb6afc25544b2acd3f488c2914634d7d361acfa. Included in version 0.6.1 release on PyPI.