OpenSSL error when running 'sudo mailinabox'

Something strange happened. I also had the same problem after, I think, some Python packages got updated. The problem seems to be some incompatibility between the Python packages pyOpenSSL and cryptography.

I was able to solve this by removing pyOpenSSL and cryptography completely and then re-installing pyOpenSSL:

sudo apt-get -y purge python3-openssl
sudo rm -rf /usr/local/lib/python3.4/dist-packages/{OpenSSL,cryptography}*
sudo pip3 install pyOpenSSL

Then running the Mail-in-a-Box setup again:

sudo mailinabox

(or the curl...|bash command).

(Actually this isn’t exactly what I did, but now that I’ve fixed my box I can’t go back to try out these commands, but they will hopefully work. As a note to self: cryptography is explicitly installed by Mail-in-a-Box setup so it will get installed again. pyOpenSSL isn’t, but it’s depended on by acme, and since acme may already be installed pip won’t look at its dependencies, so we have to explicitly put pyOpenSSL back.)

Let me know whether this fixes things?