<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Colin Rubbert</title>
    <description>The latest articles on DEV Community by Colin Rubbert (@colinrubbert).</description>
    <link>https://dev.to/colinrubbert</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F127660%2F81949210-6bc1-4394-b12d-862e9cd7abf2.jpeg</url>
      <title>DEV Community: Colin Rubbert</title>
      <link>https://dev.to/colinrubbert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/colinrubbert"/>
    <language>en</language>
    <item>
      <title>Self-hosted web analytics with Matomo and Azure</title>
      <dc:creator>Colin Rubbert</dc:creator>
      <pubDate>Fri, 09 Aug 2019 15:19:37 +0000</pubDate>
      <link>https://dev.to/colinrubbert/self-hosted-web-analytics-with-matomo-and-azure-4m3f</link>
      <guid>https://dev.to/colinrubbert/self-hosted-web-analytics-with-matomo-and-azure-4m3f</guid>
      <description>&lt;h1&gt;
  
  
  Matomo + Azure = 📈
&lt;/h1&gt;

&lt;h1&gt;
  
  
  What is Matomo?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://matomo.org"&gt;Matomo&lt;/a&gt; is an all-in-one premium web analytics platform with the philosophy of 100% data ownership. Simply stated, you own your data, no one else. That means that no abuse of privacy via Google Analytics, Facebook analytics or any other third-party website analytics software. &lt;/p&gt;

&lt;p&gt;Privacy has been a growing concern of mine and I'm starting, bit by bit, to take back some control of that and protect my end users from similar abuses. Be the change you want to see, so the saying goes. &lt;/p&gt;

&lt;h1&gt;
  
  
  What you'll need
&lt;/h1&gt;

&lt;p&gt;Just like previous articles I'm an Azure user. Azure is great, it's friendly to use, simple, cost effective, and just good. That's what we'll be using. &lt;/p&gt;

&lt;p&gt;Listed below are what we will need for required installation and configuration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An account on Azure&lt;/li&gt;
&lt;li&gt;Access to SSH to configure our virtual machine which will be Linux based (WSL, Linux, macOS, etc)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Getting started
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Creating the virtual machine
&lt;/h3&gt;

&lt;p&gt;Using the free account and credits for Azure we will leverage some of the other free marketplace Azure services.&lt;/p&gt;

&lt;p&gt;Log into your newly created or existing Azure account and do a search for &lt;code&gt;Free services&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YgEcn_hH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/1501522ef66d789d4aa8ea093bdd18a7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YgEcn_hH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/1501522ef66d789d4aa8ea093bdd18a7.png" alt="Azure Free Services"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;Free services&lt;/code&gt; and you'll be presented with a list of available free services. We're going to select the &lt;strong&gt;Linux Virtual Machine&lt;/strong&gt;, this gives us 750 hours of free B1S this should provide us with some solid, cheap hours of use. Even after the free 750 hours credit it still would only cost, roughly, $8/mo. Pretty cheap, relatively speaking. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--19ObEusw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/f968c50c998a96788181f4f8a3733fcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--19ObEusw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/f968c50c998a96788181f4f8a3733fcc.png" alt="Azure B1S Free Linux"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to configure our virtual machine, like so. Obviously fill in your own unique information. If you plan on accessing your VM from more than one computer that you select &lt;code&gt;Password&lt;/code&gt; instead of &lt;code&gt;SSH public key&lt;/code&gt; it's a bit less mucking about. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PJ9X6swP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/fb54f52f88e3bcec7e36ce44053deb0c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PJ9X6swP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/fb54f52f88e3bcec7e36ce44053deb0c.png" alt="Azure create virtual machine"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If everything was configured properly we should have passed validation, if you didn't fix your errors and try again. Then click &lt;code&gt;Create&lt;/code&gt; to start creating your virtual machine.&lt;/p&gt;

&lt;p&gt;Navigate to your VM and check what the &lt;code&gt;Public IP Address&lt;/code&gt; is and then we will use that to ssh into our VM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring the Virtual Machine
&lt;/h3&gt;

&lt;p&gt;SSH into your virtual machine by typing &lt;code&gt;ssh [username]@[public IP address]&lt;/code&gt;, replacing &lt;code&gt;[username]&lt;/code&gt; with the username you specified in the creation of the virtual machine and then replacing &lt;code&gt;[public IP address]&lt;/code&gt; with the public IP address of your virtual machine. &lt;/p&gt;

&lt;p&gt;Once we're logged in update the virtual machine by running the following commands.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install php7.3 php7.3-cli php7.3-fpm php7.3-curl php7.3-gd mysql-server php7.3-mysql php-xml php7.3-mbstring unzip -y
sudo apt update
sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that we're updated to the latest version(s) of our virtual machines software we can continue onto the install.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a database
&lt;/h3&gt;

&lt;p&gt;Before we can run Matomo we will need to create a database for Matomo to use. Let's sign into our MySQL as our root user.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql -u root -p
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create the database.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE DATABASE matomo;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create a new user for the new database.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE USER `billybob@example.com` IDENTIFIED BY 'your_secret_password';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Grant new user the relevant permissions on the database.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GRANT ALL ON matomo.* TO `billybob@example.com`;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Flush privileges and exit the MySQL console.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FLUSH PRIVILEGES;
exit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Installing Matomo
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Installing Nginx and configure Nginx for Matomo
&lt;/h3&gt;

&lt;p&gt;Matomo will need some sort of web server software so that we can operate Matomo as intended. For the purpose of this tutorial we're going to instal Nginx. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install -y nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that we've got Nginx installed we need to configure Nginx for our Matomo instance. First we'll need to create the file.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/matomo.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we will need to populate the file with our server configurations. Obviously change the &lt;code&gt;server_name&lt;/code&gt; with your specific server name.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {

  listen [::]:443 ssl http2;
  listen 443 ssl http2;
  listen [::]:80;
  listen 80;

  server_name stats.fivethirtyfour.com;
  root /var/www/matomo/;
  index index.php;

  location ~ ^/(index|matomo|piwik|js/index).php {
    include snippets/fastcgi-php.conf;
    fastcgi_param HTTP_PROXY ""; 
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; 
  }

  location = /plugins/HeatmapSessionRecording/configs.php {
    include snippets/fastcgi-php.conf;
    fastcgi_param HTTP_PROXY "";
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  }

  location ~* ^.+\.php$ {
    deny all;
    return 403;
  }

  location / {
    try_files $uri $uri/ =404;
  }

  location ~ /(config|tmp|core|lang) {
    deny all;
    return 403;
  }

  location ~ \.(gif|ico|jpg|png|svg|js|css|htm|html|mp3|mp4|wav|ogg|avi|ttf|eot|woff|woff2|json)$ {
    allow all;
  }

  location ~ /(libs|vendor|plugins|misc/user) {
    deny all;
    return 403;
  }

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we will need to activate the new matomo.conf configuration by linking the file to the &lt;code&gt;sites-enabled&lt;/code&gt; directory.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/matomo.conf /etc/nginx/sites-enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Test the Nginx configuration for syntax errors.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nginx -t
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Reload the Nginx service&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl reload nginx.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Download &amp;amp; Extract Matomo
&lt;/h3&gt;

&lt;p&gt;Before we download and install Matomo we need to create and move into our webserver's directory.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir -p /var/wwww/ &amp;amp;&amp;amp; cd /var/www/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we need to download Matomo first before we can install it. From our console run the following commands. The first section is downloading the file, the second section is unzipping our file we just downloaded and the third section is to clean up the .zip file we downloaded.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget https://builds.matomo.org/matomo.zip &amp;amp;&amp;amp; unzip matomo.zip &amp;amp;&amp;amp; rm matomo.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Finally let's change ownership of the &lt;code&gt;/var/www/matomo&lt;/code&gt; directory to &lt;code&gt;www-data user&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R www-data:www-data /var/www/matomo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Installing a Let's Encrypt certificate for ssl
&lt;/h3&gt;

&lt;p&gt;It's important to run our services and websites over SSL. Not only does it give us our privacy but it provides the confidence and privacy of our users.&lt;/p&gt;

&lt;p&gt;First we need to install the required repositories to run LetsEncrypt&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt upgrade -y
sudo apt install certbot python-certbot-nginx -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that the software is installed we need to create our certificate using the Nginx certbot plugin. Obviously changing the domain for what your site will be.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo certbot --nginx -d stats.fivethirtyfour.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now if we look at our &lt;code&gt;/etc/nginx/sites-available/matomo.conf&lt;/code&gt; file we should see that certbot has added our SSL configurations for us. &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;######################################
## SNIPPET OF THE MATOMO.CONF FILE  ##
######################################

ssl_certificate /etc/letsencrypt/live/stats.fivethirtyfour.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/stats.fivethirtyfour.com/privkey.pem; # managed by Certbot
}

server {
    if ($host = stats.fivethirtyfour.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

  listen [::]:80;
  listen 80;
  server_name stats.fivethirtyfour.com;
    return 404; # managed by Certbot
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now head over to your website where you deployed your site and you should see the Matomo installation page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2-tB2WTj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/4be9e8f3abe8716ef0dcc23732ee6ac2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2-tB2WTj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/4be9e8f3abe8716ef0dcc23732ee6ac2.png" alt="Matomo installation setup page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Completing the Matomo Analytics setup
&lt;/h3&gt;

&lt;p&gt;Now go through the Matomo installation process and once you get to the &lt;code&gt;Database Setup&lt;/code&gt; section make sure to file this in with the information you created in the &lt;code&gt;Creating a database&lt;/code&gt; section earlier in this guide.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jA6gOBHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/c1dc56749d140dc810ba1f80a7b14b6a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jA6gOBHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://d1qmdf3vop2l07.cloudfront.net/touted-salmon.cloudvent.net/compressed/_min_/c1dc56749d140dc810ba1f80a7b14b6a.png" alt="Matomo database setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Continue going through the configuration and once you get to the &lt;code&gt;Tracking code&lt;/code&gt; section make sure you copy your tracking code snippet. This is what you will use to add to your website to gather the analytics information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulations you now have Matomo Analytics running in Azure cloud instance!!!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/YnSTMd4T9BISZcHcAL/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/YnSTMd4T9BISZcHcAL/giphy.gif" alt="Congratulations GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally posted at &lt;a href="https://fivethirtyfour.com"&gt;https://fivethirtyfour.com&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
&lt;a href="https://fivethirtyfour.com/matomo-web-analytics-and-azure"&gt;Matomo Web Analytics and Azure&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>webdev</category>
      <category>sysadmin</category>
    </item>
    <item>
      <title>Self-hosted VPN with Algo and Azure</title>
      <dc:creator>Colin Rubbert</dc:creator>
      <pubDate>Thu, 25 Jul 2019 17:40:00 +0000</pubDate>
      <link>https://dev.to/colinrubbert/self-hosted-vpn-with-algo-and-azure-1kbn</link>
      <guid>https://dev.to/colinrubbert/self-hosted-vpn-with-algo-and-azure-1kbn</guid>
      <description>&lt;h1&gt;
  
  
  What is Algo?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://blog.trailofbits.com/2016/12/12/meet-algo-the-vpn-that-works/" rel="noopener noreferrer"&gt;Algo VPN&lt;/a&gt; is an open source self-hosted VPN service. There's tons of VPN services available but if you want to control what data is collected, used, and/or sold then rolling your own VPN service couldn't be much easier. &lt;/p&gt;

&lt;p&gt;Algo VPN is an on-demand VPN service in the cloud (or on a local machine that is open to the internet) that uses modern protocols and ciphers, and minimal software. Since the VPN is self-hosted the ability to teardown and rebuild couldn't be much easier.&lt;/p&gt;

&lt;p&gt;There's little configuration and pretty close to "one-click" installs via the Ansible packager. &lt;/p&gt;

&lt;h1&gt;
  
  
  What you'll need
&lt;/h1&gt;

&lt;p&gt;Listed below are what we will need for the required installation and configuration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An account on Azure*&lt;/li&gt;
&lt;li&gt;An installation of Ansible&lt;/li&gt;
&lt;li&gt;Access to a debian-base operating system (WSL, Ubuntu, Debian, VM w/Debian, etc)&lt;/li&gt;
&lt;li&gt;Support for macOS is also available&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Some assumptions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows Subsystem for Linux installed - since I will be doing this from a Windows machine I will be using WSL for this demonstration.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access to a bash shell&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;This is what we will be using for this demonstration however this is pretty universal for installation on all the other major cloud providers&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Getting started
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Azure-cli
&lt;/h3&gt;

&lt;p&gt;We will need to install the &lt;strong&gt;Azure CLI&lt;/strong&gt; in order for us to get shell access to our Azure environment. This will help automate a lot of the process and we won't have to make special API keys since we'll already be authenticated to the Azure environment.&lt;/p&gt;

&lt;p&gt;Install the Azure-cli pre-requisites&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    curl &lt;span class="nt"&gt;-sL&lt;/span&gt; https://aka.ms/InstallAzureCLIDeb | &lt;span class="nb"&gt;sudo &lt;/span&gt;bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Ansible
&lt;/h3&gt;

&lt;p&gt;Add Ansible repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-add-repository &lt;span class="nt"&gt;-y&lt;/span&gt; ppa:ansible/ansible
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update repositories&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="nt"&gt;-y&lt;/span&gt;
    &lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Python tools
&lt;/h3&gt;

&lt;p&gt;Install Python tools&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; build-essential libssl-dev libffi-dev python-dev python-pip python-setuptools python-virtualenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Algo VPN server installation
&lt;/h2&gt;

&lt;p&gt;Clone the repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    git clone https://github.com/trailsofbits/algo
    &lt;span class="nb"&gt;cd &lt;/span&gt;algo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the remaining environment and requirements&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    python &lt;span class="nt"&gt;-m&lt;/span&gt; virtualenv &lt;span class="nb"&gt;env
    source env&lt;/span&gt;/bin/activate
    python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-U&lt;/span&gt; pip
    python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure the users that will be using the VPN service. In order to do this you will need to edit &lt;code&gt;[config.cfg](http://config.cf)&lt;/code&gt; file that is located in the root of the &lt;em&gt;algo&lt;/em&gt; directory. Use your favorite editor of choice to do this. &lt;em&gt;Substitute my users for whatever your users you want.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    Users:
      -  itsame
      -  bestfriend
      -  themisses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Not required:&lt;/strong&gt; &lt;em&gt;At this point if you want to change the default VM that Algo uses to create the image you can. You will need to change the pre-defined size.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    cloud_providers:
      azure:
        size: Standard_B1S &lt;span class="c"&gt;# This can be changed to something else if need be but this is pretty cheap already and enough for 200+ simultaneous connections&lt;/span&gt;
        image: 19.04
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file and exit out of the editor&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Azure environments only:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Log into your Azure environment via the Azure-cli that we installed earlier. Run the command and a window will pop open for you to authenticate to your environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    az login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute the command to start the Algo installation. I ran into some issues when running it without &lt;code&gt;sudo&lt;/code&gt; so that's why we're doing this here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo&lt;/span&gt; ./algo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to select the cloud provider you would like to install Algo on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fcloud-provider.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fcloud-provider.png" alt="Algo Cloud Provider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since we're installing with Azure we will select &lt;code&gt;5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Most of the defaults will be more than sufficient for you but just go through them and select what's more pertinent to you and your situation.&lt;/p&gt;

&lt;p&gt;Select the region you would like to install your VPN server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fregion.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fregion.png" alt="Algo Region Selection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here the installer will run on its own without much interaction. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is one caveat though, when it prompts for you to accept the fingerprint, if you don't do in time it will time out and the installation &lt;em&gt;WILL&lt;/em&gt; fail.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fssh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fssh.jpg" alt="Algo SSH Prompt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point if everything went well the installation should have completed successfully. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fcompleted.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ffivethirtyfour.com%2Fassets%2Fimages%2Fpost-images%2Falgo-vpn-azure%2Fcompleted.png" alt="Algo Completed Message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting via a client
&lt;/h2&gt;

&lt;p&gt;To configure the VPN clients Algo generates WireGuard configuration files for all the users that you specified in your &lt;code&gt;config.cfg&lt;/code&gt; file. Those will be located at the following directories:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For WireGuard configuration files used for "importing tunnel(s) from file"&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/algo/config/&amp;lt;ip of where the server was installed&amp;gt;/wireguard/&amp;lt;username&amp;gt;.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;For WireGuard QR code used for authentication on mobile devices&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/algo/config/&amp;lt;ip of where the server was installed&amp;gt;/wireguard/&amp;lt;username&amp;gt;.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install the WireGuard software you will need to install the specific software for your device. To find the installation files for your device you can head over to &lt;a href="https://www.wireguard.com/install/" rel="noopener noreferrer"&gt;https://www.wireguard.com/install/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After installing the software on your given device import the tunnel configuration and &lt;code&gt;Activate&lt;/code&gt; the tunnel in WireGuard. &lt;/p&gt;

&lt;h2&gt;
  
  
  You're all done!
&lt;/h2&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>webdev</category>
      <category>sysadmin</category>
    </item>
  </channel>
</rss>
