SSL:CERTIFICATE_VERIFY_FAILED on macOS

I installed asciinema via macports and Python via the Mac OS X installer, then ran the Install Certificates.command. Here are the versions of what I’m running:

  • asciinema 2.0.1
  • OpenSSL 1.0.2p 14 Aug 2018
  • Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
  • macOS 10.13.6

I can record .cast files just fine — but when I try to upload them, I get:

asciinema: upload failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)>
asciinema: retry later by running: asciinema upload tmpxiczb8r9-ascii.cast

How do I resolve this problem?

Checkout https://github.com/asciinema/asciinema/issues/235 . Few approaches:

Approach 1: Toggle your https API url to http within your $HOME/.config/asciinema/config file.

Approach 2: Add the cert to your local trusted store. For OSX …
$ openssl s_client -showcerts -connect “url:port” < /dev/null 2> /dev/null | openssl x509 -outform PEM >somesite.crt

$ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain somesite.crt

Approach 3: I patched the asciinema client with an additional --insecure flag to deal with self-signed certificates. Works great for play and upload use cases against asciinema-server urls with imperfect SSL certs. You can grab the python wheel and install it using these two commands:

curl -Lo asciinema-2.0.0.1-py3-none-any.whl http://ibm.biz/asciinema-client
sudo -H pip3 install asciinema-2.0.0.1-py3-none-any.whl

Good Luck.