当我试图从chroot监狱内部建立ssl连接时,我得到了以下错误:
twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion.我使用openssl 0.9.6和pyopenssl来建立ssl连接,在Linux (centos 5.5)上使用扭曲的python库python2.4。
经过一些故障排除后,我发现openssl失败是因为它试图读取/dev/随机文件,而它是因为chroot中没有/dev/随机文件而失败。我已经确认,如果我在chroot中创建一个/dev/随机文件,连接就会成功。
似乎过于复杂了。
如果我没有从程序中访问/dev/随机的权限,那么初始化openssl的正确方法是什么?
发布于 2014-12-27 11:57:39
也许更好的方法是按如下方式绑定-挂载设备文件:
# touch chroot/dev/random
# mount --bind /dev/random chroot/dev/random也同样适用于乌兰地。
发布于 2012-03-20 06:29:36
您可以为openssl假装随机,例如命令行openssl:
[root@quilt /]# openssl s_client -h
usage: s_client args
...
-rand file:file:...
...无论如何,openssl需要一个随机性的来源,如果没有随机的现在,它就不可能是安全的,例如维基百科:
为了生成用于安全连接的会话密钥,客户端使用服务器的公钥加密一个随机数,并将结果发送给服务器。只有服务器能够用它的私钥解密它。
没有随机性的来源,SSL/TLS很容易被黑客攻击。
如果您担心chroot/dev/会被删除,为什么不创建只安装整个开发的chroot/dev/random或chroot/dev/urandom整数呢?
[root@quilt /]# mknod /dev/random c 1 8
[root@quilt /]# mknod /dev/urandom c 1 9哦,顺便说一下,您还想复制system /etc/ copy以及可能的其他主机、服务、以太等.
发布于 2019-09-17 15:46:40
不要忘记在创建了urandom和随机之后的SELinux
cat /var/log/messages \ grep "SELinux正在防止“
SELinux is preventing /usr/sbin/php-fpm from read access on the chr_file urandom.
If you believe that php-fpm should be allowed read access on the urandom chr_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do allow this access for now by executing:ausearch -c 'php-fpm‘-原始
audit2allow -M my-phpfpm
信号模-i -phpfpm.pp
https://stackoverflow.com/questions/8591394
复制相似问题