CentOS7、CentOS6でもCentOS + Apache2.4環境の「Let's Encrypt」の導入を実施したので、CentOS8でも行います。
★関連記事
・CentOS6 + Apache2 を無料のSSL「Let's Encrypt」でSSL化
・CentOS7 + Apache2.4 を 無料 の SSL 「Let’s Encrypt」でSSL化
「Let's Encrypt」の詳細は上記の過去記事をご確認ください。
インストール
certbotのインストールを以下で実施します。
1 2 3 4 5 6 7 8 |
# cd /tmp # wget https://dl.eff.org/certbot-auto # mv certbot-auto /usr/local/bin/certbot-auto # chown root /usr/local/bin/certbot-auto # chmod 0755 /usr/local/bin/certbot-auto |
wgetで取得するだけですので非常にシンプルになっています。
必要なパッケージは次のコマンドを実施するとdnfインストールが始まります。
証明書のインストールを行います。
1 2 3 4 5 |
# /usr/local/bin/certbot-auto certonly --webroot -w /var/www/html -d example.com --email info@colabmix.co.jp Bootstrapping dependencies for RedHat-based OSes that will use Python3... (you can skip this with --no-bootstrap) dnf is /usr/bin/dnf |
おっと。エラーが出てしまました。
これはpython2.7が入っていない為に出るエラーのようです。
python2.7のインストールを実施します。
1 2 3 |
# dnf -y install scl-utils python27 |
再度、インストールを実施します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# /usr/local/bin/certbot-auto certonly --webroot -w /var/www/html -d example.com --email info@example.com Bootstrapping dependencies for RedHat-based OSes that will use Python3... (you can skip this with --no-bootstrap) dnf is /usr/bin/dnf dnf is hashed (/usr/bin/dnf) Last metadata expiration check: 0:01:08 ago on Tue 04 Feb 2020 01:28:31 PM JST. Package openssl-1:1.1.1c-2.el8.x86_64 is already installed. Package ca-certificates-2019.2.32-80.0.el8_1.noarch is already installed. Package python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 is already installed. Package mod_ssl-1:2.4.37-16.module_el8.1.0+256+ae790463.x86_64 is already installed. Dependencies resolved. ================================================================================ Package Arch Version Repo Size ================================================================================ Installing: gcc x86_64 8.3.1-4.5.el8 AppStream 23 M python3-virtualenv noarch 15.1.0-19.module_el8.1.0+245+c39af44f AppStream 100 k python36-devel x86_64 3.6.8-2.module_el8.1.0+245+c39af44f AppStream 16 k redhat-rpm-config noarch 120-1.el8 AppStream 83 k augeas-libs x86_64 1.12.0-2.el8 BaseOS 436 k libffi-devel x86_64 3.1-21.el8 BaseOS 29 k openssl-devel x86_64 1:1.1.1c-2.el8 BaseOS 2.3 M Installing dependencies: annobin x86_64 8.78-1.el8 AppStream 196 k cpp x86_64 8.3.1-4.5.el8 AppStream 10 M dwz x86_64 0.12-9.el8 AppStream 109 k efi-srpm-macros noarch 3-2.el8 AppStream 22 k ghc-srpm-macros noarch 1.4.2-7.el8 AppStream 9.3 k go-srpm-macros noarch 2-16.el8 AppStream 14 k isl x86_64 0.16.1-6.el8 AppStream 841 k libmpc x86_64 1.0.2-9.el8 AppStream 59 k ocaml-srpm-macros noarch 5-4.el8 AppStream 9.4 k openblas-srpm-macros noarch 2-2.el8 AppStream 7.9 k perl-srpm-macros noarch 1-25.el8 AppStream 11 k platform-python-devel x86_64 3.6.8-15.1.el8 AppStream 245 k python-rpm-macros noarch 3-37.el8 AppStream 14 k python-srpm-macros noarch 3-37.el8 AppStream 14 k python3-rpm-generators noarch 5-4.el8 AppStream 24 k python3-rpm-macros noarch 3-37.el8 AppStream 13 k python3-wheel-wheel noarch 1:0.31.1-2.module_el8.1.0+245+c39af44f AppStream 44 k qt5-srpm-macros noarch 5.11.1-2.el8 AppStream 11 k rust-srpm-macros noarch 5-2.el8 AppStream 9.2 k glibc-devel x86_64 2.28-72.el8 BaseOS 1.0 M glibc-headers x86_64 2.28-72.el8 BaseOS 469 k kernel-headers x86_64 4.18.0-147.3.1.el8_1 BaseOS 2.7 M keyutils-libs-devel x86_64 1.5.10-6.el8 BaseOS 48 k krb5-devel x86_64 1.17-9.el8 BaseOS 548 k libcom_err-devel x86_64 1.44.6-3.el8 BaseOS 38 k libkadm5 x86_64 1.17-9.el8 BaseOS 184 k libselinux-devel x86_64 2.9-2.1.el8 BaseOS 199 k libsepol-devel x86_64 2.9-1.el8 BaseOS 86 k libverto-devel x86_64 0.3.0-5.el8 BaseOS 18 k libxcrypt-devel x86_64 4.1.1-4.el8 BaseOS 25 k pcre2-devel x86_64 10.32-1.el8 BaseOS 605 k pcre2-utf16 x86_64 10.32-1.el8 BaseOS 228 k pcre2-utf32 x86_64 10.32-1.el8 BaseOS 220 k zlib-devel x86_64 1.2.11-10.el8 BaseOS 56 k Transaction Summary ================================================================================ Install 41 Packages Total download size: 45 M Installed size: 110 M Is this ok [y/N]: y Downloading Packages: (1/41): dwz-0.12-9.el8.x86_64.rpm 4.2 MB/s | 109 kB 00:00 (2/41): annobin-8.78-1.el8.x86_64.rpm 5.5 MB/s | 196 kB 00:00 (3/41): efi-srpm-macros-3-2.el8.noarch.rpm 2.5 MB/s | 22 kB 00:00 (4/41): ghc-srpm-macros-1.4.2-7.el8.noarch.rpm 1.8 MB/s | 9.3 kB 00:00 (5/41): go-srpm-macros-2-16.el8.noarch.rpm 2.3 MB/s | 14 kB 00:00 (6/41): isl-0.16.1-6.el8.x86_64.rpm 10 MB/s | 841 kB 00:00 (7/41): libmpc-1.0.2-9.el8.x86_64.rpm 7.7 MB/s | 59 kB 00:00 (8/41): ocaml-srpm-macros-5-4.el8.noarch.rpm 1.6 MB/s | 9.4 kB 00:00 (9/41): openblas-srpm-macros-2-2.el8.noarch.rpm 1.2 MB/s | 7.9 kB 00:00 (10/41): perl-srpm-macros-1-25.el8.noarch.rpm 1.6 MB/s | 11 kB 00:00 (11/41): cpp-8.3.1-4.5.el8.x86_64.rpm 28 MB/s | 10 MB 00:00 (12/41): gcc-8.3.1-4.5.el8.x86_64.rpm 26 MB/s | 23 MB 00:00 (13/41): python-srpm-macros-3-37.el8.noarch.rpm 2.7 MB/s | 14 kB 00:00 (14/41): platform-python-devel-3.6.8-15.1.el8.x 144 kB/s | 245 kB 00:01 (15/41): python3-rpm-macros-3-37.el8.noarch.rpm 2.6 MB/s | 13 kB 00:00 (16/41): python-rpm-macros-3-37.el8.noarch.rpm 8.4 kB/s | 14 kB 00:01 (17/41): python3-rpm-generators-5-4.el8.noarch. 21 kB/s | 24 kB 00:01 (18/41): python3-wheel-wheel-0.31.1-2.module_el 32 kB/s | 44 kB 00:01 (19/41): qt5-srpm-macros-5.11.1-2.el8.noarch.rp 1.9 MB/s | 11 kB 00:00 (20/41): redhat-rpm-config-120-1.el8.noarch.rpm 11 MB/s | 83 kB 00:00 (21/41): rust-srpm-macros-5-2.el8.noarch.rpm 2.0 MB/s | 9.2 kB 00:00 (22/41): python3-virtualenv-15.1.0-19.module_el 58 kB/s | 100 kB 00:01 (23/41): augeas-libs-1.12.0-2.el8.x86_64.rpm 3.1 MB/s | 436 kB 00:00 (24/41): glibc-headers-2.28-72.el8.x86_64.rpm 9.3 MB/s | 469 kB 00:00 (25/41): python36-devel-3.6.8-2.module_el8.1.0+ 10 kB/s | 16 kB 00:01 (26/41): keyutils-libs-devel-1.5.10-6.el8.x86_6 964 kB/s | 48 kB 00:00 (27/41): glibc-devel-2.28-72.el8.x86_64.rpm 7.0 MB/s | 1.0 MB 00:00 (28/41): libcom_err-devel-1.44.6-3.el8.x86_64.r 3.1 MB/s | 38 kB 00:00 (29/41): libffi-devel-3.1-21.el8.x86_64.rpm 1.4 MB/s | 29 kB 00:00 (30/41): kernel-headers-4.18.0-147.3.1.el8_1.x8 22 MB/s | 2.7 MB 00:00 (31/41): libkadm5-1.17-9.el8.x86_64.rpm 11 MB/s | 184 kB 00:00 (32/41): libselinux-devel-2.9-2.1.el8.x86_64.rp 12 MB/s | 199 kB 00:00 (33/41): libsepol-devel-2.9-1.el8.x86_64.rpm 5.7 MB/s | 86 kB 00:00 (34/41): libverto-devel-0.3.0-5.el8.x86_64.rpm 1.2 MB/s | 18 kB 00:00 (35/41): libxcrypt-devel-4.1.1-4.el8.x86_64.rpm 1.6 MB/s | 25 kB 00:00 (36/41): krb5-devel-1.17-9.el8.x86_64.rpm 4.8 MB/s | 548 kB 00:00 (37/41): pcre2-devel-10.32-1.el8.x86_64.rpm 13 MB/s | 605 kB 00:00 (38/41): pcre2-utf16-10.32-1.el8.x86_64.rpm 6.4 MB/s | 228 kB 00:00 (39/41): pcre2-utf32-10.32-1.el8.x86_64.rpm 13 MB/s | 220 kB 00:00 (40/41): zlib-devel-1.2.11-10.el8.x86_64.rpm 4.5 MB/s | 56 kB 00:00 (41/41): openssl-devel-1.1.1c-2.el8.x86_64.rpm 9.8 MB/s | 2.3 MB 00:00 -------------------------------------------------------------------------------- Total 10 MB/s | 45 MB 00:04 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-rpm-macros-3-37.el8.noarch 1/41 Installing : python-srpm-macros-3-37.el8.noarch 2/41 Installing : libmpc-1.0.2-9.el8.x86_64 3/41 Running scriptlet: libmpc-1.0.2-9.el8.x86_64 3/41 Installing : cpp-8.3.1-4.5.el8.x86_64 4/41 Running scriptlet: cpp-8.3.1-4.5.el8.x86_64 4/41 Installing : python-rpm-macros-3-37.el8.noarch 5/41 Installing : zlib-devel-1.2.11-10.el8.x86_64 6/41 Installing : pcre2-utf32-10.32-1.el8.x86_64 7/41 Installing : pcre2-utf16-10.32-1.el8.x86_64 8/41 Installing : pcre2-devel-10.32-1.el8.x86_64 9/41 Installing : libverto-devel-0.3.0-5.el8.x86_64 10/41 Installing : libsepol-devel-2.9-1.el8.x86_64 11/41 Installing : libselinux-devel-2.9-2.1.el8.x86_64 12/41 Installing : libkadm5-1.17-9.el8.x86_64 13/41 Installing : libcom_err-devel-1.44.6-3.el8.x86_64 14/41 Installing : keyutils-libs-devel-1.5.10-6.el8.x86_64 15/41 Installing : krb5-devel-1.17-9.el8.x86_64 16/41 Installing : kernel-headers-4.18.0-147.3.1.el8_1.x86_64 17/41 Running scriptlet: glibc-headers-2.28-72.el8.x86_64 18/41 Installing : glibc-headers-2.28-72.el8.x86_64 18/41 Installing : libxcrypt-devel-4.1.1-4.el8.x86_64 19/41 Installing : glibc-devel-2.28-72.el8.x86_64 20/41 Running scriptlet: glibc-devel-2.28-72.el8.x86_64 20/41 Installing : rust-srpm-macros-5-2.el8.noarch 21/41 Installing : qt5-srpm-macros-5.11.1-2.el8.noarch 22/41 Installing : python3-wheel-wheel-1:0.31.1-2.module_el8.1.0+245+ 23/41 Installing : python3-rpm-generators-5-4.el8.noarch 24/41 Installing : platform-python-devel-3.6.8-15.1.el8.x86_64 25/41 Installing : python36-devel-3.6.8-2.module_el8.1.0+245+c39af44f 26/41 Running scriptlet: python36-devel-3.6.8-2.module_el8.1.0+245+c39af44f 26/41 Installing : perl-srpm-macros-1-25.el8.noarch 27/41 Installing : openblas-srpm-macros-2-2.el8.noarch 28/41 Installing : ocaml-srpm-macros-5-4.el8.noarch 29/41 Installing : isl-0.16.1-6.el8.x86_64 30/41 Running scriptlet: isl-0.16.1-6.el8.x86_64 30/41 Installing : gcc-8.3.1-4.5.el8.x86_64 31/41 Running scriptlet: gcc-8.3.1-4.5.el8.x86_64 31/41 Installing : annobin-8.78-1.el8.x86_64 32/41 Installing : go-srpm-macros-2-16.el8.noarch 33/41 Installing : ghc-srpm-macros-1.4.2-7.el8.noarch 34/41 Installing : efi-srpm-macros-3-2.el8.noarch 35/41 Installing : dwz-0.12-9.el8.x86_64 36/41 Installing : redhat-rpm-config-120-1.el8.noarch 37/41 Installing : python3-virtualenv-15.1.0-19.module_el8.1.0+245+c3 38/41 Running scriptlet: python3-virtualenv-15.1.0-19.module_el8.1.0+245+c3 38/41 Installing : openssl-devel-1:1.1.1c-2.el8.x86_64 39/41 Installing : libffi-devel-3.1-21.el8.x86_64 40/41 Running scriptlet: libffi-devel-3.1-21.el8.x86_64 40/41 Installing : augeas-libs-1.12.0-2.el8.x86_64 41/41 Running scriptlet: augeas-libs-1.12.0-2.el8.x86_64 41/41 Verifying : annobin-8.78-1.el8.x86_64 1/41 Verifying : cpp-8.3.1-4.5.el8.x86_64 2/41 Verifying : dwz-0.12-9.el8.x86_64 3/41 Verifying : efi-srpm-macros-3-2.el8.noarch 4/41 Verifying : gcc-8.3.1-4.5.el8.x86_64 5/41 Verifying : ghc-srpm-macros-1.4.2-7.el8.noarch 6/41 Verifying : go-srpm-macros-2-16.el8.noarch 7/41 Verifying : isl-0.16.1-6.el8.x86_64 8/41 Verifying : libmpc-1.0.2-9.el8.x86_64 9/41 Verifying : ocaml-srpm-macros-5-4.el8.noarch 10/41 Verifying : openblas-srpm-macros-2-2.el8.noarch 11/41 Verifying : perl-srpm-macros-1-25.el8.noarch 12/41 Verifying : platform-python-devel-3.6.8-15.1.el8.x86_64 13/41 Verifying : python-rpm-macros-3-37.el8.noarch 14/41 Verifying : python-srpm-macros-3-37.el8.noarch 15/41 Verifying : python3-rpm-generators-5-4.el8.noarch 16/41 Verifying : python3-rpm-macros-3-37.el8.noarch 17/41 Verifying : python3-virtualenv-15.1.0-19.module_el8.1.0+245+c3 18/41 Verifying : python3-wheel-wheel-1:0.31.1-2.module_el8.1.0+245+ 19/41 Verifying : python36-devel-3.6.8-2.module_el8.1.0+245+c39af44f 20/41 Verifying : qt5-srpm-macros-5.11.1-2.el8.noarch 21/41 Verifying : redhat-rpm-config-120-1.el8.noarch 22/41 Verifying : rust-srpm-macros-5-2.el8.noarch 23/41 Verifying : augeas-libs-1.12.0-2.el8.x86_64 24/41 Verifying : glibc-devel-2.28-72.el8.x86_64 25/41 Verifying : glibc-headers-2.28-72.el8.x86_64 26/41 Verifying : kernel-headers-4.18.0-147.3.1.el8_1.x86_64 27/41 Verifying : keyutils-libs-devel-1.5.10-6.el8.x86_64 28/41 Verifying : krb5-devel-1.17-9.el8.x86_64 29/41 Verifying : libcom_err-devel-1.44.6-3.el8.x86_64 30/41 Verifying : libffi-devel-3.1-21.el8.x86_64 31/41 Verifying : libkadm5-1.17-9.el8.x86_64 32/41 Verifying : libselinux-devel-2.9-2.1.el8.x86_64 33/41 Verifying : libsepol-devel-2.9-1.el8.x86_64 34/41 Verifying : libverto-devel-0.3.0-5.el8.x86_64 35/41 Verifying : libxcrypt-devel-4.1.1-4.el8.x86_64 36/41 Verifying : openssl-devel-1:1.1.1c-2.el8.x86_64 37/41 Verifying : pcre2-devel-10.32-1.el8.x86_64 38/41 Verifying : pcre2-utf16-10.32-1.el8.x86_64 39/41 Verifying : pcre2-utf32-10.32-1.el8.x86_64 40/41 Verifying : zlib-devel-1.2.11-10.el8.x86_64 41/41 Installed: gcc-8.3.1-4.5.el8.x86_64 python3-virtualenv-15.1.0-19.module_el8.1.0+245+c39af44f.noarch python36-devel-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 redhat-rpm-config-120-1.el8.noarch augeas-libs-1.12.0-2.el8.x86_64 libffi-devel-3.1-21.el8.x86_64 openssl-devel-1:1.1.1c-2.el8.x86_64 annobin-8.78-1.el8.x86_64 cpp-8.3.1-4.5.el8.x86_64 dwz-0.12-9.el8.x86_64 efi-srpm-macros-3-2.el8.noarch ghc-srpm-macros-1.4.2-7.el8.noarch go-srpm-macros-2-16.el8.noarch isl-0.16.1-6.el8.x86_64 libmpc-1.0.2-9.el8.x86_64 ocaml-srpm-macros-5-4.el8.noarch openblas-srpm-macros-2-2.el8.noarch perl-srpm-macros-1-25.el8.noarch platform-python-devel-3.6.8-15.1.el8.x86_64 python-rpm-macros-3-37.el8.noarch python-srpm-macros-3-37.el8.noarch python3-rpm-generators-5-4.el8.noarch python3-rpm-macros-3-37.el8.noarch python3-wheel-wheel-1:0.31.1-2.module_el8.1.0+245+c39af44f.noarch qt5-srpm-macros-5.11.1-2.el8.noarch rust-srpm-macros-5-2.el8.noarch glibc-devel-2.28-72.el8.x86_64 glibc-headers-2.28-72.el8.x86_64 kernel-headers-4.18.0-147.3.1.el8_1.x86_64 keyutils-libs-devel-1.5.10-6.el8.x86_64 krb5-devel-1.17-9.el8.x86_64 libcom_err-devel-1.44.6-3.el8.x86_64 libkadm5-1.17-9.el8.x86_64 libselinux-devel-2.9-2.1.el8.x86_64 libsepol-devel-2.9-1.el8.x86_64 libverto-devel-0.3.0-5.el8.x86_64 libxcrypt-devel-4.1.1-4.el8.x86_64 pcre2-devel-10.32-1.el8.x86_64 pcre2-utf16-10.32-1.el8.x86_64 pcre2-utf32-10.32-1.el8.x86_64 zlib-devel-1.2.11-10.el8.x86_64 Complete! Creating virtual environment... Installing Python packages... Installation succeeded. Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for example.com Using the webroot path /var/www/html for all unmatched domains. Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/example.com/privkey.pem Your cert will expire on 2020-05-04. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le |
今回は途中で合意などがあります。
上記のように「Congratulations!」と出て入れば導入は完了です。
この段階で以下のように認証のメールが来ていました。
証明書関連のファイルを以下で確認してみます。
1 2 3 4 5 6 7 8 |
# ls -l /etc/letsencrypt/live/example.com/ -rw-r--r-- 1 root root 682 Jul 30 14:36 README lrwxrwxrwx 1 root root 51 Jul 30 14:36 cert.pem -> ../../archive/example.com/cert1.pem lrwxrwxrwx 1 root root 52 Jul 30 14:36 chain.pem -> ../../archive/example.com/chain1.pem lrwxrwxrwx 1 root root 56 Jul 30 14:36 fullchain.pem -> ../../archive/example.com/fullchain1.pem lrwxrwxrwx 1 root root 54 Jul 30 14:36 privkey.pem -> ../../archive/example.com/privkey1.pem |
「サーバ証明書(公開鍵)」、「中間証明書」、「サーバ証明書と中間証明書が結合されたファイル」、「秘密鍵」の4つのファイルができます。
ApacheにSSLの設定は以下で実施できます。
尚、「サーバ証明書と中間証明書が結合されたファイル(fullchain.pem)」を設定すれば個別に中間証明書は必要ありません。
1 2 3 4 5 6 7 |
# vi /etc/httpd/conf.d/ssl.conf -----------------------------変更 SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem ----------------------------- |
apacheを再起動します。
1 2 3 |
# systemctl restart httpd |
これで無事SSLのインストールが実施できました。
自動更新の設定
「Let's Encrypt」では証明書は90日で切れてしまいます。
そこで、cron などで定期的なクライアントのインストールを実行します。
1 2 3 4 5 6 |
# crontab -e -----------------------------追加 30 2 * * * /usr/local/bin/certbot-auto renew -q --deploy-hook "systemctl restart httpd" ----------------------------- |
上記のコマンドで証明書の有効期限が30日以内になると、再インストールを行います。
「--force-renewal」のオプションをつけていないので上記日数にならないとインストールは行いません。
毎日実行していますが、こちらは「Let's Encrypt」に負荷をかけません。
このブログは株式会社CoLabMixによる技術ブログです。
GCP、AWSなどでのインフラ構築・運用や、クローリング・分析・検索などを主体とした開発を行なっています。
Ruby on RailsやDjango、Pythonなどの開発依頼などお気軽にお声がけください。
開発パートナーを増やしたいという企業と積極的に繋がっていきたいです。