<?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: Ömer Demircan</title>
    <description>The latest articles on DEV Community by Ömer Demircan (@omeroot).</description>
    <link>https://dev.to/omeroot</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%2F391713%2Fcc846c32-ae33-4852-b691-cfb97420cd79.jpeg</url>
      <title>DEV Community: Ömer Demircan</title>
      <link>https://dev.to/omeroot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omeroot"/>
    <language>en</language>
    <item>
      <title>Setup Streisand VPN on Hetzner Cloud</title>
      <dc:creator>Ömer Demircan</dc:creator>
      <pubDate>Fri, 23 Oct 2020 09:34:23 +0000</pubDate>
      <link>https://dev.to/omeroot/setup-streisand-vpn-on-hetzner-cloud-4m4</link>
      <guid>https://dev.to/omeroot/setup-streisand-vpn-on-hetzner-cloud-4m4</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/StreisandEffect/streisand"&gt;Streisand&lt;/a&gt; is a open source VPN setup builder. We can use this every time we want and access to all sites and services. We setup this service to own cloud virtual machine which we get from Hetzner. You only pay 2.49 € / mon. This is very cheap.&lt;/p&gt;

&lt;p&gt;Some Streisand services include add-ons for VPN&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.openssh.com/" rel="noreferrer noopener nofollow"&gt;OpenSSH&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ocserv.gitlab.io/www/index.html" rel="noreferrer noopener nofollow"&gt;OpenConnect&lt;/a&gt; / &lt;a href="https://www.cisco.com/c/en/us/products/security/anyconnect-secure-mobility-client/index.html" rel="noreferrer noopener nofollow"&gt;Cisco AnyConnect&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openvpn.net/index.php/open-source.html" rel="noreferrer noopener nofollow"&gt;OpenVPN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shadowsocks.org/en/index.html" rel="noreferrer noopener nofollow"&gt;Shadowsocks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A private &lt;a href="https://www.torproject.org/" rel="noreferrer noopener nofollow"&gt;Tor&lt;/a&gt; bridge relay&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.wireguard.com/" rel="noreferrer noopener nofollow"&gt;WireGuard&lt;/a&gt;, a modern high-performance protocol.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Today We will setup OpenConnect . Then We use iOS application and terminal access on desktop(If you want you can download GUI to desktop from App Store).&lt;/p&gt;

&lt;p&gt;Normally Streisand setup is very easy but If you only setup on providers on below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Web Services (AWS)&lt;/li&gt;
&lt;li&gt;Microsoft Azure&lt;/li&gt;
&lt;li&gt;Digital Ocean&lt;/li&gt;
&lt;li&gt;Google Compute Engine (GCE)&lt;/li&gt;
&lt;li&gt;Linode&lt;/li&gt;
&lt;li&gt;Rackspace&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But We will setup on the hetzner and We must follow the advanced installation instructions.&lt;/p&gt;

&lt;p&gt;Streisand need a second server for using builder and setup VPN to second server which is your primary VPN server but today we will build directly local VPN to on our primary machine We won't use a second builder server.&lt;/p&gt;

&lt;h5&gt;Requirements&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;Verified the hetzner account &lt;/li&gt;
&lt;li&gt;Knowledge of terminal level of beginner.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope you have requirements because this article does not contain above things. Now If you are ready to start virtual machine on cloud let's start. 💻&lt;/p&gt;

&lt;h3&gt;Up Hetzner Virtual Machine.&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://console.hetzner.cloud/projects"&gt;cloud console&lt;/a&gt; then If you have not any project create new project and type &lt;code&gt;project name&lt;/code&gt; (ex: VPN Project).&lt;/li&gt;
&lt;li&gt;Enter to this and click &lt;code&gt;Add Server&lt;/code&gt; &lt;ol&gt;
&lt;li&gt;Select location what you want (I selected Helsinki because of it is sitting in Europe.)&lt;/li&gt;
&lt;li&gt;Select Linux &lt;strong&gt;Ubuntu 16.04&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Select Type is Standart and Machine &lt;strong&gt;CX11&lt;/strong&gt; (You can select dedicated machine but it is expensive). This combination is the best choice. If too many people don't be use this VPN.&lt;/li&gt;
&lt;li&gt;You can skip Volume,  Network, Additional features.&lt;/li&gt;
&lt;li&gt;You should a ssh key to access to your virtual machine with on terminal. &lt;ol&gt;&lt;li&gt;Basically you can run this command  &lt;code&gt;ssh-keygen -t ecdsa -b 521&lt;/code&gt; &lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;You paste content of &amp;lt;your ssh key&amp;gt;.pem file and enter name.&lt;/li&gt;
&lt;li&gt;Last step click &lt;code&gt;Create &amp;amp; Buy Now&lt;/code&gt; button.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Setup Streisand On Your Virtual Machine.&lt;/h3&gt;

&lt;p&gt;Connect your machine with ssh using &lt;code&gt;root&lt;/code&gt; user. Then first things we update and upgrade linux packages.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ apt update&lt;/code&gt;&lt;/pre&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ apt upgrade -y&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now create id_rsa to be used by streisand. Run below command and press enter  to all questions.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ ssh-keygen -t rsa -b 4096&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now We gonna clone source code from github.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ git clone https://github.com/StreisandEffect/streisand.git
$ cd streisand&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Install required additional packages. There is a util script in the streisand source code it checks all dependencies for ubuntu.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ ./util/ubuntu-dependencies.sh&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now We will create python environment and activate that. Be sure you are in streisand directory.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ ./util/venv-dependencies.sh ./venv&lt;/code&gt;&lt;/pre&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ source ./venv/bin/activate&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;! If you get error such this &lt;span class="tadv-color"&gt;Failing command: ['/root/streisand/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;You should copy and paste below three lines to server terminal and press enter.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is last step. We create a site.yml file for builder to get standart configs. Create a file in parent directory of your streisand folder. Create hidden folder named &lt;code&gt;.streisand&lt;/code&gt; and then create file names &lt;code&gt;site.yml&lt;/code&gt;&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ mkdir .streisand
$ vim site.yml&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Paste below block to site.yml&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;---
# Site specific Streisand configuration.
#
# This file is mutated by the playbooks/customize.yml tasks when a user chooses
# to customize which Streisand services are installed.

# The SSH private key that Ansible will use to connect to the Streisand node.
# The associated public key will be used if required when provisioning cloud
# nodes for the authorized_keys file.
streisand_ssh_private_key: "~/.ssh/id_rsa"

vpn_clients: 10

streisand_ad_blocking_enabled: no
streisand_openconnect_enabled: yes
streisand_openvpn_enabled: no
streisand_shadowsocks_enabled: yes
streisand_shadowsocks_v2ray_enabled: no
streisand_ssh_forward_enabled: yes
# By default sshuttle is disabled because it creates a `sshuttle` user that has
# full shell privileges on the Streisand host
streisand_sshuttle_enabled: no
streisand_stunnel_enabled: no
streisand_tinyproxy_enabled: no
streisand_tor_enabled: no
streisand_wireguard_enabled: no
streisand_cloudflared_enabled: no&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This configuration allows only openconnect to be configured. Now run builder.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;$ ./streisand&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This builder ask some questions to you. You should answer &lt;code&gt;no&lt;/code&gt; to below question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Press enter to customize your installation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When Installation is ended builder generate to &lt;strong&gt;&lt;code&gt;generated-docs&lt;/code&gt;&lt;/strong&gt; folder in directory. You should install this folder to your computer(you could use secure copy...).&lt;/p&gt;

&lt;p&gt;You drag and drop html file to chrome browser You can see all instructions client configs for all devices (macos, ios, android,...)&lt;/p&gt;

&lt;p&gt;Congratulations now you own a VPN 🎉🎉&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
