<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Let&#8217;s Encrypt &#8211; FU-BAR</title>
	<atom:link href="/tag/lets-encrypt/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Fucked Up Beyond All Recognition</description>
	<lastBuildDate>Sat, 10 Feb 2018 00:01:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>/wp-content/uploads/2020/07/cropped-eu-header-20200715-2-32x32.png</url>
	<title>Let&#8217;s Encrypt &#8211; FU-BAR</title>
	<link>/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Using Let&#8217;s Encrypt with getssl and minimal root usage #letsencrypt</title>
		<link>/2018/02/09/using-lets-encrypt-with-getssl/</link>
		
		<dc:creator><![CDATA[Rui Seabra]]></dc:creator>
		<pubDate>Fri, 09 Feb 2018 23:59:52 +0000</pubDate>
				<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Let's Encrypt]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">/?p=2704</guid>

					<description><![CDATA[is an amazing initiative to have X.509 certificates for your website, or even your email servers, but most instructions just tell you to run (some more some less) complicated programs as root in order to run the periodic certificate renewal workflows, and that is sub-optimal as it substantially increases the number of attack vectors your &#8230; <p class="link-more"><a href="/2018/02/09/using-lets-encrypt-with-getssl/" class="more-link">Continue reading<span class="screen-reader-text"> "Using Let&#8217;s Encrypt with getssl and minimal root usage #letsencrypt"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://letsencrypt.org/"><img loading="lazy" class="alignleft wp-image-2705" src="/wp-content/uploads/2018/02/letsencrypt-logo-horizontal.png" alt="Let's Encrypt" width="403" height="111" /></a> is an amazing initiative to have X.509 certificates for your website, or even your email servers, but most instructions just tell you to run (some more some less) complicated programs as root in order to run the periodic certificate renewal workflows, and that is sub-optimal as it substantially increases the number of attack vectors your already exposed system is susceptible to.</p>
<p>This article is just a way to enjoy the benefits of Let&#8217;s Encrypt while minimizing the need for <strong>root</strong> privileges in your system,and thus keeping it reasonably secure, and this example is doing it with <a href="https://github.com/srvrco/getssl">getssl</a> (don&#8217;t be scared it hasn&#8217;t changed much for some time, they&#8217;re working on the <a href="https://github.com/srvrco/getssl/tree/APIv2">new APIv2 support</a>).</p>
<p>It&#8217;s taking in account a typical CentOS/Red Hat 7 server, your mileage might vary with other systems but it should mostly be the same.</p>
<p>You can start setting up your environment by adding a non privileged user, let&#8217;s say&#8230; <strong>acme</strong>&#8230; who will run the renewal workflow:</p>
<pre># useradd acme
</pre>
<p>Then you can proceed to installing getssl and setting up directories for your files:</p>
<pre># curl https://raw.githubusercontent.com/srvrco/getssl/master/getssl &gt; /usr/local/bin/getssl
# chmod 0755 /usr/local/bin/getssl
# mkdir -p /etc/letsencrypt/acme/ssl.{crt,key,pem}
# chown -R acme:acme /etc/letsencrypt/acme
# chmod -R 0755 /etc/letsencrypt
# chmod 0750 /etc/letsencrypt/acme/ssl.{key,pem}
# mkdir -p /var/www/html/letsencrypt/.well-known/acme-challenge
# chown letsencrypt:letsencrypt /var/www/html/letsencrypt/.well-known/acme-challenge
# echo 'letsencrypt yourhostname=NOPASSWD: /usr/bin/systemctl restart httpd' &gt;&gt; /etc/sudoers.d/letsencrypt</pre>
<p><strong>That last line adding a sudo rule is part of the magic</strong> and the single root command that is executed.  You can also make it restart Postfix, Dovecot, or any other service you use a certificate and that needs restarting in order to take the new certificate.</p>
<p>In order to let you read it all from this article, I&#8217;ll borrow the example&#8217;s from getssl&#8217;s github page and then add in my own suggestions.</p>
<p>Now you want to prepare the environment (as the user <strong>acme</strong>) for your domain:</p>
<pre>getssl -c yourdomain.com</pre>
<p>This will create a <strong>~/.getssl/yourdomain.com</strong> directory, the main files you want are called <strong>getssl.cfg</strong>, there&#8217;s a global file on <strong>~/.getssl/getssl.cfg</strong> and then more specific files per domain, <strong>~/.getssl/yourdomain.com/getssl.cfg</strong></p>
<p>In the main file, ~/.getssl/getssl.cfg, you&#8217;ll need to set up the values accordingly to your needs (I won&#8217;t dive into how to get an account), <strong>but  for this setup</strong> you&#8217;ll want to change the following:</p>
<pre>RELOAD_CMD="/usr/bin/sudo systemctl restart httpd"
ACL=('/var/www/html/letsencrypt/.well-known/acme-challenge')
CA_CERT_LOCATION="/etc/letsencrypt/acme/ssl.crt/lets-encrypt-x3-cross-signed.pem
RENEW_ALLOW="30"</pre>
<p>And that <strong>RELOAD_CMD</strong> right there is part of the magic&#8230;</p>
<p>Now edit  <strong>~/.getssl/yourdomain.com/getssl.cfg</strong> and change the following:</p>
<pre>DOMAIN_CERT_LOCATION="/etc/letsencrypt/acme/ssl.crt/yourdomain.com.crt"
DOMAIN_KEY_LOCATION="/etc/letsencrypt/acme/ssl.key/yourdomain.com.key"</pre>
<p>Now all you need is to set up a cron job:</p>
<pre>45 6 * * * /home/letsencrypt/getssl -u -a -q</pre>
<p>And finally you configure Apache httpd to use the files paths for the CERTificate and its KEY:</p>
<pre>(...)
SSLCertificateFile /etc/letsencrypt/acme/ssl.crt/blog.1407.org.crt
SSLCertificateKeyFile /etc/letsencrypt/acme/ssl.key/blog.1407.org.key
SSLCertificateChainFile /etc/letsencrypt/acme/ssl.crt/lets-encrypt-x3-cross-signed.pem
Alias /.well-known/acme-challenge /var/www/html/letsencrypt/.well-known/acme-challenge
(...)</pre>
<p>And you&#8217;re done: the cron job will run every day, and when you reach the 30 days to renew threshold your certificate will be renewed with minimal root usage.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
