0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【acme-tiny】 acme-tinyを利用して、Let's EncryptでSSL証明書を取得する

Last updated at Posted at 2025-03-25

acme-tiny は httpd の再起動とか余計なことをしないので、certbot より使いやすいと思います。

詳しくはオフィシャルサイト、 https://github.com/diafygi/acme-tiny をご参照ください。

以下、Oracle Linux 9 での利用を前提に、認証したいFQDNが www.example.com で、httpサーバに apache 2.4.8 以降を用いる場合で説明します。

あくまで一例なので、実行される際はご自分の環境に合わせて読み替えてください。


まず、必要に応じて、httpd と mod_ssl をインストールします。既に入っていれば、不要です。

yum install httpd mod_ssl

epel をインストールします。これも既に入っていれば不要です。

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

acme-tiny をインストールします。インストールすると /etc/httpd/conf.d/acme.conf と /var/www/challenges/ ができるので、apacheをリロードするなりここから起動するなりします。

yum install acme-tiny
systemctl restart httpd

firewalld とかで外部からの接続を許可します。vpsなどのセキュリティ設定などでも80/443ポートを開放してください。こちらも、既に済んでいれば再設定は不要です。

firewall-cmd --permanent  --zone=public --add-service=https
firewall-cmd --permanent  --zone=public --add-service=http
firewall-cmd --reload

アカウントキー、サーバの秘密鍵、署名リクエストを作成します。

openssl genrsa 4096 > /var/lib/acme/private/account.key
openssl genrsa 4096 > /var/lib/acme/private/SERVER0001.key
openssl req -new -sha256 -key /var/lib/acme/private/SERVER0001.key -subj "/CN=www.example.com" > /var/lib/acme/csr/SERVER001.csr

Let's Encrypt に署名してもらいます。

acme_tiny --account-key /var/lib/acme/private/account.key --csr /var/lib/acme/csr/SERVER001.csr --acme-dir /var/www/challenges/ > /var/lib/acme/certs/SERVER001.crt

/etc/httpd/conf.d/ssl.conf を編集し、取得できた証明書と作成しておいた秘密鍵を指定します。

SSLCertificateFile /var/lib/acme/certs/SERVER001.crt
SSLCertificateKeyFile /var/lib/acme/private/SERVER0001.key

systemctl restart httpd とし、証明書を有効にします。

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?