LoginSignup
0
1

More than 5 years have passed since last update.

Let's Encryptよりワイルドカードなサーバ証明書を取得する

Last updated at Posted at 2018-11-01

1. GithubよりLet's EncryptリポジトリをCloneする

# git clone https://github.com/letsencrypt/letsencrypt.git

2. 以下のコマンドを実行する

# cd letsencrypt
# ./letsencrypt-auto certonly --manual -d *.<ドメイン名> --preferred-challenges dns
  • <ドメイン名>は、*以下のドメインを入力する。

3. 画面の指示に従い、操作を行う

メールアドレスの登録

メールアドレスを入力して、[Enter]を押下します。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): <メールアドレス>

規約、メールアドレスの収集、IPアドレスの収集に関する同意

a を入力し、[Enter]を押下して進めます。

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

規約、メールアドレスの収集、IPアドレスの収集に関する同意

全てy を入力し、[Enter]を押下して進めます。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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:
dns-01 challenge for <ドメイン名>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

4. DNS TXTレコードの登録

以下のようなメッセージが表示され、DNS TXTレコードのエントリとして指定された値の入力(登録)を求められますので、DNSサーバに対して登録を行います。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.<ドメイン名> with the following value:

<TXTレコードへ入力する値>

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

DNSサーバへの登録後、しばらく(5分程度)時間をおいてから[Enter]を押下します。

5. 登録完了

次のようなメッセージが表示され、サーバ証明書が発行されます。

Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/<ドメイン名>/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/<ドメイン名>/privkey.pem
   Your cert will expire on <有効期限>. To obtain a new or tweaked
   version of this certificate in the future, simply run
   letsencrypt-auto again. To non-interactively renew *all* of your
   certificates, run "letsencrypt-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

上記に表示されたディレクトリを確認すると、証明書ファイルを確認することが出来ます。

# cd /etc/letsencrypt/live/<ドメイン名>/
# ls -la
total 12
drwxr-xr-x 2 root root 4096 Nov  1 08:39 .
drwx------ 3 root root 4096 Nov  1 08:39 ..
-rw-r--r-- 1 root root  682 Nov  1 08:39 README
lrwxrwxrwx 1 root root   52 Nov  1 08:39 cert.pem -> ../../archive/<ドメイン名>/cert1.pem
lrwxrwxrwx 1 root root   53 Nov  1 08:39 chain.pem -> ../../archive/<ドメイン名>/chain1.pem
lrwxrwxrwx 1 root root   57 Nov  1 08:39 fullchain.pem -> ../../archive/<ドメイン名>/fullchain1.pem
lrwxrwxrwx 1 root root   55 Nov  1 08:39 privkey.pem -> ../../archive/<ドメイン名>/privkey1.pem
0
1
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
1