<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>&#8211;no-check-certificate &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/no-check-certificate/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Sun, 14 Aug 2022 08:39:48 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>&#8211;no-check-certificate &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Unable to locally verify the issuer&#8217;s authority. To connect to &#8230; insecurely, use `&#8211;no-check-certificate&#8217;.</title>
		<link>https://noter.tw/10130/unable-to-locally-verify-the-issuers-authority-to-connect-to-insecurely-use-no-check-certificate/</link>
					<comments>https://noter.tw/10130/unable-to-locally-verify-the-issuers-authority-to-connect-to-insecurely-use-no-check-certificate/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sun, 14 Aug 2022 06:54:03 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[伺服器]]></category>
		<category><![CDATA[--no-check-certificate]]></category>
		<category><![CDATA[wget]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=10130</guid>

					<description><![CDATA[<p>從舊主機移機到新主機的過程中發現有些 crontab 裡的腳本不動了，檢查後發現「Unable to locally verify the issuer&#8217;s authority.」的錯誤，&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/10130/unable-to-locally-verify-the-issuers-authority-to-connect-to-insecurely-use-no-check-certificate/" data-wpel-link="internal">Unable to locally verify the issuer&#8217;s authority. To connect to &#8230; insecurely, use `&#8211;no-check-certificate&#8217;.</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>從舊主機移機到新主機的過程中發現有些 crontab 裡的腳本不動了，檢查後發現「Unable to locally verify the issuer&#8217;s authority.」的錯誤，這邊文章把解決的方法記下來。</p>



<span id="more-10130"></span>



<p>小蛙在新主機上使用 wget 的時候發現沒辦法正常使用，會出現以下訊息</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">root@vultr:~# wget https://www.google.com.tw/

ERROR: cannot verify www.goog.com.tw's certificate, issued by ‘....’:
  Unable to locally verify the issuer's authority.
To connect to www.google.com.tw insecurely, use `--no-check-certificate'.</pre>



<p>試了 <code>wget --no-check-certificate</code> 之後的確可以存取了，不過有些也有用到 wget 的套件內容就沒辦法這樣處理了，必須從根本上解決。例如：使用到 <a href="https://www.php.net/manual/en/function.file-get-contents.php" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">file_get_contents<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 的 <a href="https://simplehtmldom.sourceforge.io/docs/1.9/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">simple_html_dom<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 也沒辦法使用</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in simple_html_dom.php on line 82

Warning: file_get_contents(): Failed to enable crypto in simple_html_dom.php on line 82

Warning: file_get_contents(https://xxx...): failed to open stream: operation failed in simple_html_dom.php on line 82

Fatal error: Uncaught Error: Call to a member function find() on bool in parseC.php:106
Stack trace:
#0 {main}
  thrown in parseC.php on line 106</pre>



<p>上 <a href="https://serverfault.com/questions/314635/why-wget-doesnt-verify-ssl-certificates" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">serverfault.com<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 查到以下這個方法：</p>



<ol class="my-li bg-darkblue wp-block-list"><li>下載 ca-certificates<br><code>sudo apt install ca-certificates</code></li><li>編輯使用 wget 的時候使用的設定檔<br><code>sudo vim /etc/wgetrc</code></li><li>在檔案最下面加入<br><code>ca_directory=/etc/ssl/certs</code></li></ol>



<p>打完收工，再試一次 wget 不會再噴錯了，留給有需要的人（感謝 <a href="https://serverfault.com/users/156244/jared" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Jared<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 大大，參考自：<a href="https://serverfault.com/questions/314635/why-wget-doesnt-verify-ssl-certificates" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">Why wget doesn&#8217;t verify SSL certificates? @ serverfault.com<span class="wpel-icon wpel-image wpel-icon-6"></span></a>）</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img fetchpriority="high" decoding="async" src="https://lh3.googleusercontent.com/pw/AL9nZEVYOgASjox_YUPIXuSmQilPYAIyB2dNKAFDKL_J0IqvcQx2_6byc1IWjJGKjOh7e_cE5tfccTIjmbQZkqVjN7EI4ynXcvokcUPyAZ1I_SI0SgrPCaV0yQJC46o2xi4MybayAoc13d1WDCzMoe5y3V45=w1457-h1024-no?authuser=2" alt="AL9nZEVYOgASjox YUPIXuSmQilPYAIyB2dNKAFDKL J0IqvcQx2 6byc1IWjJGKjOh7e cE5tfccTIjmbQZkqVjN7EI4ynXcvokcUPyAZ1I SI0SgrPCaV0yQJC46o2xi4MybayAoc13d1WDCzMoe5y3V45=w1457 h1024 no?authuser=2 Unable to locally verify the issuer&#039;s authority. To connect to ... insecurely, use `--no-check-certificate&#039;." width="729" height="512" title="Unable to locally verify the issuer&#039;s authority. To connect to ... insecurely, use `--no-check-certificate&#039;."></figure></div><p>這篇文章 <a rel="nofollow" href="https://noter.tw/10130/unable-to-locally-verify-the-issuers-authority-to-connect-to-insecurely-use-no-check-certificate/" data-wpel-link="internal">Unable to locally verify the issuer&#8217;s authority. To connect to &#8230; insecurely, use `&#8211;no-check-certificate&#8217;.</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/10130/unable-to-locally-verify-the-issuers-authority-to-connect-to-insecurely-use-no-check-certificate/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
