OpenVPN Access Server もうまくインストールしましたが、オレオレな証明書を使っているのでアクセス時にいろいろワーニングが出ます。いわゆる野良サーバ的なサイトになっています。そこで、ここ数年いいのかわるいのか一気に有名になった Let's Encrypt の無償の証明書をインストールしてみることにしました。
とったばかりなのでまだ何とも言えませんが、60 日おきに自動で更新するのが望ましいみたいです。

certbot のインストール
github にソースごとおいてあるようですが、apt install でインストールするのが簡単です。
man や --help で一通り使い方を確認します。--dry-run オプションがあります。一回目は dry-run (実行するふりだけ)でやってみることにします。
いきなり sudo で certbot と打たないこと!!理解してから先に進めましょう。standalone は Let's Encrypt が認証するためにアクセスする一次的なサーバを立てる処理をします。したがって、あらかじめ 80 のポートは開放しておかなければなりません。(443 はいらないみたい。未確認)
pre-hook や post-hook は前処理、後処理です。更新などの処理を自動化することがLet's Encrypt の標準的な方式だと思うのでこのように書いておきます。私は sudo 以外の部分を do.sh としてセーブしました。
dry-run な実行
さーて実行してみます。dry-run なので証明書を発行したふりをします。しかし、エラー。よくみると Connection 出来てません。OpenVPN Access Server の Azure の設定で 80 を通してないのが理由でした。ということで 80 番を通すようにしてみます。


うまくいきました。agree-tos のオプションは気持ち悪いので使ってません。
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Running pre-hook command: sudo service openvpnas stop Obtaining a new certificate Performing the following challenges: http-01 challenge for XXXXXXXXXXXXXXXXXXXX Waiting for verification... Cleaning up challenges Running post-hook command: sudo service openvpnas start IMPORTANT NOTES: - The dry run was successful.
本番
本番も何も --dry-run をはずすだけです。途中2回質問をされます。1回目はLE-SA-v1.2-November-15-2017.pdfを読んで同意するかしないか?の YES/NO。2回目はもろもろの E-Mail を送りつけてよいかどうか?セキュリティ情報もあるかもしれないのでとりあえずメールをもらうことにします。
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, 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 Running pre-hook command: sudo service openvpnas stop Obtaining a new certificate Performing the following challenges: http-01 challenge for XXXXXXXXXXXXXXXXXXXX Waiting for verification... Cleaning up challenges Running post-hook command: sudo service openvpnas start IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/XXXXXXXXXXXXXXXXXXXX/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/XXXXXXXXXXXXXXXXXXXX/privkey.pem Your cert will expire on 2020-XX-XX. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot 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
OpenVPN Access Service に教えてあげる
これだけだと /etc/letsencrypt/live/<ドメイン名称> の下にファイルを作るだけです。必要なファイルを /usr/local/openvpnas の下にリンクを張ってあげます。恐らくシンボリックリンクにすることで自動更新がうまくいくのでしょう。
設定後見事に SSL のエラーは出なくなりました。