{"id":299,"date":"2017-07-04T14:21:28","date_gmt":"2017-07-04T06:21:28","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=299"},"modified":"2017-07-04T14:21:28","modified_gmt":"2017-07-04T06:21:28","slug":"tomcat%e5%9c%a8ubuntu%e4%b8%8b%e5%90%af%e5%8a%a8%e7%bc%93%e6%85%a2%ef%bc%8c%e8%80%97%e6%97%b6%e5%be%88%e9%95%bf%e6%97%b6%e9%97%b4","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=299","title":{"rendered":"tomcat\u5728ubuntu\u4e0b\u542f\u52a8\u7f13\u6162\uff0c\u8017\u65f6\u5f88\u957f\u65f6\u95f4"},"content":{"rendered":"<div class=\"titlebar\">\n<h1>tomcat\u5728ubuntu\u4e0b\u542f\u52a8\u7f13\u6162\uff0c\u8017\u65f6\u5f88\u957f\u65f6\u95f4\uff0cCreation of SecureRandom instance for session ID generation using [SHA1PRNG]<\/h1>\n<div class=\"titbar cl\">\u7f16\u8f91\u65f6\u95f4:2017-02-10 <span class=\"where\">\u6d4f\u89c8\u91cf:1059<\/span><\/div>\n<\/div>\n<div id=\"cnt_main_article\" class=\"content cl\">\n<p>\u5c06tomcat\u90e8\u7f72\u5230ubuntu\u4e0b\u542f\u52a8\u65f6\u53d1\u73b0\u9700\u898110\u51e0\u5206\u949f\u624d\u80fd\u542f\u52a8\u5b8c\u6210\uff0c\u4f46\u662f\u5728windows\u4e0b\u542f\u52a8\u65f6\u53ea\u9700\u51e0\u79d2\u949f\u7684\u65f6\u95f4\uff0c\u67e5\u770b\u65e5\u5fd7\u53d1\u73b0Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [342,445] milliseconds\uff0c\u6b64\u5904\u8017\u8d39\u4e86\u5f88\u957f\u7684\u65f6\u95f4\uff0c\u4e0a\u7f51\u67e5\u8be2\u89e3\u51b3\uff0c\u7279\u6b64\u8bb0\u5f55\u3002<\/p>\n<p>Tomcat 7\u542f\u52a8\u5f88\u6162\uff0c\u4e14\u65e5\u5fd7\u4e0a\u65e0\u4efb\u4f55\u9519\u8bef\uff0c\u5728\u65e5\u5fd7\u4e2d\u67e5\u770b\u5230\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n<pre class=\"brush:plain;toolbar:false\">Log4j:[2016-10-29\u00a015:47:11]\u00a0INFO\u00a0ReadProperty:172\u00a0-\u00a0Loading\u00a0properties\u00a0file\u00a0from\u00a0class\u00a0path\u00a0resource\u00a0[resources\/jdbc.properties]\u00a0\nLog4j:[2016-10-29\u00a015:47:11]\u00a0INFO\u00a0ReadProperty:172\u00a0-\u00a0Loading\u00a0properties\u00a0file\u00a0from\u00a0class\u00a0path\u00a0resource\u00a0[resources\/common.properties]\u00a0\n29-Oct-2016\u00a015:52:53.587\u00a0INFO\u00a0[localhost-startStop-1]\u00a0org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom\u00a0Creation\u00a0of\u00a0SecureRandom\u00a0instance\u00a0for\u00a0session\u00a0ID\u00a0generation\u00a0using\u00a0[SHA1PRNG]\u00a0took\u00a0[342,445]\u00a0milliseconds.<\/pre>\n<p>\u539f\u56e0<\/p>\n<p>Tomcat 7\/8\u90fd\u4f7f\u7528org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom\u7c7b\u4ea7\u751f\u5b89\u5168\u968f\u673a\u7c7bSecureRandom\u7684\u5b9e\u4f8b\u4f5c\u4e3a\u4f1a\u8bddID\uff0c\u8fd9\u91cc\u82b1\u53bb\u4e86342\u79d2\uff0c\u4e5f\u5373\u63a5\u8fd16\u5206\u949f\u3002<\/p>\n<p>SHA1PRNG\u7b97\u6cd5\u662f\u57fa\u4e8eSHA-1\u7b97\u6cd5\u5b9e\u73b0\u4e14\u4fdd\u5bc6\u6027\u8f83\u5f3a\u7684\u4f2a\u968f\u673a\u6570\u751f\u6210\u5668\u3002<\/p>\n<p>\u5728SHA1PRNG\u4e2d\uff0c\u6709\u4e00\u4e2a\u79cd\u5b50\u4ea7\u751f\u5668\uff0c\u5b83\u6839\u636e\u914d\u7f6e\u6267\u884c\u5404\u79cd\u64cd\u4f5c\u3002<\/p>\n<p>1\uff09\u5982\u679cJava.security.egd \u5c5e\u6027\u6216securerandom.source\u5c5e\u6027\u6307\u5b9a\u7684\u662f\u201dfile:\/dev\/random\u201d\u6216\u201dfile:\/dev\/urandom\u201d\uff0c\u90a3\u4e48JVM \u4f1a\u4f7f\u7528\u672c\u5730\u79cd\u5b50\u4ea7\u751f\u5668NativeSeedGenerator\uff0c\u5b83\u4f1a\u8c03\u7528super()\u65b9\u6cd5\uff0c\u5373\u8c03\u7528 SeedGenerator.URLSeedGenerator(\/dev\/random)\u65b9\u6cd5\u8fdb\u884c\u521d\u59cb\u5316\u3002<\/p>\n<p>2\uff09\u5982\u679cjava.security.egd\u5c5e\u6027\u6216securerandom.source\u5c5e\u6027\u6307\u5b9a\u7684\u662f\u5176\u5b83\u5df2\u5b58\u5728\u7684URL\uff0c\u90a3\u4e48\u4f1a\u8c03\u7528SeedGenerator.URLSeedGenerator(url)\u65b9\u6cd5\u8fdb\u884c\u521d\u59cb\u5316\u3002<\/p>\n<p>\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u6211\u4eec\u8bbe\u7f6e\u503c\u4e3a\u201dfile:\/\/\/dev\/urandom\u201d\u6216\u8005\u503c\u4e3a\u201dfile:\/.\/dev\/random\u201d\u90fd\u4f1a\u8d77\u4f5c\u7528\u7684\u539f\u56e0\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u5b9e\u73b0\u4e2d\uff0c\u4ea7\u751f\u5668\u4f1a\u8bc4\u4f30\u71b5\u6c60\uff08entropy pool\uff09\u4e2d\u7684\u566a\u58f0\u6570\u91cf\u3002\u968f\u673a\u6570\u662f\u4ece\u71b5\u6c60\u4e2d\u8fdb\u884c\u521b\u5efa\u7684\u3002\u5f53\u8bfb\u64cd\u4f5c\u65f6\uff0c\/dev\/random\u8bbe\u5907\u4f1a\u53ea\u8fd4\u56de\u71b5\u6c60\u4e2d\u566a\u58f0\u7684\u968f\u673a\u5b57\u8282\u3002\/dev\/random\u975e \u5e38\u9002\u5408\u90a3\u4e9b\u9700\u8981\u975e\u5e38\u9ad8\u8d28\u91cf\u968f\u673a\u6027\u7684\u573a\u666f\uff0c\u6bd4\u5982\u4e00\u6b21\u6027\u7684\u652f\u4ed8\u6216\u751f\u6210\u5bc6\u94a5\u7684\u573a\u666f\u3002<\/p>\n<p>\u5f53\u71b5\u6c60\u4e3a\u7a7a\u65f6\uff0c\u6765\u81ea\/dev\/random\u7684\u8bfb\u64cd\u4f5c\u5c06\u88ab\u963b\u585e\uff0c\u76f4\u5230\u71b5\u6c60\u6536\u96c6\u5230\u8db3\u591f\u7684\u73af\u5883\u566a\u58f0\u6570\u636e\u3002\u8fd9\u4e48\u505a\u7684\u76ee\u7684\u662f\u6210\u4e3a\u4e00\u4e2a\u5bc6\u7801\u5b89\u5168\u7684\u4f2a\u968f\u673a\u6570\u53d1\u751f\u5668\uff0c\u71b5\u6c60\u8981\u6709\u5c3d\u53ef\u80fd\u5927\u7684\u8f93\u51fa\u3002\u5bf9\u4e8e\u751f\u6210\u9ad8\u8d28\u91cf\u7684\u52a0\u5bc6\u5bc6\u94a5\u6216\u8005\u662f\u9700\u8981\u957f\u671f\u4fdd\u62a4\u7684\u573a\u666f\uff0c\u4e00\u5b9a\u8981\u8fd9\u4e48\u505a\u3002<\/p>\n<p>\u90a3\u4e48\u4ec0\u4e48\u662f\u73af\u5883\u566a\u58f0\uff1f<\/p>\n<p>\u968f\u673a\u6570\u4ea7\u751f\u5668\u4f1a\u624b\u673a\u6765\u81ea\u8bbe\u5907\u9a71\u52a8\u5668\u548c\u5176\u5b83\u6e90\u7684\u73af\u5883\u566a\u58f0\u6570\u636e\uff0c\u5e76\u653e\u5165\u71b5\u6c60\u4e2d\u3002\u4ea7\u751f\u5668\u4f1a\u8bc4\u4f30\u71b5\u6c60\u4e2d\u7684\u566a\u58f0\u6570\u636e\u7684\u6570\u91cf\u3002\u5f53\u71b5\u6c60\u4e3a\u7a7a\u65f6\uff0c\u8fd9\u4e2a\u566a\u58f0\u6570\u636e\u7684\u6536\u96c6\u662f\u6bd4\u8f83\u82b1\u65f6\u95f4\u7684\u3002\u8fd9\u5c31\u610f\u5473\u7740\uff0cTomcat\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u71b5\u6c60\u65f6\uff0c\u4f1a\u88ab\u963b\u585e\u8f83\u957f\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u89e3\u51b3<\/p>\n<p>\u6709\u4e24\u79cd\u89e3\u51b3\u529e\u6cd5\uff1a<\/p>\n<p>1\uff09\u5728Tomcat\u73af\u5883\u4e2d\u89e3\u51b3<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6eJRE\u4f7f\u7528\u975e\u963b\u585e\u7684Entropy Source\u3002<\/p>\n<p>\u5728catalina.sh\u4e2d\u52a0\u5165\u8fd9\u4e48\u4e00\u884c\uff1a-Djava.security.egd=file:\/dev\/.\/urandom \u5373\u53ef\u3002<\/p>\n<p>\u52a0\u5165\u540e\u518d\u542f\u52a8Tomcat\uff0c\u6574\u4e2a\u542f\u52a8\u8017\u65f6\u4e0b\u964d\u5230Server startup in 2912 ms\u3002<\/p>\n<p>2\uff09\u5728JVM\u73af\u5883\u4e2d\u89e3\u51b3<\/p>\n<p>\u6253\u5f00$JAVA_PATH\/jre\/lib\/security\/java.security\u8fd9\u4e2a\u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u7684\u5185\u5bb9\uff1a<\/p>\n<p>securerandom.source=file:\/dev\/urandom<\/p>\n<p>\u66ff\u6362\u6210<\/p>\n<p>securerandom.source=file:\/dev\/.\/urandom<\/p>\n<p>\u672c\u6b21\u4f7f\u7528\u7b2c\u4e00\u79cd\u65b9\u5f0f\u89e3\u51b3\uff1a<\/p>\n<p><img decoding=\"async\" title=\"1486710284197093404.png\" src=\"http:\/\/www.weare.net.cn\/EasyWeb\/upload\/image\/20170210\/1486710284197093404.png\" alt=\"blob.png\" \/><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>tomcat\u5728ubuntu\u4e0b\u542f\u52a8\u7f13\u6162\uff0c\u8017\u65f6\u5f88\u957f\u65f6\u95f4\uff0cCreation of SecureRandom instance for session ID generation using [SHA1PRNG] \u7f16\u8f91\u65f6\u95f4:2017-02-10 \u6d4f\u89c8\u91cf:1059 \u5c06tomcat\u90e8\u7f72\u5230ubuntu\u4e0b\u542f\u52a8\u65f6\u53d1\u73b0\u9700\u898110\u51e0\u5206\u949f\u624d\u80fd\u542f\u52a8\u5b8c\u6210\uff0c\u4f46\u662f\u5728windows\u4e0b\u542f\u52a8\u65f6\u53ea\u9700\u51e0\u79d2\u949f\u7684\u65f6\u95f4\uff0c\u67e5\u770b\u65e5\u5fd7\u53d1\u73b0Creation of SecureRandom instance for session ID generation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/299\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}