{"id":5272,"date":"2017-08-04T13:52:40","date_gmt":"2017-08-04T10:52:40","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=5272"},"modified":"2017-08-04T13:52:40","modified_gmt":"2017-08-04T10:52:40","slug":"tomcat-%d0%bf%d1%80%d0%b0%d0%b2%d0%b8%d0%bb%d1%8c%d0%bd%d0%be-%d0%b4%d0%be%d0%b1%d0%b0%d0%b2%d0%bb%d1%8f%d0%b5%d0%bc-%d0%be%d0%b1%d0%bd%d0%be%d0%b2%d0%bb%d1%8f%d0%b5%d0%bc-%d1%81%d0%b5%d1%80%d1%82","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5272","title":{"rendered":"[tomcat] \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c (\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c) \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442"},"content":{"rendered":"<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u04391, \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u04392):<\/p>\n<p><code># cat CAroot.crt intermediate_l1.crt intermediate_l2.crt &gt; chain.crt<\/code><\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c <strong>p12<\/strong>-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430 \u0444\u0430\u0439\u043b keystore):<\/p>\n<p><code># openssl pkcs12 -export -chain -in domain.crt -inkey domain.key -out domain.p12 -name tomcat -CAfile chain.crt<\/code><\/p>\n<p><!--more--><\/p>\n<p>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 (\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c)<\/p>\n<p><code># keytool -delete -alias tomcat -keystore keystore<\/code><\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u044b\u0439:<\/p>\n<p><code># keytool -importkeystore -destkeystore keystore -srckeystore domain.p12 -alias tomcat<\/code><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b:<\/p>\n<p><code># keytool -list -keystore keystore -v | less<br \/>\nKeystore type: JKS<br \/>\nKeystore provider: SUN<br \/>\nYour keystore contains 1 entry<br \/>\nAlias name: tomcat<br \/>\nCreation date: Aug 4, 2017<br \/>\nEntry type: PrivateKeyEntry<br \/>\n<span style=\"color: #ff0000;\"><strong>Certificate chain length: 4<\/strong><\/span><br \/>\nCertificate[1]:<br \/>\n...<\/code><\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0443 \u043d\u0430\u0441 1 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0441 \u0446\u0435\u043f\u043e\u0447\u043a\u043e\u0439 \u0438\u0437 4-\u043e\u0445 \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #0000ff;\"><em><strong>\u041e\u0448\u0438\u0431\u043a\u0438<\/strong><\/em><\/span><\/h2>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Error:<\/strong><\/span><\/p>\n<p><code>java.io.IOException: Illegal header: -----BEGIN CERTIFICATE-----<\/code><\/p>\n<p><strong><span style=\"color: #008000;\">Solution:<\/span><\/strong><\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u0435 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435\/\u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 &#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;. \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0432 tomcat8 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e 5 \u0434\u0435\u0444\u0438\u0441\u043e\u0432.<\/p>\n<p><strong><span style=\"color: #ff0000;\">Error:<\/span><\/strong><\/p>\n<p><code>java.security.UnrecoverableKeyException: Cannot recover key<\/code><\/p>\n<p><strong><span style=\"color: #008000;\">Solution:<\/span><\/strong><\/p>\n<p>\u041f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b p12 \u0431\u044b\u043b \u043e\u0442\u043b\u0438\u0447\u0435\u043d \u043e\u0442 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0430 \u0431\u0430\u0437\u0443 keystore. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<p><strong><span style=\"color: #ff0000;\">Error:<\/span><\/strong><\/p>\n<p><code>Failed to establish chain from reply<\/code><\/p>\n<p><span style=\"color: #008000;\"><strong>Solution:<\/strong><\/span><\/p>\n<p>\u041d\u0430\u0440\u0443\u0448\u0435\u043d\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u043f\u0440\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0435. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Error:<\/strong><\/span><\/p>\n<p><code>Error unable to get issuer certificate getting chain.<\/code><\/p>\n<p><strong><span style=\"color: #008000;\">Solution:<\/span><\/strong><\/p>\n<p>\u041d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0438\u0436\u0435\u0441\u0442\u043e\u044f\u0449\u0438\u0435. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0441\u0442\u043e\u044f\u0449\u0438\u0435 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0432 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u04391, \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u04392): # cat CAroot.crt intermediate_l1.crt intermediate_l2.crt &gt; chain.crt \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c p12-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430 \u0444\u0430\u0439\u043b keystore): # openssl pkcs12 -export -chain -in domain.crt -inkey domain.key -out domain.p12 -name tomcat -CAfile chain.crt<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-5272","post","type-post","status-publish","format-standard","hentry","category-others"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5272"}],"version-history":[{"count":1,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5272\/revisions"}],"predecessor-version":[{"id":5273,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5272\/revisions\/5273"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}