LoginSignup
0
1

More than 3 years have passed since last update.

Let's encrypt あれこれ

Last updated at Posted at 2020-06-11
  • 有効期限90日間
  • 有効期限の30日前から更新可能
    • cron で自動更新にしておくと便利

環境

  • さくらのVPS
  • Apache/2.2.15
  • CentOS release 6.10

インストール

  • パッケージインストール
$ yum install epel-release
$ yum install gcc openssl-devel bzip2-devel
  • Python インストール
$ cd /usr/src
$ wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
$ tar xzf Python-2.7.14.tgz
$ cd Python-2.7.14
$ ./configure --enable-optimizations
$ make altinstall
$ /usr/local/bin/python2.7 -V
  • pip(pythonのパッケージ管理)インストール
$ curl -kL https://bootstrap.pypa.io/2.6/get-pip.py | python
  • virtualenv インストール(必要?)
$ pip install virtualenv
  • Certbot インストール
$ cd /usr/local/
$ wget https://dl.eff.org/certbot-auto
$ chmod a+x certbot-auto

証明書作成

$ cd /usr/local/
$ ./certbot-auto
# あとはコンソール入力

別のドメインも追加

  1. httpd.conf にドメインを追加
  2. certbot で SSL 設定
$ cd /usr/local/
$ ./certbot-auto
# ドメイン一覧が出るので、選ぶ
  1. ssl.conf を設定(自動で設定される?)
$ vi /etc/httpd/conf/httpd-le-ssl.conf
  1. apache 再起動(↑で自動設定された場合は不要)

ドメインの削除(証明書の削除)

  • ドメインの個別の削除はできなさそうなので、証明書を一旦失効させ、作り直す
# 証明書を失効させる
$ ./certbot-auto revoke --cert-name=ドメイン名

# 設定ファイルも削除
$ sudo rm /etc/httpd/conf/httpd-le-ssl.conf

# 証明書を作成
$ ./certbot-auto

証明書の更新

$ cd /usr/local/
# 有効期限の確認
$ ./certbot-auto certificates

# 更新(リハーサルして、エラーが出ないか確認)
$ ./certbot-auto renew --dry-run

# 更新(リハーサルでエラーが無ければ!)
$ ./certbot-auto renew
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1