{"id":466,"date":"2020-12-24T16:25:29","date_gmt":"2020-12-24T08:25:29","guid":{"rendered":"http:\/\/blog.refusea.com\/?p=466"},"modified":"2020-12-24T16:25:29","modified_gmt":"2020-12-24T08:25:29","slug":"linux-%e4%b8%8d%e8%83%bd%e8%ae%bf%e9%97%ae-https-%e7%bd%91%e7%ab%99","status":"publish","type":"post","link":"https:\/\/refusea.com\/?p=466","title":{"rendered":"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>linux \u4e0a\u7684 python \u811a\u672c\u4e00\u76f4\u6b63\u5e38\u8fd0\u884c\uff0c\u6700\u8fd1\u51e0\u5929\u8fde\u7eed\u51fa\u9519\uff0c\u67e5\u770b\u65e5\u5fd7\uff0c\u53d1\u73b0\u5982\u4e0b\u9519\u8bef\u4fe1\u606f<\/p>\n<pre><code class=\"language-python\">ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)<\/code><\/pre>\n<p>\u770b\u4e0a\u53bb\u662f\u811a\u672c\u8bbf\u95ee\u67d0\u4e2a https \u7f51\u9875\u5931\u8d25\u5bfc\u81f4\u7684\u3002\u8be1\u5f02\u7684\u662f\u8fd9\u4e2a\u9519\u8bef\u5e76\u4e0d\u662f\u5fc5\u73b0\u7684\uff0c\u8fd9\u4e2a\u811a\u672c\u6709\u65f6\u5019\u53c8\u80fd\u6b63\u5e38\u6267\u884c<\/p>\n<h2>\u5b89\u88c5 ssl \u5e93<\/h2>\n<p>\u5370\u8c61\u91cc\u8fd9\u4e0d\u662f\u7b2c\u4e00\u6b21\u4e86\uff0c\u6211\u627e\u4e86\u4e0b\u4ee5\u524d\u505a\u7684\u8bb0\u5f55\uff0c\u5982\u4e0b<\/p>\n<pre><code class=\"language-bash\"># \u89e3\u51b3 linux \u65e0\u6cd5\u8bbf\u95ee https \u7684\u95ee\u9898\nyum install openssl-devel\nyum install zlib-devel bzip2-devel sqlite sqlite-devel openssl-devel<\/code><\/pre>\n<p>\u4e00\u901a\u64cd\u4f5c\u731b\u5982\u864e\uff0c\u611f\u89c9\u53ef\u4ee5\u641e\u5b9a\u6536\u5de5\u4e86\uff0c\u7136\u800c&#8230;&#8230;<\/p>\n<pre><code class=\"language-bash\">curl https:\/\/www.baidu.com\n\ncurl: (60) Peer certificate cannot be authenticated with known CA certificates\nMore details here: http:\/\/curl.haxx.se\/docs\/sslcerts.html\n\ncurl performs SSL certificate verification by default, using a &quot;bundle&quot;\n of Certificate Authority (CA) public keys (CA certs). If the default\n bundle file isn&#039;t adequate, you can specify an alternate file\n using the --cacert option.\nIf this HTTPS server uses a certificate signed by a CA represented in\n the bundle, the certificate verification probably failed due to a\n problem with the certificate (it might be expired, or the name might\n not match the domain name in the URL).\nIf you&#039;d like to turn off curl&#039;s verification of the certificate, use\n the -k (or --insecure) option.<\/code><\/pre>\n<p>\u5c3c\u739b\u8fd9\u662f\u4ec0\u4e48\u64cd\u4f5c\uff1f\u767e\u5ea6\u7684 ssl \u8bc1\u4e66\u4e0d\u80fd\u88ab\u5df2\u77e5\u7684 CA \u9a8c\u8bc1\uff1f\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u767e\u5ea6\u7f51\u7ad9\u5f88\u6b63\u5e38\uff0c\u8fd9\u6837\u770b\u6765 linux \u7cfb\u7edf\u81ea\u5e26\u7684\u8bc1\u4e66\u5e93\u6709\u70b9\u8fc7\u65f6\u4e86\u5427<\/p>\n<h2>\u66f4\u65b0\u8bc1\u4e66\u5e93<\/h2>\n<p>\u7ecf\u8fc7\u4e00\u756a\u7814\u7a76\uff0c\u53d1\u73b0 linux \u7cfb\u7edf\u81ea\u5e26\u7684\u8bc1\u4e66\u5e93\u662f  <code>\/etc\/pki\/tls\/certs\/ca-bundle.crt<\/code>\uff0c\u4f30\u6478\u7740\u662f\u8fd9\u4e2a\u8bc1\u4e66\u5e93\u81ea\u8eab\u7684\u95ee\u9898\uff0c\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u65f6\u7075\u65f6\u4e0d\u7075\uff0c\u8fd8\u771f\u6ca1\u6709\u641e\u660e\u767d\u2014\u2014\u603b\u4e4b\u4e0d\u7ba1\u90a3\u4e48\u591a\uff0c\u66f4\u65b0\u4e00\u4e0b\u672c\u5730\u8bc1\u4e66\u5e93\u5427\uff0c\u5982\u4e0b\u64cd\u4f5c\u4e00\u756a<\/p>\n<p>\u5b89\u88c5 ca-certificates<\/p>\n<pre><code class=\"language-bash\">yum install ca-certificates<\/code><\/pre>\n<p>\u66f4\u65b0\u672c\u5730\u8bc1\u4e66\u5e93<\/p>\n<pre><code class=\"language-bash\">update-ca-trust -h\nusage: \/usr\/bin\/update-ca-trust [extract | check | enable | disable | force-enable | force-disable ]\n\nupdate-ca-trust check\nPEM\/JAVA Status: DISABLED.\n   (Legacy setup with static files.)\nPKCS#11 module Status, see symbolic links reported below:\nlrwxrwxrwx 1 root root 28 Jul 16 10:08 \/etc\/alternatives\/libnssckbi.so.x86_64 -&gt; \/usr\/lib64\/nss\/libnssckbi.so\n    (link resolving to NSS: using legacy static list)\n    (link resolving to p11-kit: using the new source configuration)\n\nupdate-ca-trust enable<\/code><\/pre>\n<p>\u73b0\u5728\u518d\u8bd5\u4e00\u4e0b<\/p>\n<pre><code class=\"language-bash\">curl https:\/\/www.baidu.com\n\n&lt;!DOCTYPE html&gt;\n&lt;!--STATUS OK--&gt;&lt;html&gt; &lt;head&gt;......&lt;\/html&gt;<\/code><\/pre>\n<p>\u641e\u5b9a\uff0c\u6536\u5de5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f linux \u4e0a\u7684 python \u811a\u672c\u4e00\u76f4\u6b63\u5e38\u8fd0\u884c\uff0c\u6700\u8fd1\u51e0\u5929\u8fde\u7eed\u51fa\u9519\uff0c\u67e5\u770b\u65e5\u5fd7\uff0c\u53d1\u73b0\u5982\u4e0b\u9519\u8bef\u4fe1\u606f ssl. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[46,45],"class_list":["post-466","post","type-post","status-publish","format-standard","hentry","category-linux","tag-python","tag-ssl"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9 - \u62d2\u6d77\u7a7a\u95f4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/refusea.com\/?p=466\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"refusea.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/refusea.com\/?p=466#article\",\"isPartOf\":{\"@id\":\"https:\/\/refusea.com\/?p=466\"},\"author\":{\"name\":\"refusea.com\",\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df\"},\"headline\":\"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9\",\"datePublished\":\"2020-12-24T08:25:29+00:00\",\"dateModified\":\"2020-12-24T08:25:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/refusea.com\/?p=466\"},\"wordCount\":11,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df\"},\"keywords\":[\"python\",\"ssl\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/refusea.com\/?p=466#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/refusea.com\/?p=466\",\"url\":\"https:\/\/refusea.com\/?p=466\",\"name\":\"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9 - \u62d2\u6d77\u7a7a\u95f4\",\"isPartOf\":{\"@id\":\"https:\/\/refusea.com\/#website\"},\"datePublished\":\"2020-12-24T08:25:29+00:00\",\"dateModified\":\"2020-12-24T08:25:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/refusea.com\/?p=466#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/refusea.com\/?p=466\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/refusea.com\/?p=466#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/refusea.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/refusea.com\/#website\",\"url\":\"https:\/\/refusea.com\/\",\"name\":\"\u62d2\u6d77\u7a7a\u95f4\",\"description\":\"\u62d2\u6d77\u7684\u4e2a\u4eba\u535a\u5ba2\",\"publisher\":{\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/refusea.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df\",\"name\":\"refusea.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7f7489b4afdbd952db64e7a6704d1258?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7f7489b4afdbd952db64e7a6704d1258?s=96&d=mm&r=g\",\"caption\":\"refusea.com\"},\"logo\":{\"@id\":\"https:\/\/refusea.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/refusea.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9 - \u62d2\u6d77\u7a7a\u95f4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/refusea.com\/?p=466","twitter_misc":{"\u4f5c\u8005":"refusea.com","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/refusea.com\/?p=466#article","isPartOf":{"@id":"https:\/\/refusea.com\/?p=466"},"author":{"name":"refusea.com","@id":"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df"},"headline":"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9","datePublished":"2020-12-24T08:25:29+00:00","dateModified":"2020-12-24T08:25:29+00:00","mainEntityOfPage":{"@id":"https:\/\/refusea.com\/?p=466"},"wordCount":11,"commentCount":0,"publisher":{"@id":"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df"},"keywords":["python","ssl"],"articleSection":["Linux"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/refusea.com\/?p=466#respond"]}]},{"@type":"WebPage","@id":"https:\/\/refusea.com\/?p=466","url":"https:\/\/refusea.com\/?p=466","name":"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9 - \u62d2\u6d77\u7a7a\u95f4","isPartOf":{"@id":"https:\/\/refusea.com\/#website"},"datePublished":"2020-12-24T08:25:29+00:00","dateModified":"2020-12-24T08:25:29+00:00","breadcrumb":{"@id":"https:\/\/refusea.com\/?p=466#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/refusea.com\/?p=466"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/refusea.com\/?p=466#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/refusea.com\/"},{"@type":"ListItem","position":2,"name":"linux \u4e0d\u80fd\u8bbf\u95ee https \u7f51\u7ad9"}]},{"@type":"WebSite","@id":"https:\/\/refusea.com\/#website","url":"https:\/\/refusea.com\/","name":"\u62d2\u6d77\u7a7a\u95f4","description":"\u62d2\u6d77\u7684\u4e2a\u4eba\u535a\u5ba2","publisher":{"@id":"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/refusea.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/refusea.com\/#\/schema\/person\/b5393cc8b15717000d19424552aae0df","name":"refusea.com","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/refusea.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7f7489b4afdbd952db64e7a6704d1258?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7f7489b4afdbd952db64e7a6704d1258?s=96&d=mm&r=g","caption":"refusea.com"},"logo":{"@id":"https:\/\/refusea.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/refusea.com"]}]}},"_links":{"self":[{"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/posts\/466"}],"collection":[{"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/refusea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466"}],"version-history":[{"count":3,"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/posts\/466\/revisions"}],"predecessor-version":[{"id":469,"href":"https:\/\/refusea.com\/index.php?rest_route=\/wp\/v2\/posts\/466\/revisions\/469"}],"wp:attachment":[{"href":"https:\/\/refusea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/refusea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/refusea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}