{"id":196,"date":"2021-08-02T16:56:41","date_gmt":"2021-08-02T08:56:41","guid":{"rendered":"http:\/\/blog.nonot.cn\/?p=196"},"modified":"2024-07-08T12:53:47","modified_gmt":"2024-07-08T04:53:47","slug":"tomcat%e5%90%af%e5%8a%a8%e6%85%a2%e7%9a%84%e5%8e%9f%e5%9b%a0%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2021\/08\/02\/tomcat%e5%90%af%e5%8a%a8%e6%85%a2%e7%9a%84%e5%8e%9f%e5%9b%a0%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95\/","title":{"rendered":"Tomcat\u542f\u52a8\u6162\u7684\u539f\u56e0\u53ca\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728CentOS\u542f\u52a8Tomcat\u65f6\uff0c\u542f\u52a8\u8fc7\u7a0b\u5f88\u6162\uff0c\u9700\u8981\u51e0\u5206\u949f\uff0c\u7ecf\u8fc7\u67e5\u770b\u65e5\u5fd7\uff0c\u53d1\u73b0\u8017\u65f6\u5728\u8fd9\u91cc\uff1a\u662fsession\u5f15\u8d77\u7684\u968f\u673a\u6570\u95ee\u9898\u5bfc\u81f4\u7684\u3002Tocmat\u7684Session ID\u662f\u901a\u8fc7SHA1\u7b97\u6cd5\u8ba1\u7b97\u5f97\u5230\u7684\uff0c\u8ba1\u7b97Session ID\u7684\u65f6\u5019\u5fc5\u987b\u6709\u4e00\u4e2a\u5bc6\u94a5\u3002\u4e3a\u4e86\u63d0\u9ad8\u5b89\u5168\u6027Tomcat\u5728\u542f\u52a8\u7684\u65f6\u5019\u56de\u901a\u8fc7\u968f\u673a\u751f\u6210\u4e00\u4e2a\u5bc6\u94a5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tid-YmRjfx\">1.\u5177\u4f53\u62a5\u9519\u5982\u4e0b\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>22-Apr-2019 19:33:07.623 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of\n SecureRandom instancefor session ID generation using [SHA1PRNG] took [55,507] milliseconds.\n22-Apr-2019 19:33:07.653 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web appli\ncation directory\/home\/apache-tomcat-8.0.27\/webapps\/ROOT has finishedin 55,935 ms<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3b\u8981\u539f\u56e0\u662f\u751f\u6210\u968f\u673a\u6570\u7684\u65f6\u5019\u5361\u4f4f\u4e86,\u5bfc\u81f4tomcat\u542f\u52a8\u4e0d\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u662f\u5426\u6709\u8db3\u591f\u7684\u71b5\u6765\u7528\u4e8e\u4ea7\u751f\u968f\u673a\u6570\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u6765\u67e5\u770b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@pre1 tools]# cat \/proc\/sys\/kernel\/random\/entropy_avail&lt;br>20<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u52a0\u901f\/dev\/random\u63d0\u4f9b\u968f\u673a\u6570\u7684\u901f\u5ea6\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u64cd\u4f5c\u8bbe\u5907\u7684\u5916\u8bbe\uff0c\u8ba9\u5176\u4ea7\u751f\u5927\u91cf\u7684\u4e2d\u65ad\uff08\u5982\u7f51\u7edc\u4f20\u8f93\u6570\u636e\uff0c\u6309\u952e\uff0c\u79fb\u52a8\u9f20\u6807\uff0c\u5728\u547d\u4ee4\u884c\u6572\u51e0\u4e2a\u4e0d\u540c\u7684\u547d\u4ee4\uff0c\u4fd7\u79f0\u805a\u6c14\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tid-fFxfhh\">2.\u89e3\u51b3\u65b9\u6cd5\u4e00<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>vim $JAVA_HOME\/jre\/lib\/security\/java.security\nsecurerandom.source=file:\/dev\/random\n\u6539\u4e3a \nsecurerandom.source=file:\/dev\/urandom<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tid-SwHk8c\">3.\u89e3\u51b3\u65b9\u6cd5\u4e8c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>vim $TOMCAT_HOME\/bin\/catalina.sh\n \nif [[\"$JAVA_OPTS\" != *-Djava.security.egd=* ]];then\n \n    JAVA_OPTS=\"$JAVA_OPTS -Djava.security.egd=file:\/dev\/urandom\"\n \nfi<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u7cfb\u7edf\u5c5e\u6027egd\u8868\u793a\u71b5\u6536\u96c6\u5b88\u62a4\u8fdb\u7a0b(entropy gathering daemon)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tid-PAbnpm\">4.\u89e3\u51b3\u65b9\u6cd5\u4e09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>yuminstall rng-tools# \u5b89\u88c5rngd\u670d\u52a1\uff08\u71b5\u670d\u52a1\uff0c\u589e\u5927\u71b5\u6c60\uff09\n \nsystemctl start rngd # \u542f\u52a8\u670d\u52a1&lt;br>&lt;br><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u770b\u542f\u52a8\u72b6\u6001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@pre1 ~]# systemctl status rngd\n\u25cf rngd.service - Hardware RNG Entropy Gatherer Daemon\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/rngd.service; enabled; vendor preset: enabled)\n   Active: active (running) since Wed 2019-05-15 10:15:54 CST; 4s ago\n Main PID: 1540 (rngd)\n   CGroup:\/system.slice\/rngd.service\n           \u2514\u25001540\/sbin\/rngd -f\n \nMay 15 10:15:54 RAP systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.\nMay 15 10:15:54 RAP systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...\nMay 15 10:15:54 RAP rngd[1540]: Initalizing available sources\nMay 15 10:15:54 RAP rngd[1540]: Failed to init entropysource 0: Hardware RNG Device\nMay 15 10:15:54 RAP rngd[1540]: Failed to init entropysource 2: Intel RDRAND Instruction RNG\nMay 15 10:15:56 RAP rngd[1540]: Enabling JITTER rng support<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728CentOS\u542f\u52a8Tomcat\u65f6\uff0c\u542f\u52a8\u8fc7\u7a0b\u5f88\u6162\uff0c\u9700\u8981\u51e0\u5206\u949f\uff0c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-tomcat"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=196"}],"version-history":[{"count":1,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":1215,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/196\/revisions\/1215"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}