Po dłużej przerwie zapraszam na szybki tutorial, jak wygenerować darmowy certyfikat SSL typu wildcard.
Aby wygenerować certyfikat dla domeny musisz posiadać dostęp do rekordów DNS z możliwością dodawania/modyfikowania wpisów.
Cała procedura generowania certyfikatu zamyka się w 4 prostych krokach.
1. Przygotowanie
W pierwszej kolejności przygotowujemy komendę wg wzorca
docker run \ -v `pwd`:/etc/letsencrypt \ -it certbot/certbot certonly \ -d "*.example.com" \ --no-self-upgrade \ --text \ --agree-tos \ --manual \ --preferred-challenges dns \ --email "[email protected]" \ --server https://acme-v02.api.letsencrypt.org/directory
Zmieniamy wartości example.com oraz [email protected].
Dla utrzymania porządku proponuje utworzyć katalog
mkdir letsencrypt; cd letsencrypt
2. Generowanie certyfikatu
Przygotowane wcześniej polecenie odpalamy w oknie terminala.
Całość będzie wyglądać mniej więcej tak:
[email protected] ~/www/lerczak.eu/letsencrypt $ docker run \ -v `pwd`:/etc/letsencrypt \ -it certbot/certbot certonly \ -d "*.lerczak.eu" \ --no-self-upgrade \ --text \ --agree-tos \ --manual \ --preferred-challenges dns \ --email "[email protected]" \ --server https://acme-v02.api.letsencrypt.org/directory Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator manual, Installer None Obtaining a new certificate Performing the following challenges: dns-01 challenge for lerczak.eu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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
3. Weryfikacja domeny
W momencie gdy skrypt wygeneruje dla nas unikalny klucz weryfikacyjny musimy dodać lub zmodyfikować rekord TXT dla naszej domeny.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please deploy a DNS TXT record under the name _acme-challenge.lerczak.eu with the following value: WQ3xUJA76f9fvull0KHoyOOOkzBZOoTTd6nqfT0gqXA Before continuing, verify the record is deployed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Press Enter to Continue
Dodany rekord będzie wyglądał tak.
Po wykonaniu czynności klikamy enter i czekamy na weryfikację. Jeżeli nie dostaniemy komunikatu jak w przykładzie poniżej, musimy ponowić próbę wygenerowania certyfikatu.
Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/lerczak.eu/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/lerczak.eu/privkey.pem Your cert will expire on 2018-12-02. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot 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
4. Złączenie plików
Ostatnim krokiem jest złączenie wygenerowanego certyfikatu do jednego pliku.
sudo cat live/lerczak.eu/privkey.pem live/lerczak.eu/fullchain.pem | sudo tee wildcard.lerczak.eu.pem >/dev/null
W wyniku naszych działań w katalogu letsencrypt utworzy nam się plik wildcard.lerczak.eu.pem
Gratulacje, masz darmowy certyfikat wildcard ważny przez 3 miesiące. Po tym okresie, musisz ponowić czynności i ponownie wygenerować certyfikat.