Info about back-tunnel here

From Anarchaserver

S14 tunnel

local/ S14 machine

ssh tunnel@ sudo openvpn --config /home/tunnel/client.conf


edit /etc/default/openvpn

Remove the ‘#' infront of ‘AUTOSTART=”all”‘ so that OpenVpn allows to start the .conf files

sudo systemctl enable openvpn-client@.service

sudo systemctl daemon-reload sudo systemctl restart openvpn-client@anarcha.service

sudo openvpn --config <client-name>.ovpn Initialization Sequence Completed

Run client openvpn as daemon in the background - see `man openvpn` for more options sudo openvpn --config <client-name>.ovpn --daemon

To stop the daemon: Find the daemon process pgrep -lf openvpn

Kill the process sudo kill <process number>

Run client openvpn in the foreground for troubleshooting the tunnel: sudo openvpn --config <client-name>.ovpn if your verbosity in the client conf file is set to 4, then stdout of the above command should end with Initialization Sequence Completed

Run client openvpn systemd unit file: Copy your client conf file to /etc/openvpn/client/ directory

in this way you can stop, start and check status of the vpn with the systemctl command: e.x if your client file is called myvpn.conf, then the command goes:

sudo systemctl start|stop|status openvpn-client@anarcha.service

(All system unit files are in /lib/systemd/system/)

Explanation: the system unit script is in /lib/systemctl/system/openvpn-client@.service whatever name you put between openvpn-client@ and .service is passed inside this unit file. This unit file which changes dir to /etc/openvpn/client and executes openvpn --config <name>.conf

Run server openvpn systemd unit file: sudo systemctl start|stop|status openvpn@server.service

Check tunnel is up sudo ifconfig ip addr show dev tun0 tun0 should appear

Ping from your pi the server's tun0 IP ping traceroute

From your pi run ifconfig and find your tun0 IP, let's say it's

Ping from the anarchaserver your pi_tunnel_ip

SSH to tunnel pi from anarchaserver (2 ways) 1. edit /root/.ssh/config and update the Hostname IP to match the one of the pi's tun0 (once pi gets a dns or a static IP we won't have to edit this config file) then do: ssh tunnel-pi 2. OR do: ssh tunnel@ OK*

copy files

MOUNT HARD DRIVE tunnel@<pi_tunnel_ip>:/mnt/S14-backup tunnel@<pi_tunnel_ip>:/mntmeme_bak

STORAGE Mount disks

NAS http://water.local:5000/ sudo mount.cifs -o user=tunnel,password=*****,uid=1001,rw,vers=2.0 // /mnt/S14-backup /mnt/S14-backup

DISK sudo mount /dev/sda1 /mnt/meme_bak

HOW TO DO THAT IN STARTUP? add the above mount command in /etc/fstab (double check online tips) to tell where the storage device will be automatically mounted when the Raspberry Pi starts up.



In the fstab file, the disk partition is identified by the universally unique identifier

sudo blkid

ADD UUID=a164f220-cc96-450f-aa4a-27849ed21d44 /mnt/meme_bak ext4 defaults,auto,users,rw,nofail 0 0

mount cloud NAS

ADD // /mnt/S14-backup cifs user=tunnel,password=****,uid=1001,rw,iocharset=utf8,vers=2.0 0 0

Next challenge HOW TO REACH NAS water from the browser when tunnel is UP Need to mount NAS water on startup with adding the mount command also in /etc/fstab Register a domain name for the pi and either request from your internet provider a fixed IP or run a script in pi to update the dns service reqularly with its dynamic public IP. (mara has done the latter with her pi) install samba server on pi, or apache2, or nginx to serve content of the mounted disks Edit the /etc/openvpn/server.conf to push traffic to pi IP subnet. (lines 134- 140) The user's device which wants to reach pi or NAS via the browser, needs also to install openvpn and a client certificate

FIND tunnel pi IP when outside the house You need to know the CN in your certificate, Lookup the line starting with Subject: located in the file .cert or in the client conf if all keys and certs are bundled within. E.x Subject: C=SP, ST=Catalunya, L=Barcelona, O=AnarchaServer, OU=AnarchaServer, CN=FutureVintage/name=EasyRSA/ SSH to anarcha, and do: tail /var/log/openvpn.log search for the CN name, in our example FutureVintage, and check the IP In our example in openvpn.log it looks like:

   Fri Feb  7 21:14:57 2020 us=535934 MULTI: Learn: -> FutureVintage/

LATER Add local subnet to vpn

Enable two-way traffic client-server Reach OpenVPN clients directly from a private network