<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<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>vpn &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/vpn/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Wed, 25 Sep 2024 07:14:13 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>vpn &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[A quick guide to getting Mozilla VPN working on a headless Linux server]]></title>
		<link>https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/</link>
					<comments>https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 16 Mar 2023 12:34:56 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vpn]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=45148</guid>

					<description><![CDATA[The Mozilla VPN service is great, but it doesn&#039;t work using the CLI if you have a &#34;headless&#34; server.  After a bit of faffing about, I got it working.  I suffered so you don&#039;t have to.  Get an account  Sign up and use code MOZILLA20 for a cheeky 20% discount!  Get a token in the browser  To start with, you&#039;ll need to get an authentication token. This requires you to be on a machine which can run a …]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://www.mozilla.org/en-US/products/vpn/">Mozilla VPN service</a> is great, but it <a href="https://github.com/mozilla-mobile/mozilla-vpn-client/issues/6301">doesn't work using the CLI if you have a "headless" server</a>.  After a bit of faffing about, I got it working.  I suffered so you don't have to.</p>

<h2 id="get-an-account"><a href="https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/#get-an-account">Get an account</a></h2>

<p><a href="https://www.mozilla.org/en-US/products/vpn/">Sign up</a> and use code <mark>MOZILLA20</mark> for a cheeky 20% discount!</p>

<h2 id="get-a-token-in-the-browser"><a href="https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/#get-a-token-in-the-browser">Get a token in the browser</a></h2>

<p>To start with, you'll need to get an authentication token. This requires you to be on a machine which can run a modern browser like Firefox or Chrome.</p>

<p>On a computer with a GUI, download <a href="https://github.com/NilsIrl/MozWire">MozWire</a>.  This is an unofficial way to download the necessary WireGuard config files.</p>

<p>Open up a terminal and make it executable:</p>

<pre>chmod +x mozwire-linux</pre>

<p>Run the app:</p>

<pre>./mozwire-linux --print-token</pre>

<p>That will automatically open your web browser. Sign in to the Mozilla VPN service in the browser. Return to your terminal and you'll see a long token like:</p>

<pre>abc.123.qwe.rty.uio</pre>

<p>It will be <em>much</em> longer than that! Save it somewhere safe.</p>

<h2 id="server-time"><a href="https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/#server-time">Server time!</a></h2>

<p>SSH into your server.  Download <a href="https://github.com/NilsIrl/MozWire">MozWire</a>.</p>

<pre>wget https://github.com/NilsIrl/MozWire/releases/latest/download/mozwire-linux</pre>

<p>Make it executable:</p>

<pre>chmod +x mozwire-linux</pre>

<p>Check that it works by getting it to list all the devices you have associated with your account:</p>

<pre>./mozwire-linux --token abc.123.qwe.rty.uio device list</pre>

<p>That should show the name of your devices - it <em>won't</em> include the server.</p>

<p>It's tedious to type in the token each time, so run:</p>

<pre>export MOZ_TOKEN="abc.123.qwe.rty.uio"</pre>

<p>Run:</p>

<pre>./mozwire-linux device list</pre>

<p>And you should get the same result as before.</p>

<p>Make sure you have installed WireGuard and resolvconf:</p>

<pre>sudo apt install wireguard wireguard-tools resolvconf</pre>

<p>Next, generate the public/private keypair and associate it with your server:</p>

<pre>./mozwire-linux device add --name My-Awesome-Server --privkey $(wg genkey)</pre>

<p>Once that's run, you can confirm the server has been added by again running:</p>

<pre>./mozwire-linux device list</pre>

<p>That should show your previous devices <em>and</em> the new one.</p>

<p>Next up, it's time to download all the Mozilla VPN WireGuard configs:</p>

<pre>./mozwire-linux relay save -o ~/mozwireconf -n 0</pre>

<p>That will upload your public key to Mozilla and then download a bunch of configurations into <code>~/mozwireconf</code> (or wherever you choose).</p>

<h2 id="run-wireguard"><a href="https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/#run-wireguard">Run Wireguard</a></h2>

<p>To connect to, say, the Denmark Copenhagen server, run:</p>

<pre>wg-quick up ~/mozwireconf/dk-cph-wg-101.conf</pre>

<p>And... that's it! If you run <code>ifconfig</code> you'll see a new network entry for WireGuard.</p>

<p>You can check that it's working by running:</p>

<pre>curl https://ifconfig.co/json ; echo</pre>

<p>That will print out some diagnostic information about the IP address your server presents to the world.</p>

<p>To turn off the MozillaVPN, run:</p>

<pre>wg-quick down ~/mozwireconf/dk-cph-wg-101.conf</pre>

<p>To run MozillaVPN for a single program, install <a href="https://github.com/jamesmcm/vopono/">Vopono</a></p>

<pre><code class="language-_">vopono exec --custom ~/.config/vopono/mozilla/wireguard/fi-hel-wg-103.conf "curl https://ifconfig.co/json"
</code></pre>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=45148&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/03/a-quick-guide-to-getting-mozilla-vpn-working-on-a-headless-linux-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Cisco AnyConnect for Linux - save profile]]></title>
		<link>https://shkspr.mobi/blog/2020/09/cisco-anyconnect-for-linux-save-profile/</link>
					<comments>https://shkspr.mobi/blog/2020/09/cisco-anyconnect-for-linux-save-profile/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 25 Sep 2020 11:05:47 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vpn]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=36392</guid>

					<description><![CDATA[I couldn&#039;t find a simple guide to this - so these are notes to myself.  Create a file called myVPN.xml:  &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;AnyConnectProfile xmlns=&#34;http://schemas.xmlsoap.org/encoding/&#34;                    xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34;                    xsi:schemaLocation=&#34;http://schemas.xmlsoap.org/encoding/AnyConnectProfile.xsd&#34;&#62;    &#60;ServerList&#62;     …]]></description>
										<content:encoded><![CDATA[<p>I couldn't find a simple guide to this - so these are notes to myself.</p>

<p>Create a file called <code>myVPN.xml</code>:</p>

<pre><code class="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/AnyConnectProfile.xsd"&gt;
   &lt;ServerList&gt;
      &lt;HostEntry&gt;
         &lt;HostName&gt;My Work VPN&lt;/HostName&gt;    
         &lt;HostAddress&gt;vpn.example.com/connect&lt;/HostAddress&gt;
      &lt;/HostEntry&gt;
   &lt;/ServerList&gt;
&lt;/AnyConnectProfile&gt;
</code></pre>

<p>Place it in <code>/opt/cisco/anyconnect/profile/</code></p>

<p>Now, when you launch your VPN client, it will show you your saved hosts.</p>

<p>Huge thanks to <a href="https://www.linkedin.com/in/alexander-monk/">Alex Monk</a> for showing me the way!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=36392&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2020/09/cisco-anyconnect-for-linux-save-profile/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
