I'm getting the following error when I try to make an ssl connection from inside a chroot jail:
twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion.
I'm using the openssl 0.9.6 with pyopenssl to make the ssl connection and I'm using the twisted python library for python 2.4 on Linux (centos 5.5).
After some troubleshooting I've discovered that openssl is failing because it is trying to read the /dev/random file and it is failing because there is no /dev/random inside the chroot. I've confirmed that if I create a /dev/random file inside the chroot the connection succeeds.
What is the right way to initialize openssl if I don't have access to /dev/random from my program?
Perhaps a better way is to bind-mount the device files as follows:
# touch chroot/dev/random
# mount --bind /dev/random chroot/dev/random
and the same for urandom.