<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Letsencrypt on Natenoms Blog</title><link>https://natenom.de/tags/letsencrypt/</link><description>Recent content in Letsencrypt on Natenoms Blog</description><generator>Hugo -- gohugo.io</generator><language>de</language><copyright/><lastBuildDate>Tue, 14 Nov 2017 10:12:32 +0000</lastBuildDate><atom:link href="https://natenom.de/tags/letsencrypt/index.xml" rel="self" type="application/rss+xml"/><item><title>acme.sh – Shellscript für LetsEncrypt TLS-Zertifikate</title><link>https://natenom.de/2017/11/acme-sh-shellscript-fuer-letsencrypt-tls-zertifikate/</link><pubDate>Tue, 14 Nov 2017 10:12:32 +0000</pubDate><guid>https://natenom.de/2017/11/acme-sh-shellscript-fuer-letsencrypt-tls-zertifikate/</guid><description><![CDATA[<p>TLS-Zertifikate von <a  class='urlextern'  href="https://letsencrypt.org/">LetsEncrypt</a> nutze ich seit der <a  href="/2015/11/https-for-natenoms-websites-thanks-letsencrypt-d/">„Closed Beta“</a> (2015). Von Anfang an hatte ich dafür das damals promotete Python-Script <a  class='urlextern'  href="https://github.com/certbot/certbot">Certbot</a> benutzt.</p>]]></description><content:encoded><![CDATA[<p>TLS-Zertifikate von <a  class='urlextern'  href="https://letsencrypt.org/">LetsEncrypt</a> nutze ich seit der <a  href="/2015/11/https-for-natenoms-websites-thanks-letsencrypt-d/">„Closed Beta“</a> (2015). Von Anfang an hatte ich dafür das damals promotete Python-Script <a  class='urlextern'  href="https://github.com/certbot/certbot">Certbot</a> benutzt.</p>
<p>Das ist aber nicht unbedingt schön, da es viele Abhängigkeiten nachinstalliert und sich eine eigene Python-Umgebung zurecht bastelt.</p>
<p>Daher steht seit längerem auf meiner Todo-Liste, ein möglichst einfaches Shell-Script für die Nutzung der LetsEncrypt-Zertifikate zu verwenden. Heute habe ich das auf einem meiner Server eingerichtet und es soll hier dokumentiert werden.</p>
<p>Verwendet habe ich das Shell-Script <a  class='urlextern'  href="https://github.com/Neilpang/acme.sh">acme.sh</a>.</p>
<p>Dies ist kein Howto, wie man LetsEncrypt nutzt; ich gehe davon aus, dass man Webserver usw. bereits darauf eingerichtet hat. Hier geht es nur darum, wie man acme.sh installiert und verwendet.</p>

<h2 id="installation" data-numberify>Installation<a class="anchor ms-1" href="#installation"></a></h2>
<p>Alle Befehle werden als root ausgeführt.</p>
<pre><code>apt-get install socat git
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install \
--home /root/.acme.sh \
--certhome /etc/acme/certs \
--accountemail &quot;mail@bladomain.tld&quot; \
--nocron
</code></pre>
<p>Auf die angegebene E-Mail-Adresse erhält man vor Ablauf eines Zertifikats entsprechende Erinnerungen.</p>
<p>Jetzt kann man das Verzeichnis <code>acme.sh</code> löschen. Das installierte Script hat selbst einen Update-Mechanismus.</p>
<p>Ausloggen und wieder einloggen, damit das Alias nutzbar wird.</p>

<h2 id="neues-zertifikate-beantragen" data-numberify>Neue(s) Zertifikat(e) beantragen<a class="anchor ms-1" href="#neues-zertifikate-beantragen"></a></h2>
<p>Wieder alles als root ausführen.</p>
<p>Man muss den Webserver beenden, damit der entsprechende Port vom Standalone-Server (socat) genutzt werden kann.</p>
<pre><code>systemctl stop apache2
acme.sh --tls --issue -d mumble.natenom.com -d m.natenom.com
</code></pre>
<p>Die Ausgabe sieht so aus:</p>
<pre><code>[Fri Nov 10 03:56:59 CET 2017] Standalone tls mode.
[...]
[Fri Nov 10 03:57:00 CET 2017] Registering account
[Fri Nov 10 03:57:02 CET 2017] Registered
[Fri Nov 10 03:57:03 CET 2017] Update account tos info success.
[Fri Nov 10 03:57:03 CET 2017] ACCOUNT_THUMBPRINT='xxxxxxxxxxxxxxxxxxxxxxxx'
[Fri Nov 10 03:57:03 CET 2017] Creating domain key
[Fri Nov 10 03:57:04 CET 2017] The domain key is here: /etc/acme/certs/mumble.natenom.com/mumble.natenom.com.key
[Fri Nov 10 03:57:04 CET 2017] Multi domain='DNS:mumble.natenom.com,DNS:m.natenom.com'
[Fri Nov 10 03:57:04 CET 2017] Getting domain auth token for each domain
[Fri Nov 10 03:57:04 CET 2017] Getting webroot for domain='mumble.natenom.com'
[Fri Nov 10 03:57:04 CET 2017] Getting new-authz for domain='mumble.natenom.com'
[Fri Nov 10 03:57:05 CET 2017] The new-authz request is ok.
[...]
[Fri Nov 10 03:57:11 CET 2017] Verifying:mumble.natenom.com
[Fri Nov 10 03:57:11 CET 2017] Starting tls server.
[Fri Nov 10 03:57:11 CET 2017] Multi domain='DNS:xxxxxxxxxxxx.acme.invalid'
[Fri Nov 10 03:57:16 CET 2017] Success
/root/.acme.sh/acme.sh: line 3589: 20206 Terminated $__S_OPENSSL &amp;gt; /dev/null 2&amp;gt;&amp;1
[...]
[Fri Nov 10 03:57:48 CET 2017] Verify finished, start to sign.
[Fri Nov 10 03:57:49 CET 2017] Cert success.
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
[Fri Nov 10 03:57:49 CET 2017] Your cert is in /etc/acme/certs/mumble.natenom.com/mumble.natenom.com.cer
[Fri Nov 10 03:57:49 CET 2017] Your cert key is in /etc/acme/certs/mumble.natenom.com/mumble.natenom.com.key
[Fri Nov 10 03:57:49 CET 2017] The intermediate CA cert is in /etc/acme/certs/mumble.natenom.com/ca.cer
[Fri Nov 10 03:57:50 CET 2017] And the full chain certs is there: /etc/acme/certs/mumble.natenom.com/fullchain.cer
systemctl start apache2
</code></pre>
<p>Die Zertifikat relevanten Dateien sind danach im Verzeichnis <code>/etc/acme/certs</code> zu finden und in den entsprechenden Konfigurationsdateien z. B. des Webservers kann darauf verwiesen werden.</p>

<h2 id="zertifikate-erneuern" data-numberify>Zertifikat(e) erneuern<a class="anchor ms-1" href="#zertifikate-erneuern"></a></h2>
<p>Eine Liste aller Zertifikate erhält man mit:</p>
<pre><code>acme.sh --list
</code></pre>
<p>Und erneuern kann man mit:</p>
<pre><code>systemctl stop apache2
acme.sh --tls --renew-all

# Oder nur bestimmte Certs erneuern
# acme.sh --tls --renew -d mumble.natenom.com -d m.natenom.com

systemctl start apache2
</code></pre>

<h2 id="ohne-root-rechte-fast" data-numberify>Ohne root-Rechte, fast<a class="anchor ms-1" href="#ohne-root-rechte-fast"></a></h2>
<p>Mit etwas mehr Aufwand kann man das ganze auch noch ohne root-Rechte nutzen, zumindest alles bis auf den Standalone-Server. Denn nur root darf auf Ports ≤1023 lauschen.</p>
<p>Damit werde ich mich vielleicht später noch beschäftigen; insgesamt ist acme.sh aber auch mit root-Rechten wesentlich schöner als das alte Python-Script.</p>

<h2 id="cronsystemd-timer" data-numberify>Cron/Systemd timer<a class="anchor ms-1" href="#cronsystemd-timer"></a></h2>
<ul>
<li>Cron, <a  class='urlextern'  href="https://github.com/Neilpang/acme.sh">siehe hier</a> (nach cron suchen).</li>
<li>Systemd timer, <a  class='urlextern'  href="https://github.com/Neilpang/acme.sh/wiki/Using-systemd-units-instead-of-cron">siehe hier</a>.</li>
</ul>

<h2 id="hilfe" data-numberify>Hilfe<a class="anchor ms-1" href="#hilfe"></a></h2>
<p>Für alles weitere siehe:</p>
<pre><code>acme.sh --help
</code></pre>]]></content:encoded></item><item><title>CAA Records im DNS für das Ausstellen von TLS-Zertifikaten seit September verpflichtend</title><link>https://natenom.de/2017/09/caa-records-im-dns-fuer-das-ausstellen-von-tls-zertifikaten-seit-september-verpflichtend/</link><pubDate>Tue, 12 Sep 2017 08:11:51 +0000</pubDate><guid>https://natenom.de/2017/09/caa-records-im-dns-fuer-das-ausstellen-von-tls-zertifikaten-seit-september-verpflichtend/</guid><description>Wer in Zukunft für seine Domains noch TLS-Zertifikate von einer CA verwenden möchte, der muss jetzt die im folgenden Artikel beschriebenen CAA Records im DNS ablegen, damit die CA überhaupt ein Zertifikat für die entsprechende Domain ausstellen darf.
Siehe heise.de/security/meldung/TLS-Zertifikate-CAAs-sollen-Zertifizierungsstellen-an-die-Leine-legen.
Habe das nur zufällig gelesen, daher soll das hier abgelegt sein; sonst hat man beim nächsten Zertifikat-Update von LetsEncrypt kein Zertifikat mehr :)</description><content:encoded><![CDATA[<p>Wer in Zukunft für seine Domains noch TLS-Zertifikate von einer CA verwenden möchte, der muss jetzt die im folgenden Artikel beschriebenen <a  class='urlextern'  href="https://de.wikipedia.org/wiki/DNS_Certification_Authority_Authorization">CAA Records</a> im DNS ablegen, damit die CA überhaupt ein Zertifikat für die entsprechende Domain ausstellen darf.</p>
<p>Siehe <a  class='urlextern'  href="https://www.heise.de/security/meldung/TLS-Zertifikate-CAAs-sollen-Zertifizierungsstellen-an-die-Leine-legen-3822010.html">heise.de/security/meldung/TLS-Zertifikate-CAAs-sollen-Zertifizierungsstellen-an-die-Leine-legen</a>.</p>
<p>Habe das nur zufällig gelesen, daher soll das hier abgelegt sein; sonst hat man beim nächsten Zertifikat-Update von <a  class='urlextern'  href="https://letsencrypt.org/">LetsEncrypt</a> kein Zertifikat mehr :)</p>
]]></content:encoded></item><item><title>HTTPS for Natenoms websites – Thanks @letsencrypt :D</title><link>https://natenom.de/2015/11/https-for-natenoms-websites-thanks-letsencrypt-d/</link><pubDate>Wed, 11 Nov 2015 20:00:58 +0000</pubDate><guid>https://natenom.de/2015/11/https-for-natenoms-websites-thanks-letsencrypt-d/</guid><description>&lt;p>After the invitation email to the closed &lt;a class='urlextern' href="https://letsencrypt.org/">Letsencrypt&lt;/a> beta a few days ago I set everything up to enable the new certificate on on my major websites:&lt;/p></description><content:encoded><![CDATA[<p>After the invitation email to the closed <a  class='urlextern'  href="https://letsencrypt.org/">Letsencrypt</a> beta a few days ago I set everything up to enable the new certificate on on my major websites:</p>
<ul>
<li><a  class='urlextern'  href="https://www.natenom.com">www.natenom.com</a></li>
<li>natenom.de</li>
<li>wiki.natenom.de</li>
<li><del>wiki.natenom.com</del></li>
<li><del>piwik.natenom.com</del></li>
<li>f.natenom.de</li>
<li>and a few old websites mostly to forward to the new ones</li>
</ul>
<p><del>The other domains will follow as soon as whitelisted by Letsencrypt.</del> Got the email today; done :)</p>
<p><del>The default is still HTTP because nobody except me needs to login on any of my websites and everything is public anyway.</del> After reading <a  class='urlextern'  href="https://letsencrypt.org/2015/10/29/phishing-and-malware.html">this</a> I decided to make HTTPS the default and thus enabled <a  class='urlextern'  href="https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security">HTTP Strict Transport Security (HSTS)</a> as described in this <a  class='urlextern'  href="https://raymii.org/s/tutorials/HTTP_Strict_Transport_Security_for_Apache_NGINX_and_Lighttpd.html">tutorial</a> :)<del><br /></del></p>
<p>The results is an A+ rating on <a  class='urlextern'  href="https://www.ssllabs.com/ssltest/analyze.html?d=natenom.com&amp;latest">SSLLabs.com</a> :)</p>

<h2 id="wordpress" data-numberify>WordPress<a class="anchor ms-1" href="#wordpress"></a></h2>
<p>In this WordPress blog I had to change both „WordPress-Address (URL)“ and „Website-Address (URL)“ to https://…</p>
<p>Then I used the WordPress plugin „<a  class='urlextern'  href="https://wordpress.org/plugins/search-regex/">Search Regex</a>“ to replace every http://-URL to images in this blog and to my other websites with https://.</p>

<h2 id="trouble-with-piwik" data-numberify>Trouble with Piwik<a class="anchor ms-1" href="#trouble-with-piwik"></a></h2>
<p>Because of a self hosted Piwik instance I had some trouble and had to do a bit of configuration stuff in order to make https AND http work.</p>
<p>Instead of setting http or https in the Piwik URL one has to set it without a protocol prefix, so instead of  „https://piwik.natenom.com“ or „https://piwik.natenom.com“ set it to „//piwik.natenom.com“.</p>
<p>If the client uses http it will use http for Piwik, too. Same goes for https.</p>
<p>Where to change the Piwik URL:</p>
<ul>
<li>MediaWiki:<br>
$wgPiwikURL in LocalSettings.php</li>
<li>DokuWiki:<br>
Admin section -&gt; Configuration -&gt; „plugin -&gt; piwik -&gt; piwik_url“</li>
<li>WordPress: Don’t know as there were no problems with it :)</li>
</ul>
<p>In Piwik itself, I also added the https:// URLs to the list of valid URLs of every single website but I don’t know if this was needed.</p>

<h2 id="http2" data-numberify>HTTP/2<a class="anchor ms-1" href="#http2"></a></h2>
<p>While working on the setup of my websites I also enabled <a  class='urlextern'  href="https://http2.akamai.com/">HTTP/2</a> (for https only).</p>

<h2 id="ofigure-classwp-block-image" data-numberify>\o/<a class="anchor ms-1" href="#ofigure-classwp-block-image"></a></h2>
<p><a  href="/wp-content/uploads/2015/11/blog.natenom.com_letsencrypt_certificate_information.png"><img loading="lazy" src="/wp-content/uploads/2015/11/blog.natenom.com_letsencrypt_certificate_information.png" alt="blog.natenom.com_letsencrypt_certificate_information" class="wp-image-33608" srcset="/wp-content/uploads/2015/11/blog.natenom.com_letsencrypt_certificate_information.png 439w, /wp-content/uploads/2015/11/blog.natenom.com_letsencrypt_certificate_information-98x150.png 98w, /wp-content/uploads/2015/11/blog.natenom.com_letsencrypt_certificate_information-195x300.png 195w" sizes="(max-width: 439px) 100vw, 439px" /></a></figure></p>]]></content:encoded></item></channel></rss>