らをた広島

食べ歩きブログ

Debian 10「Buster」インストール その4

f:id:unkosuzou:20200511161834j:plain

SSL

まずはルーターHTTPS  443/TCP ポートを開放する。

因みにhttpは80/TCPFTPは20と21/TCPSSHは22/TCPを開放しておく。

SSLなう!にアクセスしてLet's Encrypt へ登録しSSL証明書発行する。

ちょっとわかりにくいがここまでサーバーを起動させる知識があればなんとなくわかると思う。

要はメルアド(フリーで良い)とダイナミックDNSドメインを登録

チャレンジトークンの取得

「http-01」までドメイン名所有確認(FTPソフトで「URL欄」のファイル名のファイルを作り「ファイル内容欄」をコピペする。)

証明書発行申請

発行された証明書

 

Let's Encryptの管理コマンドのインストール
# apt install python-certbot-apache
# certbot --apache

 

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 登録メルアド
Starting new HTTPS connection (1): 登録ドメイン

-------------------------------------------------------------------------------
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://登録ドメイン/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel:

同意するか聞かれるので"A"を入力し、returnキーを押す。

 

-------------------------------------------------------------------------------
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:

Let's Encryptパートナーにメールアドレスを公開していいか聞かれるので"N"を入力し、returnキーを押す。

 
Running pre-hook command: apachectl stop
Obtaining a new certificate
Resetting dropped connection: 登録ドメイン
Performing the following challenges:
http-01 challenge for www.tommys-web.com
Waiting for verification...
Cleaning up challenges
Running post-hook command: apachectl start
Created an SSL vhost at /etc/httpd/conf/httpd-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf/httpd-le-ssl.conf
Enabling site /etc/httpd/conf/httpd-le-ssl.conf by adding Include to root configuration

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

httpsにリダイレクトするか聞かれるので"2"を入力し、returnキーを押す。

 

これで

https://登録ドメイン/

でアクセスしてページが表示されたら完成。

 

Let's Encryptの証明書を更新する(90日ごと)
アパッチの停止
# /sbin/apachectl stop
証明書の強制手動更新
# certbot renew --force-renew
ツラツラと更新成功しましたと表示される。
アパッチ再起動
# /sbin/apachectl restart

 

毎度のことながらこの記事は自分が忘備録として書いているだけなので正確性も保証しかねるし問題が起きても質問にも答えられないし責任も取れない。
debianはフリーのLinuxOSなのでそのへんは全て自己責任ということになるのを覚悟で実行してもらいたい。