ユーザ用ツール

サイト用ツール


サイドバー

このページの翻訳:



最近の更新



Tag Cloud

01_linux:02_www:14_let_s_encrypt

文書の過去の版を表示しています。


14 Let's Encrypt無料のSSL証明書

すごく簡単に、無料のSSL証明書が利用できる。

自動設定ツールを用意

# curl https://dl.eff.org/certbot-auto -o /usr/bin/certbot-auto
# chmod 700 /usr/bin/certbot-auto

証明書作成

# certbot-auto certonly \         # 証明書の作成
    --webroot \                   # 既存のウェブサーバを使うモードを選択
    -w /home/hogehoge/public_html \    # ドキュメント・ルートのパス
    -d hogehoge.fl8.jp \            # 認証するドメイン名
    --email <メール>@<アドレス>     # メールアドレス登録(証明書期限切れの通知用)
# ll /etc/letsencrypt/live/jp010.public.develop.kumolabo.com/*
lrwxrwxrwx 1 root root 57 11月 11 17:02 2016 /etc/letsencrypt/live/hogehoge.fl8.jp/cert.pem -> ../../archive/hogehoge.fl8.jp/cert2.pem
lrwxrwxrwx 1 root root 58 11月 11 17:02 2016 /etc/letsencrypt/live/hogehoge.fl8.jp/chain.pem -> ../../archive/hogehoge.fl8.jp/chain2.pem
lrwxrwxrwx 1 root root 62 11月 11 17:02 2016 /etc/letsencrypt/live/hogehoge.fl8.jp/fullchain.pem -> ../../archive/hogehoge.fl8.jp/fullchain2.pem
lrwxrwxrwx 1 root root 60 11月 11 17:02 2016 /etc/letsencrypt/live/hogehoge.fl8.jp/privkey.pem -> ../../archive/hogehoge.fl8.jp/privkey2.pem

後は、confに設定するだけ

 SSLCertificateFile /etc/letsencrypt/live/hogehoge.fl8.jp/cert.pem
 SSLCertificateKeyFile /etc/letsencrypt/live/hogehoge.fl8.jp/privkey.pem
 SSLCACertificateFile /etc/letsencrypt/live/hogehoge.fl8.jp/chain.pem

自動更新

更新

certbot-auto renew --post-hook "systemctl reload httpd"

強制更新

certbot-auto renew --force-renew --post-hook "systemctl reload httpd"

Cronの場合

0 0 * * *  scl enable python27 'bash /usr/bin/certbot-auto renew --post-hook "/sbin/service httpd reload" '

※mailでも利用する場合、postfix dovecotもリロードする。
下記は週1回リロードの場合

0 0 * * 6 /etc/init.d/postfix reload
0 0 * * 6 /etc/init.d/dovecot reload

エラー

「python-virtualenv」「python-pip」が無いためのエラー

/usr/bin/certbot-auto: line 583: virtualenv: command not found

epel.repoをenableしてやればOK

python2.7

/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6

これは、Pythonが2.6で有るためのエラー

Python2.7をインストールしてやれば解決
39 CentOS6 Python2.7

そのまま実行すると、古いライブラリを読んでエラーが出るので
一度下記のフォルダは削除してあげる

# rm -rvf /root/.local/share/letsencrypt
01_linux/02_www/14_let_s_encrypt.1504596925.txt.gz · 最終更新: 2017/09/05 16:35 by matsui