{"id":271887,"date":"2016-01-11T12:37:02","date_gmt":"2016-01-11T09:37:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=271887"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=271887","title":{"rendered":"LetsEncrypt \u0432 Go"},"content":{"rendered":"<p>       \u0421\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b LetsEncrypt \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 3 \u043c\u0435\u0441\u044f\u0446\u0430, \u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 certonly \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 cron, \u043d\u043e \u0432 Go \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0422\u043e\u0447\u043d\u0435\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c<\/h3>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/\t\t log.Println(http.ListenAndServeTLS(&quot;:7544&quot;,  \/\/                               &quot;\/home\/user\/cert\/game01.example.com\/fullchain.pem&quot;,  \/\/                               &quot;\/home\/user\/cert\/game01.example.com\/privkey.pem&quot;, nil)) \t\tfor { \t\t\tlog.Println(pyrahttp.ListenAndServeLetsEncrypt(&quot;:7544&quot;,                                 &quot;\/home\/user\/cert\/game01.example.com\/fullchain.pem&quot;,                                 &quot;\/home\/user\/cert\/game01.example.com\/privkey.pem&quot;, nil)) \t\t\ttime.Sleep(time.Second * 5) \t\t} <\/code><\/pre>\n<p>  \u0426\u0438\u043a\u043b \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d. \u041e\u043d \u043d\u0443\u0436\u0435\u043d, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043f\u0430\u0434\u0430\u043b, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0435 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430, https \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0433\u0430\u0441\u043d\u0443\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u0438 \u043e\u0436\u0438\u0432\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h3>\n<p>  \u0412 \u043f\u0430\u043a\u0435\u0442\u0435 net\/http \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c http \u0438\u043b\u0438 https \u0441\u0435\u0440\u0432\u0435\u0440. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u0432\u043e\u0442 \u044d\u0442\u0438\u043c <a href=\"http:\/\/www.hydrogen18.com\/blog\/stop-listening-http-server-go.html\">\u043f\u043e\u0441\u0442\u043e\u043c<\/a>. \u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u043e\u0434 ListenAndServeTLS \u0438 \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 net\/http, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 <a href=\"https:\/\/github.com\/CossackPyra\/pyrahttp\/blob\/170bc727ac943c5251f5282827ccc9dc3779b858\/pyrahttp.go#L46\">pyrahttp.ListenAndServeLetsEncrypt<\/a>. <\/p>\n<p>  http.Server \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043c\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e net.Listener. \u041e\u043d\u0430 \u0432 Accept() \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 TCPListener.Accept() \u0441 Deadline \u0432 \u043e\u0434\u043d\u0443 \u043c\u0438\u043d\u0443\u0442\u0443. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 deadline \u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f listner \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0444\u0430\u0439\u043b \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d \u0442\u0430\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 ReloadError, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 <a href=\"https:\/\/github.com\/CossackPyra\/pyrahttp\/blob\/170bc727ac943c5251f5282827ccc9dc3779b858\/pyrahttp.go#L91\">ListenAndServeLetsEncrypt<\/a>. <\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043d\u0430 Go \u0441\u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0436\u0438\u0442\u044c \u0434\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u0438\u043b\u0438 \u0442\u0440\u0435\u0445\u043b\u0435\u0442\u0438\u044f \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\/\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">go get -u github.com\/CossackPyra\/pyrahttp <\/code><\/pre>\n<h3>PS<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d\u043e\u0432, \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 (\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445), \u0438 \u0432\u044b \u0440\u0430\u0437\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c LetsEncrypt, \u0442\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043c\u0435\u043d\u044f \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u0434 LetsEncrypt, \u0430 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \/.well-known\/acme-challenge \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 LetsEncrypt \u0441\u0435\u0440\u0432\u0435\u0440. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u044f \u043c\u043e\u0433\u0443 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432 \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430 \u043e\u0431\u0449\u0438\u0439 \u043f\u0440\u043e\u043a\u0441\u0438.               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/274749\/\"> http:\/\/habrahabr.ru\/post\/274749\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0421\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b LetsEncrypt \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 3 \u043c\u0435\u0441\u044f\u0446\u0430, \u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 certonly \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 cron, \u043d\u043e \u0432 Go \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-271887","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=271887"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271887\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=271887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=271887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=271887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}