Skip to content

Let's Encrypt installieren

Verschoben Let's Encrypt
  • Was ist Let's Encrypt?

    Let’s Encrypt (deutsch „Lasst uns verschlüsseln“) ist eine Zertifizierungsstelle, die Ende 2015 in Betrieb gegangen ist und kostenlose X.509-Zertifikate für Transport Layer Security (TLS) anbietet. Dabei ersetzt ein automatisierter Prozess die bisher gängigen komplexen händischen Vorgänge bei der Erstellung, Validierung, Signierung, Einrichtung und Erneuerung von Zertifikaten für verschlüsselte Websites.

    Quelle: de.wikipedia.org

    Ziel des Ganzen ist es, den Datentransport zwischen dem Client und dem Webserver zu verschlüsseln, so das unterwegs niemand die Daten mitlesen kann.

    Vorbereitung

    Bei meinem Serverumzug ist folgendes aufgefallen.

     Sep 29 14:22:27 amadeus nginx[1078]: nginx: [emerg] BIO_new_file("/etc/nginx/dhparams.pem") failed (SSL: error:02001002:system
    

    Nginx meckert über einen nicht vorhanden Schlüssel. Hmm, etwas googlen und fündig geworden.

    Man muss mittels openssl erstmal einen geheimen privaten Key erzeugen.

    root@amadeus /etc/letsencrypt # openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
    Generating DH parameters, 2048 bit long safe prime, generator 2
    This is going to take a long time
    ...........................................................................+...................................................................
    (gekürzt)
    

    Das erzeugt im angegebenen Verzeichnis einen 2048 Bit langen Schlüssel. Ganz ängstliche wählen 4096 Bit. Mit der Option "-aes256" kann man den Key auch noch mit einem Passwort verschlüsseln.

    Das File in den Ordner /etc/nginx kopieren und fertig. Ich habe da noch ein kleines Problem, das in der Konfiguration das File dhparams.pem heißt, das erzeugte File aber dhparam.pem. Vermutlich ein Tippfehler von mir, schau ich mir nochmal an. Vorerst habe ich die Datei einfach umbenannt.

    Installation

    Nach dem Hinweis meines Sysadmins 🙂 muss ich das hier noch ein wenig verfeinern.

    apt install letsencrypt
    

    Danach

    root@one /opt/letsencrypt # /etc/init.d/nginx stop
    [ ok ] Stopping nginx (via systemctl): nginx.service.
    root@one /opt/letsencrypt # letsencrypt certonly --standalone -d frank-mankel.org -d www.frank-mankel.org
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Plugins selected: Authenticator standalone, Installer None
    Obtaining a new certificate
    Performing the following challenges:
    http-01 challenge for frank-mankel.org
    http-01 challenge for www.frank-mankel.org
    Waiting for verification...
    Cleaning up challenges
    
    IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at:
       /etc/letsencrypt/live/frank-mankel.org/fullchain.pem
       Your key file has been saved at:
       /etc/letsencrypt/live/frank-mankel.org/privkey.pem
       Your cert will expire on 2018-07-13. 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"
     - 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
    

    Das hat schon mal geklappt!!

    Hinweis

    Der Certbot kann je nach System entweder

    certbot-auto
    

    oder

    certbot
    

    heißen. Quelle: https://certbot.eff.org/docs/intro.html#installation

    Hier liegen die Zertifikate

    /etc/letsencrypt/live/frank-mankel.org
    

    Dort liegen jetzt folgende Files:

    root@one /etc/letsencrypt/live/frank-mankel.org # ls -l
    total 4
    lrwxrwxrwx 1 root root  40 Apr 14 15:15 cert.pem -> ../../archive/frank-mankel.org/cert1.pem
    lrwxrwxrwx 1 root root  41 Apr 14 15:15 chain.pem -> ../../archive/frank-mankel.org/chain1.pem
    lrwxrwxrwx 1 root root  45 Apr 14 15:15 fullchain.pem -> ../../archive/frank-mankel.org/fullchain1.pem
    lrwxrwxrwx 1 root root  43 Apr 14 15:15 privkey.pem -> ../../archive/frank-mankel.org/privkey1.pem
    -rw-r--r-- 1 root root 543 Apr 14 15:15 README
    

    Zertifikate in nginx einbauen

    nginx stoppen:

    /etc/init.d/nginx stop
    

    Meine alte nginx Datei OHNE https. Datei default

    server {
    if ($host != 'frank-mankel.org' ) {
    rewrite ^/(.*)$ http://frank-mankel.org/$1 permanent;
    }
    
        listen 80;
    
        server_name frank-mankel.org;
    
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://127.0.0.1:4567;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    NEUE Datei mit https!!

    ### redirects http requests to https
    
    server {
        server_name  www.frank-mankel.org;
        rewrite ^(.*) http://frank-mankel.org$1 permanent;
    }
    
    
    
    server {
        listen 80;
        server_name frank-mankel.org;
        return 302 https://$server_name$request_uri;
    }
    
    ### the https server
    server {
        # listen on ssl, deliver with speedy if possible
        listen 443 ssl spdy;
    
        server_name frank-mankel.org;
    
    
        # change these paths!
        ssl_certificate /etc/letsencrypt/live/frank-mankel.org/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/frank-mankel.org/privkey.pem;
    
        # enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
        # disables all weak ciphers
        ssl_ciphers 'AES128+EECDH:AES128+EDH';
    
        ssl_prefer_server_ciphers on;
    
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://127.0.0.1:4567;  # no trailing slash
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    Der Ganze http Verkehr wird nach https umgeleitet.

    Als allererstes strippen wir www aus dem Namen.

    if ($host != 'frank-mankel.org' ) {
     rewrite ^/(.*)$ http://frank-mankel.org/$1 permanent;
    }
    

    Der Rest entspricht der nginx Doku!

    Jetzt bauen wir das Zertifikat ein. Pfade anpassen.

    # change these paths!
        ssl_certificate /etc/letsencrypt/live/frank-mankel.org/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/frank-mankel.org/privkey.pem;
    

    Danach speichern und nginx wieder starten

    /etc/init.d/nginx start  
    

    Alles Testen und schauen ob alles funktioniert.

    Zertifikat erneuern

    Das Let's Encrypt Zertifikat läuft nur 90 Tage, danach muss es erneuert werden!

    Also legen wir uns einen crontab an

    crontab -e
    

    Wir fügen folgende Zeile hinzu.

     * 3  1 * * certbot -q renew
    

    Das war mein erster Versuch, das gibt aber einen Fehler. So lange nginx läuft, geht das nicht. Aber dafür kann man dem certbot Befehle mitgeben um nginx zu stoppen und zu starten. Das sieht dann so aus.

    * 3  1 * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
    

    Eine erfolgreiche Zertifikatsverlängerung sieht dann so aus.

    certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    
    -------------------------------------------------------------------------------
    Processing /etc/letsencrypt/renewal/frank-mankel.org.conf
    -------------------------------------------------------------------------------
    Attempting to parse the version 0.23.0 renewal configuration file found at /etc/letsencrypt/renewal/frank-mankel.org.conf with version 0.10.2 of Certbot. This might not work.
    Cert is due for renewal, auto-renewing...
    Running pre-hook command: service nginx stop
    Renewing an existing certificate
    Performing the following challenges:
    tls-sni-01 challenge for frank-mankel.org
    tls-sni-01 challenge for www.frank-mankel.org
    Waiting for verification...
    Cleaning up challenges
    Generating key (2048 bits): /etc/letsencrypt/keys/0004_key-certbot.pem
    Creating CSR: /etc/letsencrypt/csr/0004_csr-certbot.pem
    
    -------------------------------------------------------------------------------
    new certificate deployed without reload, fullchain is
    /etc/letsencrypt/live/frank-mankel.org/fullchain.pem
    -------------------------------------------------------------------------------
    
    Congratulations, all renewals succeeded. The following certs have been renewed:
      /etc/letsencrypt/live/frank-mankel.org/fullchain.pem (success)
    Running post-hook command: service nginx start
    

    Erledigt 🙂

    Vielen Dank für eine tolle Anleitung zum Thema! Quelle: https://willy-tech.de/ssl-zertifikat-mit-lets-encrypt-erstellen/

  • Ich will das Ganze um eine Subdomain erweitern

    root@one /opt/letsencrypt # letsencrypt certonly --standalone -d frank-mankel.org -d www.frank-mankel.org -d forum.frank-mankel.org 
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Plugins selected: Authenticator standalone, Installer None
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    You have an existing certificate that contains a portion of the domains you
    requested (ref: /etc/letsencrypt/renewal/frank-mankel.org.conf)
    
    It contains these names: frank-mankel.org, www.frank-mankel.org
    
    You requested these names for the new certificate: frank-mankel.org,
    www.frank-mankel.org, forum.frank-mankel.org.
    
    Do you want to expand and replace this existing certificate with the new
    certificate?
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    (E)xpand/(C)ancel: E
    Renewing an existing certificate
    Performing the following challenges:
    http-01 challenge for forum.frank-mankel.org
    tls-sni-01 challenge for frank-mankel.org
    tls-sni-01 challenge for www.frank-mankel.org
    Waiting for verification...
    Cleaning up challenges
    
    IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at:
       /etc/letsencrypt/live/frank-mankel.org/fullchain.pem
       Your key file has been saved at:
       /etc/letsencrypt/live/frank-mankel.org/privkey.pem
       Your cert will expire on 2018-10-17. 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"
     - 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
    
  • Wenn ihr alles richtig gemacht habt, dann könnt ihr Euer Zertifikat überprüfen lassen. Sollte dann so aussehen.

    0_1538314120455_index.jpeg

  • FrankMF FrankM hat am auf dieses Thema verwiesen
  • Nextcloud - Update 31.0.2

    Nextcloud nextcloud linux
    1
    0 Stimmen
    1 Beiträge
    133 Aufrufe
    Niemand hat geantwortet
  • Nextcloud - Update auf 31.0.0

    Nextcloud nextcloud linux
    2
    1
    0 Stimmen
    2 Beiträge
    532 Aufrufe
    FrankMF
    Und nicht vergessen service php8.2-fpm restart Damit sieht man dann auch alle Files und Kalendereinträge LOL
  • MongoDB Compass

    Linux mongodb flatpak linux
    1
    3
    0 Stimmen
    1 Beiträge
    239 Aufrufe
    Niemand hat geantwortet
  • HSTS - Sicherheitsmechanismus für HTTPS-Verbindungen

    Linux hsts linux https
    1
    0 Stimmen
    1 Beiträge
    92 Aufrufe
    Niemand hat geantwortet
  • Debian Bookworm 12 - Test

    Linux debian bookworm linux
    6
    4
    0 Stimmen
    6 Beiträge
    608 Aufrufe
    FrankMF
    Es scheint sich was zu tuen. Ein paar Probleme, gehören der Vergangenheit an. Bitte beachten, ich nutze fast ausschließlich Wayland! [image: 1699092052949-e0c00b53-8f25-4b52-97a3-6fd49a2c5638-grafik.png] Problem VLC Ich nutze zum TV schauen gerne die Listen der Fritzbox. Damit kann man einfach im VLC TV schauen und umschalten usw. Problem war, das sehr oft, das Umschalten nicht korrekt funktionierte. Das scheint mittlerweile gefixt zu sein. DANKE! [image: 1699092017630-56648116-4bbb-461c-b7fd-4a344cc12749-grafik.png] Problem KDE Desktop Der KDE Desktop konnte sich die Positionen der Icons nicht "merken". Ich sortiere die gerne, so das ich die TV-Listen z.B. immer unten rechts vorfinde. Das ging leider lange nicht. Mittlerweile scheint das nervige Problem gefixt zu sein. Ich habe eben sogar extra dafür neugestartet um zu sehen, das die Positionen erhalten bleiben. DANKE! [image: 1699091862623-63f71f34-c208-4b98-b0e9-54c94f3d19f2-grafik.png] Fazit Somit bleibt aktuell noch ein Problem, das wäre OBS. Dafür muss ich aktuell noch immer auf eine X11 Session umschalten. Bitte fixen! Es sieht auch so aus, das am KDE Plasma Desktop recht aktiv gearbeitet wird. Da kommen sehr oft, sehr viele neue Pakete rein. Nein, ich benutze kein Testing, ich bin aktuell auf dem Stable Zweig. So langsam wird der KDE Plasma Desktop - unter Wayland - rund! Bitte beachten, die Wayland Erfahrung hängt extrem von der GPU ab. Unter NVidia wird das auch heute keinen Spaß machen. Mit eingebauter AMD GPU und Intel GPU solltet ihr sehr wenige Probleme haben. Das dürfte auch der Grund sein, warum immer mehr Distributionen ankündigen, in Zukunft nur noch auf Wayland zus setzen. https://linuxiac.com/fedora-40-to-offer-plasma-6-drops-x11-entirely/
  • Kopia - Mit Snapshots arbeiten

    Kopia linux kopi
    2
    4
    0 Stimmen
    2 Beiträge
    416 Aufrufe
    FrankMF
    Solltet Ihr mal snaps mit dem Status incomplete haben und möchtet diese loswerden :~$ kopia snap ls -i USER@HOST:/home/frank 2020-09-10 16:31:45 CEST k89770cab1061e00ada49efc41075ed34 incomplete:canceled 728.8 MB drwxr-xr-x files:8891 dirs:3033 (incomplete) 2020-09-10 16:40:05 CEST k27f028b63299983167cb0b4a0c85df80 incomplete:canceled 153.8 MB drwxr-xr-x files:1052 dirs:324 (incomplete) So was passiert z.B. wenn die Internetleitung rumzickt. Jarek meint, das wäre nicht schlimm, beim nächsten Snapshot wird das gefixt und die Daten genutzt, die schon verarbeitet wurden.
  • FAN control OMV Auyfan 0.10.12: gitlab-ci-linux-build-184, Kernel 5.6

    Linux linux
    12
    1 Stimmen
    12 Beiträge
    1k Aufrufe
    M
    Hi, since I'm currently change my rockpro64 setup I came across this. With the kernel from ayufan you need to set PWM_CTL to /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 for my self compiled one I need /sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1 But I got it only working with one entry for PWM_CTL e.g. PWM_CTL = "/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1", after that you need to start ats again sudo systemctl stop ats sudo systemctl start ats initially the fan should start immediately for a short period of time. In case it is even a different one on your kernel you can find the right one using this command. sudo find /sys -name pwm1 | grep hwmon So far I'm not sure which kernel parameter or modul changes this. Martin
  • Sidebar im Theme Quark bearbeiten

    Grav grav linux
    1
    0 Stimmen
    1 Beiträge
    624 Aufrufe
    Niemand hat geantwortet