我正在运行 Tomcat 6。我在搞乱我的密钥库以尝试修复一些证书链问题,并且我不小心rm
使用了生产版本而不是.new
我正在使用的文件。
现在,Tomcat 仍在运行并且仍然能够提供 HTTPS 连接(我在 Web 浏览器中对其进行了测试)。显然,必须有它仍然可以访问的私钥的副本。我的第一个想法是检查/proc/PID/fd
,所以我跑了sudo lsof | grep tomcat
。这会正确返回打开文件的列表:
$ sudo lsof | head -1; sudo lsof | grep tomcat
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 2599 root cwd DIR 202,1 4096 413699 /usr/share/apache-tomcat-6.0.44/bin
java 2599 root mem REG 202,1 51715 413777 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-fr.jar
java 2599 root mem REG 202,1 528303 413771 /usr/share/apache-tomcat-6.0.44/lib/jasper.jar
java 2599 root mem REG 202,1 1250454 413767 /usr/share/apache-tomcat-6.0.44/lib/catalina.jar
java 2599 root mem REG 202,1 132216 413765 /usr/share/apache-tomcat-6.0.44/lib/catalina-ha.jar
java 2599 root mem REG 202,1 54334 413778 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-ja.jar
java 2599 root mem REG 202,1 1830791 413768 /usr/share/apache-tomcat-6.0.44/lib/ecj-4.3.1.jar
java 2599 root mem REG 202,1 54624 413764 /usr/share/apache-tomcat-6.0.44/lib/catalina-ant.jar
java 2599 root mem REG 202,1 70563 413776 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-es.jar
java 2599 root mem REG 202,1 112521 413770 /usr/share/apache-tomcat-6.0.44/lib/jasper-el.jar
java 2599 root mem REG 202,1 76649 413772 /usr/share/apache-tomcat-6.0.44/lib/jsp-api.jar
java 2599 root mem REG 202,1 34622 413769 /usr/share/apache-tomcat-6.0.44/lib/el-api.jar
java 2599 root mem REG 202,1 253635 413775 /usr/share/apache-tomcat-6.0.44/lib/tomcat-dbcp.jar
java 2599 root mem REG 202,1 15250 413763 /usr/share/apache-tomcat-6.0.44/lib/annotations-api.jar
java 2599 root mem REG 202,1 801374 413774 /usr/share/apache-tomcat-6.0.44/lib/tomcat-coyote.jar
java 2599 root mem REG 202,1 239165 413766 /usr/share/apache-tomcat-6.0.44/lib/catalina-tribes.jar
java 2599 root mem REG 202,1 132240 413773 /usr/share/apache-tomcat-6.0.44/lib/servlet-api.jar
java 2599 root mem REG 202,1 32384 413759 /usr/share/apache-tomcat-6.0.44/bin/tomcat-juli.jar
java 2599 root mem REG 202,1 24283 413753 /usr/share/apache-tomcat-6.0.44/bin/commons-daemon.jar
java 2599 root mem REG 202,1 22807 413749 /usr/share/apache-tomcat-6.0.44/bin/bootstrap.jar
java 2599 root 1w REG 202,1 17024956 413713 /usr/share/apache-tomcat-6.0.44/logs/catalina.out
java 2599 root 2w REG 202,1 17024956 413713 /usr/share/apache-tomcat-6.0.44/logs/catalina.out
java 2599 root 4r REG 202,1 22807 413749 /usr/share/apache-tomcat-6.0.44/bin/bootstrap.jar
java 2599 root 5r REG 202,1 24283 413753 /usr/share/apache-tomcat-6.0.44/bin/commons-daemon.jar
java 2599 root 6r REG 202,1 32384 413759 /usr/share/apache-tomcat-6.0.44/bin/tomcat-juli.jar
java 2599 root 7w REG 202,1 4072 396419 /usr/share/apache-tomcat-6.0.44/logs/catalina.2016-04-21.log
java 2599 root 8w REG 202,1 1182 396447 /usr/share/apache-tomcat-6.0.44/logs/localhost.2016-04-21.log
java 2599 root 9w REG 202,1 0 396448 /usr/share/apache-tomcat-6.0.44/logs/manager.2016-04-21.log
java 2599 root 10w REG 202,1 0 396455 /usr/share/apache-tomcat-6.0.44/logs/host-manager.2016-04-21.log
java 2599 root 11r REG 202,1 239165 413766 /usr/share/apache-tomcat-6.0.44/lib/catalina-tribes.jar
java 2599 root 12r REG 202,1 801374 413774 /usr/share/apache-tomcat-6.0.44/lib/tomcat-coyote.jar
java 2599 root 13r REG 202,1 253635 413775 /usr/share/apache-tomcat-6.0.44/lib/tomcat-dbcp.jar
java 2599 root 14r REG 202,1 132240 413773 /usr/share/apache-tomcat-6.0.44/lib/servlet-api.jar
java 2599 root 15r REG 202,1 34622 413769 /usr/share/apache-tomcat-6.0.44/lib/el-api.jar
java 2599 root 16r REG 202,1 76649 413772 /usr/share/apache-tomcat-6.0.44/lib/jsp-api.jar
java 2599 root 17r REG 202,1 112521 413770 /usr/share/apache-tomcat-6.0.44/lib/jasper-el.jar
java 2599 root 18r REG 202,1 70563 413776 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-es.jar
java 2599 root 19r REG 202,1 54624 413764 /usr/share/apache-tomcat-6.0.44/lib/catalina-ant.jar
java 2599 root 20r REG 202,1 1830791 413768 /usr/share/apache-tomcat-6.0.44/lib/ecj-4.3.1.jar
java 2599 root 21r REG 202,1 54334 413778 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-ja.jar
java 2599 root 22r REG 202,1 15250 413763 /usr/share/apache-tomcat-6.0.44/lib/annotations-api.jar
java 2599 root 23r REG 202,1 132216 413765 /usr/share/apache-tomcat-6.0.44/lib/catalina-ha.jar
java 2599 root 24r REG 202,1 1250454 413767 /usr/share/apache-tomcat-6.0.44/lib/catalina.jar
java 2599 root 25r REG 202,1 528303 413771 /usr/share/apache-tomcat-6.0.44/lib/jasper.jar
java 2599 root 26r REG 202,1 51715 413777 /usr/share/apache-tomcat-6.0.44/lib/tomcat-i18n-fr.jar
bash 29579 ec2-user cwd DIR 202,1 4096 413708 /usr/share/apache-tomcat-6.0.44/conf
sudo 30595 root cwd DIR 202,1 4096 413708 /usr/share/apache-tomcat-6.0.44/conf
grep 30596 ec2-user cwd DIR 202,1 4096 413708 /usr/share/apache-tomcat-6.0.44/conf
lsof 30597 root cwd DIR 202,1 4096 413708 /usr/share/apache-tomcat-6.0.44/conf
lsof 30598 root cwd DIR 202,1 4096 413708 /usr/share/apache-tomcat-6.0.44/conf
但不幸的是,我的密钥库不是其中之一。我猜 Tomcat 一定已经将它加载到内存中,然后关闭了文件描述符。(密钥库在/conf
上面,但这些文件描述符来自我打开的 shell,而不是来自 Tomcat 本身。)
那么:有没有办法恢复我的私钥?我在亚马逊 Linux 上;uname -a
返回Linux ip-10-0-0-105 4.4.5-15.26.amzn1.x86_64 #1 SMP Wed Mar 16 17:15:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
。