OracleCloud AlwaysFreeでUbuntu22.04LTSでNextCloud - AIによる記事自動生成ブログ四三式
で導入したNextCloudについて。
Let'sEncryptから更新期限予告メールが届く。
Let's Encrypt certificate expiration notice for domain "xxx.xxx.xxx"
あーそういえば、Let'sEncryptの証明書は設定したけど、自動更新とかは何もやってなかったなあ。
で、調べてみたら、普通にインストールすると自動更新の設定までされるらしい。すげえな。そして更新されていないということはエラーで終わっているということ。
もともと参考にしていたサイトにて、ポート80を開放していないから、という追加情報もあったのだが、どうにも出ているエラー内容が違うし、ポート80を開放してnextcloud.renew-certsサービスを再起動してもなんにも変わらない。
Snap版Nextcloudの保守とSSL証明書更新 - Fun Scripting 2.0
とりあえずログ
/var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
の中身はこんな感じ。
2023-04-29 22:45:49,673:ERROR:certbot.renewal:All renewal attempts failed. The following certs could not be renewed: 2023-04-29 22:45:49,673:ERROR:certbot.renewal: /var/snap/nextcloud/current/certs/certbot/config/live/xxx.xxx.xxx/fullchain.pem (failure) 2023-04-29 22:45:49,675:INFO:certbot.hooks:Running post-hook command: restart-apache 2023-04-29 22:45:50,790:INFO:certbot.hooks:Output from post-hook command restart-apache: Restarting apache... done 2023-04-29 22:45:50,791:DEBUG:certbot.log:Exiting abnormally: Traceback (most recent call last): File "/snap/nextcloud/34567/bin/certbot", line 8, insys.exit(main()) File "/snap/nextcloud/34567/lib/python2.7/site-packages/certbot/main.py", line 1364, in main return config.func(config, plugins) File "/snap/nextcloud/34567/lib/python2.7/site-packages/certbot/main.py", line 1271, in renew renewal.handle_renewal_request(config) File "/snap/nextcloud/34567/lib/python2.7/site-packages/certbot/renewal.py", line 475, in handle_renewal_request len(renew_failures), len(parse_failures))) Error: 1 renew failure(s), 0 parse failure(s)
うーん、よくわからん。で、色々と検索していたら以下のサイトにたどり着く。
Google翻訳。Snap版NextCloudを使った時に、ドメイン変更してから証明書を取得すると変な動きをすることがある、という話。そういえば、最初に自己署名証明書を入れて、その後にドメイン取得みたいなことをやってたな。今回。
指示に従ってみる…、とLet's Encryptでディレクトリパスがどうのこうの、といったエラーが。あ、やっちまったか???
恐る恐るインスタンスを再起動して、もう一回チャレンジ。
Have you met these requirements? (y/n) y Please enter an email address (for urgent notices or key recovery): xxx@xxx.xxx Please enter your domain name(s) (space-separated): xxx.xxx.xxx Attempting to obtain certificates... done find: Failed to restore initial working directory: /home/ubuntu: Permission denied Restarting apache... done
なんだかよくわからんパーミッションエラーが出たが。。。確認したところ、証明書は更新されてとりあえず使えるようにはなった。
なんかどっかで悪さしそうだなあ。まあいいか。とりあえず様子見。