Quantcast
Channel: 2Axels-Company
Viewing all articles
Browse latest Browse all 23

Requesting certificates with certbot-auto and configuring the apache webserver

$
0
0

Mit dem Script certbot-auto kann man ganz leicht neue Zertifikate beantragen und auch im Apache Webserver konfigurieren.

Übersicht der aktuell konfigurierten Zertifikate erhält man mit dem Befehl „certbot-auto certificates“.

#
$ sudo /opt/letsencrypt/certbot-auto --no-self-upgrade certificates
[sudo] password for ab: 
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Found the following certs:
  Certificate Name: test.domain.de
    Domains: test.domain.de domain.de
    Expiry Date: 2017-07-19 19:24:00+00:00 (VALID: 87 days)
    Certificate Path: /etc/letsencrypt/live/test.domain.de/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/test.domain.de/privkey.pem
  Certificate Name: vm01.domain1.de
    Domains: vm01.domain1.de
    Expiry Date: 2017-07-18 18:59:00+00:00 (VALID: 86 days)
    Certificate Path: /etc/letsencrypt/live/vm01.domain1.de/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/vm01.domain1.de/privkey.pem
  Certificate Name: www.domain2.de
    Domains: www.domain2.de domain2.de
    Expiry Date: 2017-07-19 19:31:00+00:00 (VALID: 87 days)
    Certificate Path: /etc/letsencrypt/live/www.domain2.de/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/www.domain2.de/privkey.pem
-------------------------------------------------------------------------------

#

Es empfiehlt sich übrigens den Schalter „--no-self-upgrade“ zu benutzen, um zu verhindern, dass sich das Script selbstständig aktualisiert. Besser ist es, die Aktualisierung in einer Testumgebung vorzunehmen um den produktiven Betrieb nicht zu gefährden.

Jetzt führen wir kurz den Befehl zum Beantragen eines Zertifikates aus:

#
$ sudo /opt/letsencrypt/certbot-auto --no-self-upgrade --apache certonly -d adm.domain.de
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for adm.domain.de
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0003_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0003_csr-certbot.pem

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/adm.domain.de/fullchain.pem. Your
   cert will expire on 2017-07-22. To obtain a new or tweaked version
   of this certificate in the future, simply run certbot-auto again.
   To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - 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
#
# Die Zertifikate wurden nun unter: /etc/letsencrypt/live/ abgelegt:
$ ls -l /etc/letsencrypt/live/adm.domain.de
total 4
lrwxrwxrwx 1 root root  47 Apr 23 11:39 cert.pem -> ../../archive/adm.domain.de/cert1.pem
lrwxrwxrwx 1 root root  48 Apr 23 11:39 chain.pem -> ../../archive/adm.domain.de/chain1.pem
lrwxrwxrwx 1 root root  52 Apr 23 11:39 fullchain.pem -> ../../archive/adm.domain.de/fullchain1.pem
lrwxrwxrwx 1 root root  50 Apr 23 11:39 privkey.pem -> ../../archive/adm.domain.de/privkey1.pem
-rw-r--r-- 1 root root 543 Apr 23 11:39 README
#

Jetzt noch das Zertifikat im Apache konfigurieren. In der Apache VHOST-Datei folgende Werte einfügen:

#
        # SSL-Configuration for Apache_Hosts
        SSLEngine on
        SSLCompression off
        SSLProtocol All -SSLv3 -SSLv2 -TLSv1.1
        ## SSLCipherSuite ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:AES128-SHA:RC4-SHA
        #        SSLCipherSuite HIGH:!aNULL:!MD5
        # Strong SSL Cipher Suites against poodle
        #SSLCipherSuite HIGH:!ADH:!SSLv2:!SSLv3
        SSLCipherSuite          ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
        SSLHonorCipherOrder on

        # SSL Certificate Configuration for Letsencrypt CertificateAuthority:
        # SSLCertificateFile    /etc/letsencrypt/live/adm.domain.de/fullchain.pem
        # next two lines for apache 2.2 only!
        SSLCertificateFile    /etc/letsencrypt/live/adm.domain.de/cert.pem
        SSLCertificateChainFile /etc/letsencrypt/live/adm.domain.de/chain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/adm.domain.de/privkey.pem
        #
        #

 


Viewing all articles
Browse latest Browse all 23