JPRS ACME » 履歴 » バージョン 1
蒲池 晃, 2026/03/04 08:32
| 1 | 1 | 蒲池 晃 | h1. JPRS ACME 導入手順 |
|---|---|---|---|
| 2 | 1 | 蒲池 晃 | |
| 3 | 1 | 蒲池 晃 | 事前に、eab-kid と eab-hmac-key を入手しておく |
| 4 | 1 | 蒲池 晃 | |
| 5 | 1 | 蒲池 晃 | 1.certbot のインストール |
| 6 | 1 | 蒲池 晃 | <pre> |
| 7 | 1 | 蒲池 晃 | sudo dnf update -y |
| 8 | 1 | 蒲池 晃 | sudo dnf install -y certbot python3-certbot-apache |
| 9 | 1 | 蒲池 晃 | </pre> |
| 10 | 1 | 蒲池 晃 | |
| 11 | 1 | 蒲池 晃 | --- OSが古くてうまく行かない時 --- |
| 12 | 1 | 蒲池 晃 | |
| 13 | 1 | 蒲池 晃 | aptのリストを書き換える |
| 14 | 1 | 蒲池 晃 | <pre> |
| 15 | 1 | 蒲池 晃 | vi /etc/apt/sources.list |
| 16 | 1 | 蒲池 晃 | </pre> |
| 17 | 1 | 蒲池 晃 | <pre> |
| 18 | 1 | 蒲池 晃 | deb http://archive.debian.org/debian/ buster main contrib non-free |
| 19 | 1 | 蒲池 晃 | deb http://archive.debian.org/debian/ buster-proposed-updates main contrib non-free |
| 20 | 1 | 蒲池 晃 | deb http://archive.debian.org/debian-security buster/updates main contrib non-free |
| 21 | 1 | 蒲池 晃 | </pre> |
| 22 | 1 | 蒲池 晃 | <pre> |
| 23 | 1 | 蒲池 晃 | echo 'Acquire::Check-Valid-Until "false";' | sudo tee /etc/apt/apt.conf.d/99no-check-valid-until |
| 24 | 1 | 蒲池 晃 | </pre> |
| 25 | 1 | 蒲池 晃 | 更新 |
| 26 | 1 | 蒲池 晃 | <pre> |
| 27 | 1 | 蒲池 晃 | sudo apt clean |
| 28 | 1 | 蒲池 晃 | sudo apt update |
| 29 | 1 | 蒲池 晃 | </pre> |
| 30 | 1 | 蒲池 晃 | インストールする |
| 31 | 1 | 蒲池 晃 | <pre> |
| 32 | 1 | 蒲池 晃 | sudo apt install -y snapd |
| 33 | 1 | 蒲池 晃 | sudo snap install core |
| 34 | 1 | 蒲池 晃 | sudo snap refresh core |
| 35 | 1 | 蒲池 晃 | sudo snap install --classic certbot |
| 36 | 1 | 蒲池 晃 | sudo ln -s /snap/bin/certbot /usr/bin/certbot |
| 37 | 1 | 蒲池 晃 | </pre> |
| 38 | 1 | 蒲池 晃 | ------ |
| 39 | 1 | 蒲池 晃 | バージョンの確認 |
| 40 | 1 | 蒲池 晃 | <pre> |
| 41 | 1 | 蒲池 晃 | certbot --version |
| 42 | 1 | 蒲池 晃 | </pre> |
| 43 | 1 | 蒲池 晃 | 3.JPRS 用ディレクトリ作成(分離運用) |
| 44 | 1 | 蒲池 晃 | <pre> |
| 45 | 1 | 蒲池 晃 | sudo mkdir -p /etc/letsencrypt-jprs |
| 46 | 1 | 蒲池 晃 | sudo mkdir -p /var/lib/letsencrypt-jprs |
| 47 | 1 | 蒲池 晃 | sudo mkdir -p /var/log/letsencrypt-jprs |
| 48 | 1 | 蒲池 晃 | </pre> |
| 49 | 1 | 蒲池 晃 | 4.JPRS ACME アカウント登録(EAB) |
| 50 | 1 | 蒲池 晃 | <pre> |
| 51 | 1 | 蒲池 晃 | sudo certbot register \ |
| 52 | 1 | 蒲池 晃 | --config-dir /etc/letsencrypt-jprs \ |
| 53 | 1 | 蒲池 晃 | --work-dir /var/lib/letsencrypt-jprs \ |
| 54 | 1 | 蒲池 晃 | --logs-dir /var/log/letsencrypt-jprs \ |
| 55 | 1 | 蒲池 晃 | -m 'admin@example.jp' \ |
| 56 | 1 | 蒲池 晃 | --agree-tos \ |
| 57 | 1 | 蒲池 晃 | --eab-kid '<JPRS_EAB_KID>' \ |
| 58 | 1 | 蒲池 晃 | --eab-hmac-key '<JPRS_EAB_HMAC_KEY>' \ |
| 59 | 1 | 蒲池 晃 | --server 'https://acme.amecert.jprs.jp/DV/getDirectory' |
| 60 | 1 | 蒲池 晃 | </pre> |
| 61 | 1 | 蒲池 晃 | 5ー1.証明書の発行(Webroot 方式・通常ドメイン用) |
| 62 | 1 | 蒲池 晃 | <pre> |
| 63 | 1 | 蒲池 晃 | sudo certbot certonly \ |
| 64 | 1 | 蒲池 晃 | --config-dir /etc/letsencrypt-jprs \ |
| 65 | 1 | 蒲池 晃 | --work-dir /var/lib/letsencrypt-jprs \ |
| 66 | 1 | 蒲池 晃 | --logs-dir /var/log/letsencrypt-jprs \ |
| 67 | 1 | 蒲池 晃 | --webroot -w /var/www/html \ |
| 68 | 1 | 蒲池 晃 | --key-type rsa \ |
| 69 | 1 | 蒲池 晃 | -d example.jp -d www.example.jp \ |
| 70 | 1 | 蒲池 晃 | --server 'https://acme.amecert.jprs.jp/DV/getDirectory' |
| 71 | 1 | 蒲池 晃 | </pre> |
| 72 | 1 | 蒲池 晃 | 5-2.証明書の発行(DNS-01 方式・ワイルドカード対応) |
| 73 | 1 | 蒲池 晃 | DNSテキストレコードを発行 |
| 74 | 1 | 蒲池 晃 | <pre> |
| 75 | 1 | 蒲池 晃 | sudo certbot certonly \ |
| 76 | 1 | 蒲池 晃 | --config-dir /etc/letsencrypt-jprs \ |
| 77 | 1 | 蒲池 晃 | --work-dir /var/lib/letsencrypt-jprs \ |
| 78 | 1 | 蒲池 晃 | --logs-dir /var/log/letsencrypt-jprs \ |
| 79 | 1 | 蒲池 晃 | --manual \ |
| 80 | 1 | 蒲池 晃 | --preferred-challenges dns \ |
| 81 | 1 | 蒲池 晃 | --key-type rsa \ |
| 82 | 1 | 蒲池 晃 | -d '*.example.jp' -d example.jp \ |
| 83 | 1 | 蒲池 晃 | --server 'https://acme.amecert.jprs.jp/DV/getDirectory' |
| 84 | 1 | 蒲池 晃 | </pre> |
| 85 | 1 | 蒲池 晃 | 発行されたTXTレコードをDNSに登録 |
| 86 | 1 | 蒲池 晃 | DNSが設定されたら、 |
| 87 | 1 | 蒲池 晃 | <pre> |
| 88 | 1 | 蒲池 晃 | dig TXT _acme-challenge.example.jp +short |
| 89 | 1 | 蒲池 晃 | </pre> |
| 90 | 1 | 蒲池 晃 | 6.下記のようなファイルが生成される |
| 91 | 1 | 蒲池 晃 | <pre> |
| 92 | 1 | 蒲池 晃 | /etc/letsencrypt-jprs/live/example.jp/fullchain.pem |
| 93 | 1 | 蒲池 晃 | /etc/letsencrypt-jprs/live/example.jp/privkey.pem |
| 94 | 1 | 蒲池 晃 | </pre> |
| 95 | 1 | 蒲池 晃 | 7.APACHEのConfigを設定する |
| 96 | 1 | 蒲池 晃 | <pre> |
| 97 | 1 | 蒲池 晃 | <VirtualHost *:443> |
| 98 | 1 | 蒲池 晃 | ServerName example.jp |
| 99 | 1 | 蒲池 晃 | ServerAlias www.example.jp |
| 100 | 1 | 蒲池 晃 | |
| 101 | 1 | 蒲池 晃 | DocumentRoot /var/www/html |
| 102 | 1 | 蒲池 晃 | |
| 103 | 1 | 蒲池 晃 | SSLEngine on |
| 104 | 1 | 蒲池 晃 | SSLCertificateFile /etc/letsencrypt-jprs/live/example.jp/fullchain.pem |
| 105 | 1 | 蒲池 晃 | SSLCertificateKeyFile /etc/letsencrypt-jprs/live/example.jp/privkey.pem |
| 106 | 1 | 蒲池 晃 | </VirtualHost> |
| 107 | 1 | 蒲池 晃 | </pre> |
| 108 | 1 | 蒲池 晃 | 8.定期的な更新方法 |
| 109 | 1 | 蒲池 晃 | <pre> |
| 110 | 1 | 蒲池 晃 | sudo certbot renew \ |
| 111 | 1 | 蒲池 晃 | --config-dir /etc/letsencrypt-jprs \ |
| 112 | 1 | 蒲池 晃 | --work-dir /var/lib/letsencrypt-jprs \ |
| 113 | 1 | 蒲池 晃 | --logs-dir /var/log/letsencrypt-jprs \ |
| 114 | 1 | 蒲池 晃 | --dry-run |
| 115 | 1 | 蒲池 晃 | </pre> |
| 116 | 1 | 蒲池 晃 | このコマンドを入れた後にHTTPDを再起動する |
| 117 | 1 | 蒲池 晃 | <pre> |
| 118 | 1 | 蒲池 晃 | service httpd restart |
| 119 | 1 | 蒲池 晃 | </pre> |
| 120 | 1 | 蒲池 晃 | これをシェルスクリプトにして、月に1回事項する |
| 121 | 1 | 蒲池 晃 | <pre> |
| 122 | 1 | 蒲池 晃 | 10 1 1 * * root /home/bitnami/batchfiles/certbot-jprs.sh |
| 123 | 1 | 蒲池 晃 | </pre> |
| 124 | 1 | 蒲池 晃 | |
| 125 | 1 | 蒲池 晃 | </pre> |