---
slug: "特定のwebサービスに、https(TLS1.2)で接続できない(固まる)場合"
title: "特定のwebサービスに、https (TLS1.2)で接続できない(固まる)場合"
description: "\n\n\n特定のwebサーバーと、OpenSSL 1.0.1a 〜  OpenSSL 1.0.1f のバージョンで、TLS1.2 で通信をしようとすると OpenSSLが固まることがあります。"
url: "https://www.ytyng.com/blog/特定のwebサービスに、https(TLS1.2)で接続できない(固まる)場合"
publish_date: "2015-06-11T05:50:02Z"
created: "2015-06-11T05:50:02Z"
updated: "2026-02-26T20:39:08.883Z"
categories: ["Linux"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/51d2e8f065f64b11a2ca1188d461fbac.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "ja"
---

# 特定のwebサービスに、https (TLS1.2)で接続できない(固まる)場合

<div class="document">


<p>特定のwebサーバーと、OpenSSL 1.0.1a 〜  OpenSSL 1.0.1f のバージョンで、TLS1.2 で通信をしようとすると OpenSSLが固まることがあります。</p>
<p>OpenSSL 1.0.1f は、2015年6月現在、Ubuntu 14.04, Ubuntu 15.04 などの apt で最新版で自動的に入るバージョンで、これ以上のバージョンアップは apt ではできません。</p>
<p>そこで、改修された OpenSSL 1.0.1g をインストールする方法です。</p>
<div class="section" id="id1">
<h3>インストール前の状態</h3>
<p>OpenSSLのバージョン</p>
<pre class="literal-block">$ openssl version
OpenSSL 1.0.1f 6 Jan 2014
</pre>
<p>SSLコネクションの動作確認</p>
<pre class="literal-block">$ openssl s_client -connect hoge.example.com:443  # サイト名は仮
→固まる
</pre>
<p>試しに、TLS1.2を回避して接続</p>
<pre class="literal-block">$ openssl s_client -connect home.example.com:443 -no_tls1_2
→ コネクションできる
</pre>
</div>
<div class="section" id="id2">
<h3>ビルド&amp;インストール</h3>
<pre class="literal-block">$ wget https://www.openssl.org/source/openssl-1.0.1g.tar.gz
$ tar -xzvf openssl-1.0.1g.tar.gz
$ cd openssl-1.0.1g
$ ./config
$ make
$ sudo make install_sw
$ sudo ln -sf /usr/local/ssl/bin/openssl \`which openssl\`
</pre>
<p>もしここで、make install としてしまうと、</p>
<pre class="literal-block">cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 71.
make: *** [install_docs] エラー 255
</pre>
<p>こうなってエラーで落ちます。manページのビルドに失敗しているらしい。
なので、make install_sw とします。manページのビルドを行わないらしい。</p>
</div>
<div class="section" id="id3">
<h3>動作確認</h3>
<pre class="literal-block">$ openssl version
OpenSSL 1.0.1g 7 Apr 2014

$ openssl s_client -connect hoge.example.com:443
→コネクションできた!
</pre>
</div>
<div class="section" id="id4">
<h3>ただし</h3>
<p>これで、OpenSSLのバージョンアップはできましたが、これに依存する curl, PHP, Python, その他の更新が必要な場合、それらもビルドしなおしがいるかもしれませんので、けっこう面倒です。</p>
<p>curl, PHP, Python を使ってこのバグを踏んでいる場合、それらのアプリで TLS1.2 での接続を回避させた方が修正が容易かもしれません。</p>
<p>→ <a class="reference external" href="http://b.ytyng.com/a-62/">http://b.ytyng.com/a-62/</a>
Curl, Python, PHP で HTTPS 接続する際固まるサイトがあるので、TLS1.2 を使わないようにする</p>
</div>
<div class="section" id="id5">
<h3>参考</h3>
<p>How To Upgrade OpenSSL to 1.0.1g To Guard Against Heartbleed in Ubuntu ~ Bauer-Power Media
<a class="reference external" href="http://www.bauer-power.net/2014/05/how-to-upgrade-openssl-to-101g-to-guard.html#.VXaBpOdCLHM">http://www.bauer-power.net/2014/05/how-to-upgrade-openssl-to-101g-to-guard.html#.VXaBpOdCLHM</a></p>
<p>Linuxbrew でインストールしてもいいかも</p>
<p>Linuxbrew のススメ - Qiita
<a class="reference external" href="http://qiita.com/thermes/items/926b478ff6e3758ecfea">http://qiita.com/thermes/items/926b478ff6e3758ecfea</a></p>
</div>
</div>
