<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michele Arciprete on Medium]]></title>
        <description><![CDATA[Stories by Michele Arciprete on Medium]]></description>
        <link>https://medium.com/@m.arciprete?source=rss-883537683cda------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tf4cfn0G5AREYyYg</url>
            <title>Stories by Michele Arciprete on Medium</title>
            <link>https://medium.com/@m.arciprete?source=rss-883537683cda------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:16:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m.arciprete/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Maven dependency management]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">Managing a project with many dependencies is an easy task with maven, but sometimes module&#x2019;s sub-dependencies can lead to unexpected&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@m.arciprete/maven-dependency-management-6733d3a7d379?source=rss-883537683cda------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@m.arciprete/maven-dependency-management-6733d3a7d379?source=rss-883537683cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/6733d3a7d379</guid>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[dependency-management]]></category>
            <dc:creator><![CDATA[Michele Arciprete]]></dc:creator>
            <pubDate>Sun, 07 Nov 2021 10:09:51 GMT</pubDate>
            <atom:updated>2021-11-08T19:00:38.205Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Setting up a secure reverse proxy with Nginx, certbot and Docker on ARM devices.]]></title>
            <link>https://medium.com/@m.arciprete/setting-up-a-secure-reverse-proxy-with-nginx-certbot-and-docker-on-arm-devices-6a7bd50c92b2?source=rss-883537683cda------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a7bd50c92b2</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[certbot]]></category>
            <category><![CDATA[arm]]></category>
            <category><![CDATA[nginx]]></category>
            <dc:creator><![CDATA[Michele Arciprete]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 08:35:41 GMT</pubDate>
            <atom:updated>2021-07-23T01:39:03.670Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple yet complete guide on how to setup your ARM device to work as a full secure reverse proxy.</h4><p>Recently, on my Raspberry Pi device, I installed the container version of <a href="https://www.home-assistant.io/">Home Assistant</a>, a popular tool for home automation, and I wanted to be able to access it from the internet. For those who are familiar with it, the “Supervised” version is very simple to configure, since it offers a lot of addons to seamlessly setup nginx, a dynamic dns and even a wireguard vpn server. But with other versions of it you need to do almost everything by hand, so I decided to split responsibilities and configure everything by myself, on separate devices.</p><p>So, let’s see how to configure our device with two docker containers, one for nginx and one for certbot to have our https server up and running.</p><h3>Requirements</h3><ul><li>This guide assumes that you already have Docker installed and fully functional on your device.</li><li>You should already have subscribed to a dynamic dns service and — last but not least — your router should correctly have been configured to port forward the ports 80 and 443.</li><li>Being familiar with Nginx is a plus :)</li></ul><h4>Folders configuration</h4><p>First, we need to create some folders on the docker host, to store some configuration and the certbot certificates. Furthermore, since we want to use 2 docker containers, we also need to share those certificates between the containers.</p><blockquote>Please note: I’m assuming that your arm device is linux-based, so you can actually copy-paste the commands below, they will work and create the folders with your username</blockquote><pre>$ mkdir -p /etc/letsencrypt<br>$ mkdir -p /nfs/$USER/nginx/www/letsencrypt/.well-known/acme-challenge</pre><p>The first folder is where we will store the certificates, the second one has a double function: it creates an nginx folder under /nfs/$USER to store the configuration, and creates — at the same time — the acme-challenge folder that will be used by certbot.</p><h4>Install Nginx</h4><p>Now we need to start nginx and serve an <strong>http</strong> location to complete the <em>acme-challenge.</em></p><p>Create a <em>proxy.conf </em>file with the following content:</p><pre>server {<br> listen 80;<br> server_name mycustomserver.anydyndns.org;</pre><pre>location ^~ /.well-known/acme-challenge/ {<br> allow all;<br> root /var/www/letsencrypt;<br> default_type “text/plain”;<br> }<br>}</pre><p>and place it into the /nfs/$USER/nginx folder.</p><blockquote>Please note: the only part you need to change is the server_name, with your chosen dyndns name.</blockquote><p>Now we are ready to start our container:</p><pre>docker run --name nginx -d -p 7070:80 -p 7443:443 --restart always \<br> -v /nfs/$USER/nginx/proxy.conf:/etc/nginx/conf.d/default.conf \<br> -v /nfs/$USER/nginx/www/:/var/www/ \<br> -v /etc/letsencrypt:/etc/letsencrypt nginx</pre><ul><li>the “proxy.conf” file totally replaces the default.conf (I don’t need to serve any other http location but the one needed for the acme challenge)</li><li>we bound the www folder locally to the one created previously</li><li>we bound the letsencrypt certificate folder to be shared later with certbot</li><li>I remapped the ports 80 and 443 on the 7080 and 7443 respectively, but feel free to change them according to your needs.</li></ul><blockquote><strong>Tip</strong>: if you wish, you can test that nginx is working by adding a <em>test.html</em> file with any content in the acme-challenge folder and open a browser at <a href="http://mycustomserver.anydyndns.org/">http://mycustomserver.anydyndns.org</a>/.well-known/acme-challenge/test.html<br>If everything worked fine, you should see the content of your file.</blockquote><h4>Generate Certificates with Certbot</h4><p>Now we need to generate certificates with letsencrypt. Let’s run certbot:</p><pre>docker run -it --name certbot \<br> -v &quot;/etc/letsencrypt:/etc/letsencrypt&quot; \<br> -v &quot;/nfs/$USER/nginx/www/letsencrypt/:/webroot/&quot; \<br> certbot/certbot:arm32v6-latest certonly \<br> -d mycustomserver.anyddns.org --verbose --keep-until-expiring \<br> --agree-tos --email <a href="/service/mailto:m.arciprete@gmail.com">myemail@provider.com</a> \<br> --preferred-challenges=http \<br> --webroot --webroot-path=/webroot</pre><p>In this case we created a container for certbot which:</p><ul><li>uses the shared /etc/letsencrypt folder</li><li>shares the “acme-challenge” folder with nginx, to store the challenge and serve it via http</li><li>uses the arm32 version of the image</li></ul><blockquote>Please note: we passed all the parameters to the command line because we want to use the same container to automatically renew the certificates when they expire. Just remember to replace mycustomserver.anyddns.org with your dyndns and your email too.</blockquote><p>If certbot works correctly, you should receive a message like the following:</p><pre>Requesting a certificate for mycustomserver.anydyndns.org</pre><pre>Successfully received certificate.<br>Certificate is saved at: /etc/letsencrypt/live/mycustomserver.anydyndns.org/fullchain.pem<br>Key is saved at:         /etc/letsencrypt/live/mycustomserver.anydyndns.org/privkey.pem</pre><p>It’s time to complete the configuration of nginx, and create an https server.</p><h4>Update Nginx to proxy https requests</h4><p>Let’s open our <em>proxy.conf </em>file and add do the following:</p><ol><li>add the / location with a redirect to the https</li><li>set up the https part to serve your new location (HomeAssistant in my case)</li></ol><pre>map $http_upgrade $connection_upgrade {<br>    default upgrade;<br>    &#39;&#39;      close;<br>}</pre><pre>server {<br>   listen 80;<br>   location / {<br>        return 301 <a href="https://$host$request_uri/">https://$host$request_uri</a>;<br>   }</pre><pre>location ^~ /.well-known/acme-challenge/ {<br>        allow all;<br>        root /var/www/letsencrypt;<br>        default_type &quot;text/plain&quot;;<br>   }<br>}</pre><pre>server {</pre><pre>    listen 443 ssl default_server ipv6only=off;<br>    server_name mycustomserver.anydyndns.org;</pre><pre>    ssl_certificate  /etc/letsencrypt/live/mycustomserver.anydyndns.org/fullchain.pem;<br>    ssl_certificate_key  /etc/letsencrypt/live/mycustomserver.anydyndns.org/privkey.pem;</pre><pre>    ssl_protocols TLSv1.2;                                                     <br>    ssl_ciphers &quot;EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4&quot;;<br>    ssl_prefer_server_ciphers on;                                            <br>    ssl_session_cache shared:SSL:10m;                                                                       <br>                                                              <br>    proxy_buffering off;</pre><pre>access_log            /var/log/nginx/access.log;</pre><pre>    location / {<br>      proxy_pass              http://localhost:8080;                      <br>      proxy_set_header        Host $host;<br>      proxy_set_header        X-Real-IP $remote_addr;<br>      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;<br>      proxy_set_header        X-Forwarded-Proto $scheme;<br>      proxy_read_timeout  90;<br>      proxy_set_header Upgrade $http_upgrade;                                                             <br>      proxy_set_header Connection $connection_upgrade;<br>    }<br>  }</pre><p>The proxy_pass should contain the address of the server you want to reach, for instance <a href="http://homeassistant.local:8123/">http://homeassistant.local:8123</a> or anything you want.</p><blockquote>Please note: I’ve also added the Upgrade and the Connection headers, together with a “map” section in nginx. This is only required if you plan to use Websocket, as HomeAssistant does.</blockquote><h3>Automatic renewal of certificates</h3><p>Letsencrypt certificates expire after 90 days. To automatically renew them I use a cron task that invokes the certbot container and then reloads nginx to activate the change. If you noted, the certbot container was created with the “keep-until-expiring” flag, so the certificates are actually renewed only when needed.</p><p>First, we edit the crontab by entering</p><pre>$ crontab -e</pre><p>add the following lines:</p><pre>30 2 * * * docker start certbot<br>35 2 * * * docker exec nginx nginx -s reload</pre><p>This isnstructs crontab to run “docker start certbot” every night at 2:30 am, and then reload the nginx configuration five minutes later, at 2.35, just to be sure that the certbot process is complete.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a7bd50c92b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>