Configure ton site web en HTTPS avec Certbot

  1. Installer Certbot
    
    [root@ip-172-31-37-139 ~]# yum info certbot
    Last metadata expiration check: 0:09:16 ago on Tue Aug 26 16:53:40 2025.
    Available Packages
    Name         : certbot
    Version      : 2.6.0
    Release      : 4.amzn2023.0.1
    Architecture : noarch
    Size         : 49 k
    Source       : certbot-2.6.0-4.amzn2023.0.1.src.rpm
    Repository   : amazonlinux
    Summary      : A free, automated certificate authority client
    URL          : https://github.com/certbot/certbot
    License      : Apache-2.0
    Description  : certbot is a free, automated certificate authority that aims
                 : to lower the barriers to entry for encrypting all HTTP traffic on the internet.
    
    Name         : certbot
    Version      : 2.6.0
    Release      : 4.amzn2023.0.1
    Architecture : src
    Size         : 1.3 M
    Source       : None
    Repository   : amazonlinux-source
    Summary      : A free, automated certificate authority client
    URL          : https://github.com/certbot/certbot
    License      : Apache-2.0
    Description  : certbot is a free, automated certificate authority that aims
                 : to lower the barriers to entry for encrypting all HTTP traffic on the internet.
    
    
    
    
    
    
    [root@ip-172-31-37-139 ~]# yum install certbot
    Last metadata expiration check: 0:10:39 ago on Tue Aug 26 16:53:40 2025.
    Dependencies resolved.
    ========================================================================================================================================================
     Package                                   Architecture              Version                                       Repository                      Size
    ========================================================================================================================================================
    Installing:
     certbot                                   noarch                    2.6.0-4.amzn2023.0.1                          amazonlinux                     49 k
    Installing dependencies:
     fontawesome-fonts                         noarch                    1:4.7.0-11.amzn2023.0.2                       amazonlinux                    205 k
     fonts-filesystem                          noarch                    1:2.0.5-12.amzn2023.0.2                       amazonlinux                    9.5 k
     python3-acme                              noarch                    2.6.0-4.amzn2023.0.1                          amazonlinux                    161 k
     python3-certbot                           noarch                    2.6.0-4.amzn2023.0.1                          amazonlinux                    677 k
     python3-configargparse                    noarch                    1.7-1.amzn2023                                amazonlinux                     45 k
     python3-josepy                            noarch                    1.13.0-6.amzn2023                             amazonlinux                     61 k
     python3-parsedatetime                     noarch                    2.6-10.amzn2023                               amazonlinux                     80 k
     python3-pyOpenSSL                         noarch                    21.0.0-1.amzn2023.0.2                         amazonlinux                     92 k
     python3-pyrfc3339                         noarch                    1.1-16.amzn2023                               amazonlinux                     19 k
    Installing weak dependencies:
     python-josepy-doc                         noarch                    1.13.0-6.amzn2023                             amazonlinux                     20 k
    
    Transaction Summary
    ========================================================================================================================================================
    Install  11 Packages
    
    Total download size: 1.4 M
    Installed size: 6.2 M
    Is this ok [y/N]: y
    
    
    
  2. Obtenir le certificat SSL
    
    [root@ip-172-31-37-139 html]# certbot certonly --webroot -w /data/web/blog -d eniblog.ddns.net
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Enter email address (used for urgent renewal and security notices)
     (Enter 'c' to cancel): bagnadavid@yahoo.fr
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Please read the Terms of Service at
    https://letsencrypt.org/documents/LE-SA-v1.5-February-24-2025.pdf. You must
    agree in order to register with the ACME server. Do you agree?
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    (Y)es/(N)o: Y
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Would you be willing, once your first certificate is successfully issued, 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
    Account registered.
    Requesting a certificate for eniblog.ddns.net
    
    Successfully received certificate.
    Certificate is saved at: /etc/letsencrypt/live/eniblog.ddns.net/fullchain.pem
    Key is saved at:         /etc/letsencrypt/live/eniblog.ddns.net/privkey.pem
    This certificate expires on 2025-11-24.
    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
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    
    
    
    
    
    
    
    [root@ip-172-31-37-139 html]# ll /etc/letsencrypt/live/
    total 4
    -rw-r--r--. 1 root root 740 Aug 26 17:40 README
    drwxr-xr-x. 2 root root  93 Aug 26 17:40 eniblog.ddns.net
    [root@ip-172-31-37-139 html]# ll /etc/letsencrypt/live/eniblog.ddns.net/
    total 4
    -rw-r--r--. 1 root root 692 Aug 26 17:40 README
    lrwxrwxrwx. 1 root root  40 Aug 26 17:40 cert.pem -> ../../archive/eniblog.ddns.net/cert1.pem
    lrwxrwxrwx. 1 root root  41 Aug 26 17:40 chain.pem -> ../../archive/eniblog.ddns.net/chain1.pem
    lrwxrwxrwx. 1 root root  45 Aug 26 17:40 fullchain.pem -> ../../archive/eniblog.ddns.net/fullchain1.pem
    lrwxrwxrwx. 1 root root  43 Aug 26 17:40 privkey.pem -> ../../archive/eniblog.ddns.net/privkey1.pem
    
    
    
    
    
  3. Installer le module ssl pour Apache
    
    [root@ip-172-31-37-139 conf.d]# yum info mod_ssl
    Last metadata expiration check: 1:04:08 ago on Tue Aug 26 16:53:40 2025.
    Available Packages
    Name         : mod_ssl
    Epoch        : 1
    Version      : 2.4.62
    Release      : 1.amzn2023
    Architecture : x86_64
    Size         : 112 k
    Source       : httpd-2.4.62-1.amzn2023.src.rpm
    Repository   : amazonlinux
    Summary      : SSL/TLS module for the Apache HTTP Server
    URL          : https://httpd.apache.org/
    License      : Apache-2.0 AND (BSD-3-Clause AND metamail AND HPND-sell-variant AND Spencer-94)
    Description  : The mod_ssl module provides strong cryptography for the Apache HTTP
                 : server via the Secure Sockets Layer (SSL) and Transport Layer
                 : Security (TLS) protocols.
    
    
    
    [root@ip-172-31-37-139 conf.d]# yum install mod_ssl
    Last metadata expiration check: 1:04:18 ago on Tue Aug 26 16:53:40 2025.
    Dependencies resolved.
    ========================================================================================================================================================
     Package                         Architecture                   Version                                       Repository                           Size
    ========================================================================================================================================================
    Installing:
     mod_ssl                         x86_64                         1:2.4.62-1.amzn2023                           amazonlinux                         112 k
    Installing dependencies:
     sscg                            x86_64                         3.0.3-76.amzn2023                             amazonlinux                          45 k
    
    Transaction Summary
    ========================================================================================================================================================
    Install  2 Packages
    
    Total download size: 157 k
    Installed size: 380 k
    Is this ok [y/N]: y
    
    
  4. Faire la configuration SSL du vhost
    
      SSLEngine on
      SSLCertificateFile /etc/letsencrypt/live/eniblog.ddns.net/fullchain.pem
      SSLCertificateKeyFile /etc/letsencrypt/live/eniblog.ddns.net/privkey.pem
    
    
  5. Redemarrer le service httpd

    [root@ip-172-31-37-139 conf.d]# systemctl restart httpd

  6. Faire le test
    
    # openssl s_client -connect eniblog.ddns.net:443 | openssl x509 -noout -dates
    depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
    verify return:1
    depth=1 C = US, O = Let's Encrypt, CN = E8
    verify return:1
    depth=0 CN = eniblog.ddns.net
    verify return:1
    notBefore=Aug 26 16:42:23 2025 GMT
    notAfter=Nov 24 16:42:22 2025 GMT
    

Eninam BAGNABANA     |     Learning Notes     |     bagnadavid@yahoo.fr     |