ยง2023-08-01

$ sudo apt install certbot
$ audo pacman -S certbot

sudo certbot renew --dry-run <-- to renew


[alexlai@hc4MnMin ~]$ sudo certbot certonly --manual --preferred-challenges dns -d hc4Mnmin.yushei.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for hc4mnmin.yushei.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name:

_acme-challenge.hc4mnmin.yushei.net.

with the following value:

XrVgvMOgOXK3B4LIuMIdKAT1lTS1URLTLJl2PqgIY5M

Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.hc4mnmin.yushei.net.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/hc4mnmin.yushei.net/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/hc4mnmin.yushei.net/privkey.pem
This certificate expires on 2023-10-30.
These files will be updated when the certificate renews.

NEXT STEPS:
- This certificate will not be renewed automatically. Autorenewal of --manual certificates requires the use of an authentication hook script (--manual-auth-hook) but one was not provided. To renew this certificate, repeat this same certbot command before the certificate's expiry date.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$ drill AAAA h2Jammy.yushei.net
h2Jammy.yushei.net.     7200    IN      AAAA    fe80::4236:7c19:1957:b071

$ sudo certbot certonly --standalone
[sudo] password for alexlai: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): h2Jammy.yushei.net
Certificate not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/h2jammy.yushei.net.conf)

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Keep the existing certificate for now
2: Renew & replace the certificate (may be subject to CA rate limits)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate for h2jammy.yushei.net

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/h2jammy.yushei.net/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/h2jammy.yushei.net/privkey.pem
This certificate expires on 2023-10-30.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

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


---
- on orgPi5Arch.yushei.net

```bash
$ sudo certbot certonly --standalone
[sudo] password for alexlai: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): orgPi5Arch.yushei.net
Requesting a certificate for orgpi5arch.yushei.net

Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
  Domain: orgpi5arch.yushei.net
  Type:   dns
  Detail: no valid A records found for orgpi5arch.yushei.net; no valid AAAA records found for orgpi5arch.yushei.net

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

The AAAA record allows DNS servers to associate a domain name with its corresponding IPv6 address, enabling devices and services that support IPv6 to find and connect to the correct destination on the internet.

DNS A records facilitate the translation of domain names to IPv4 addresses,

Host TTL IPV6
orgpi6arch 7200 fe80::2e6a:2071:2941:7b5c
orgpijammy 7200 fe80::b575:b90:3d7c:78c1
hc4jammy 7200 fe80::21e:6ff:fe49:1540
orgpi5jammy 7200 fe80::b575:b90:3d7c:78c1
n2mnjaro 7200 fe80::edf9:269d:a5f6:5e8b
hc4mnmin 7200 fe80::f480:68f:96b:e034

In Certbot, fullchain.pem and privkey.pem are two important files used for handling SSL/TLS certificates. These files are typically generated when you request a certificate for your domain using Certbot and Let's Encrypt.

fullchain.pem: This file contains the full certificate chain, which includes your domain's SSL/TLS certificate along with the necessary intermediate certificates. The certificate chain is essential for establishing the authenticity and trustworthiness of your SSL/TLS certificate. When a client (such as a web browser) connects to your server, it needs to verify the certificate's authenticity by validating it against a chain of certificates, starting from a trusted root certificate authority (CA). The fullchain.pem file contains the entire chain from your domain certificate up to the root CA certificate.

privkey.pem: This file contains your domain's private key. The private key is a crucial component of SSL/TLS encryption. It is used to decrypt data encrypted with the public key associated with your SSL/TLS certificate. Only the server possessing the corresponding private key can decrypt the data and access sensitive information exchanged between the server and the client. It's vital to keep the private key secure and not share it with anyone unauthorized.

Both fullchain.pem and privkey.pem are essential for configuring your web server to use SSL/TLS encryption and enabling HTTPS for your website. They are usually placed in the server's SSL/TLS configuration along with other relevant settings to enable secure communication between the server and clients (web browsers).

When you use Certbot to obtain a certificate, it automatically saves these files in a location specified in your Certbot configuration. Commonly, you can find these files in the following locations:

fullchain.pem: /etc/letsencrypt/live/your_domain/fullchain.pem privkey.pem: /etc/letsencrypt/live/your_domain/privkey.pem In the file paths above, replace your_domain with the actual domain for which you obtained the SSL/TLS certificate. These file paths are used as examples and may vary depending on your system and Certbot configuration.

It's crucial to keep these files secure and protected, as they grant access to encrypted communication on your server. Make sure to configure your web server to use the correct paths to these files to enable SSL/TLS encryption for your website. Additionally, follow best practices for securely managing SSL/TLS certificates on your server to maintain the security and integrity of your website.

User so fullchain.pem is the one sent to client ChatGPT Yes, that's correct! The fullchain.pem file is sent to the client during the SSL/TLS handshake process.

During the SSL/TLS handshake, the client (typically a web browser) requests the server's SSL/TLS certificate to verify its authenticity. The server responds by sending its SSL/TLS certificate, and this certificate is accompanied by a chain of intermediate certificates, which collectively form the certificate chain. The purpose of this chain is to establish a trust relationship from the server's certificate to a trusted root certificate authority (CA).

The fullchain.pem file contains the entire certificate chain, starting from your domain's SSL/TLS certificate and ending with the root CA certificate. It includes your domain's certificate, any intermediate certificates, and the root CA certificate in a concatenated format.

The client's web browser then verifies the authenticity of the SSL/TLS certificate by validating it against the chain of certificates. It checks if the server's SSL/TLS certificate has been signed by a trusted root CA and if the certificate chain is complete and valid. If everything checks out, the browser establishes a secure encrypted connection with the server, and the padlock icon appears in the address bar, indicating a secure connection.

To summarize:

The fullchain.pem file contains the complete certificate chain, from your domain's certificate to the root CA certificate. During the SSL/TLS handshake, the server sends this fullchain.pem file to the client, allowing the client to verify the authenticity of the SSL/TLS certificate and establish a secure connection. The private key (privkey.pem), on the other hand, is never sent to the client. It remains on the server and is used to decrypt data encrypted with the public key associated with the SSL/TLS certificate during the SSL/TLS handshake.


if

$ drill AAAA orgpi5Arch.yushei.net

orgpi5Arch.yushei.net. 7200 IN AAAA fe80::2e6a:2071:2941:7b5c

$ drill A orgpi5Arch.yushei.net

orgpi5Arch.yushei.net. 1434 IN A 192.168.48.241

why,

$ sudo certbot certonly --standa [sudo] password for alexlai: Saving debug log to /var/log/letsencrypt/letsencrypt.log Please enter the domain name(s) you would like on your certificate (comma and/or space separated) (Enter 'c' to cancel): orgPi5Arch.yushei.net Requesting a certificate for orgpi5arch.yushei.net

Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems: Domain: orgpi5arch.yushei.net Type: dns Detail: no valid A records found for orgpi5arch.yushei.net; no valid AAAA records found for orgpi5arch.yushei.net

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

[alexlai@n2Mnjaro ~]$ sudo certbot certonly --manual --preferred-challenges http -d n2MnJaro.yushei.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for n2mnjaro.yushei.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Create a file containing just this data:

lS2NyBAZCICYHOIP_ut7KkgLD4tVrG6gMaJ7bUq7Wg0.uJwMEV6dZ0tRnWSPFWJTug2-Zl1EzPk_UGSXslUFKCU

And make it available on your web server at this URL:

http://n2mnjaro.yushei.net/.well-known/acme-challenge/lS2NyBAZCICYHOIP_ut7KkgLD4tVrG6gMaJ7bUq7Wg0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

Certbot failed to authenticate some domains (authenticator: manual). The Certificate Authority reported these problems:
  Domain: n2mnjaro.yushei.net
  Type:   dns
  Detail: no valid A records found for n2mnjaro.yushei.net; no valid AAAA records found for n2mnjaro.yushei.net

Hint: The Certificate Authority failed to verify the manually created challenge files. Ensure that you created these in the correct location.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
[alexlai@n2Mnjaro ~]$ sudo certbot certonly --manual --preferred-challenges http -d n2Mnjaro.yushei.net
[sudo] password for alexlai: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for n2mnjaro.yushei.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Create a file containing just this data:

RtGa-MfwvswmtoTJziQZW4USx2ITxW1NAZ1QcfJdlb4.uJwMEV6dZ0tRnWSPFWJTug2-Zl1EzPk_UGSXslUFKCU

And make it available on your web server at this URL:

http://n2mnjaro.yushei.net/.well-known/acme-challenge/RtGa-MfwvswmtoTJziQZW4USx2ITxW1NAZ1QcfJdlb4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
$ sudo certbot certonly --manual --preferred-challenges http -d n2Mnjaro.yushei.net
[sudo] password for alexlai: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for n2mnjaro.yushei.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Create a file containing just this data:

RtGa-MfwvswmtoTJziQZW4USx2ITxW1NAZ1QcfJdlb4.uJwMEV6dZ0tRnWSPFWJTug2-Zl1EzPk_UGSXslUFKCU

And make it available on your web server at this URL:

http://n2mnjaro.yushei.net/.well-known/acme-challenge/RtGa-MfwvswmtoTJziQZW4USx2ITxW1NAZ1QcfJdlb4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue^CExiting due to user request.
[alexlai@n2Mnjaro ~]$ sudo certbot certonly --manual --preferred-challenges dns -d n2Mnjaro.yushei.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for n2mnjaro.yushei.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name:

_acme-challenge.n2mnjaro.yushei.net.

with the following value:

xTYiLW9Tv0vL4E0uhwnl_q2CF_l2-P_Ji8G4zgK3qoI

Before continuing, verify the TXT record has been deployed. Depending on the DNS
provider, this may take some time, from a few seconds to multiple minutes. You can
check if it has finished deploying with aid of online tools, such as the Google
Admin Toolbox: https://toolbox.googleapps.com/apps/dig/#TXT/_acme-challenge.n2mnjaro.yushei.net.
Look for one or more bolded line(s) below the line ';ANSWER'. It should show the
value(s) you've just added.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue