使用OpenSSL,"无法写入'随机状态'"是什么意思?
时间:2020-03-06 14:22:22 来源:igfitidea点击:
我正在生成一个自签名SSL证书来保护服务器的admin部分,并且不断从OpenSSL收到此消息:
unable to write 'random state'
这是什么意思?
这是在Ubuntu服务器上。我已经升级了libssl以修复最近的安全漏洞。
解决方案
实际上,发生这种情况的最常见原因似乎是主目录中的.rnd文件是由root而非帐户拥有的。快速修复:
sudo rm ~/.rnd
有关更多信息,这是OpenSSL FAQ中的条目:
Sometimes the openssl command line utility does not abort with a "PRNG not seeded" error message, but complains that it is "unable to write 'random state'". This message refers to the default seeding file (see previous answer). A possible reason is that no default filename is known because neither RANDFILE nor HOME is set. (Versions up to 0.9.6 used file ".rnd" in the current directory in this case, but this has changed with 0.9.6a.)
因此,我将检查RANDFILE,HOME和写入文件系统中那些位置的权限。
如果一切似乎都正常,则可以尝试使用strace运行并查看到底发生了什么。
显然,我需要以root用户身份运行OpenSSL,以使其具有对种子文件的权限。