OPENVPN

IL server OPENVPN si trova su DEBIAN10 nel pc di Cesare 10.8.0.1. Per creare un nuovo utente si va nella cartella home di tullio dove si trova il file
./debian10-vpn.sh
sudo ./debian10-vpn.sh digitare la password z

It looks like OpenVPN is already installed.

What do you want to do?
1) Add a new user
2) Revoke existing user
3) Remove OpenVPN
4) Exit
Select an option [1-4]: 1
Selezionare 1
client name: cammacaco

Do you want to protect the configuration file with a password?
(e.g. encrypt the private key with a password)
1) Add a passwordless client
2) Use a password for the client
Select an option [1-2]: 1
Selezionare 1

Note: using Easy-RSA configuration from: /etc/openvpn/easy-rsa/vars
Using SSL: openssl OpenSSL 1.1.1n 15 Mar 2022
Generating an EC private key

writing new private key to ‘/etc/openvpn/easy-rsa/pki/easy-rsa-2885.Wmo6a7/tmp.bDZGih’

Using configuration from /etc/openvpn/easy-rsa/pki/easy-rsa-2885.Wmo6a7/tmp.rUeqD7
Check that the request matches the signature
Signature ok
The Subject’s Distinguished Name is as follows
commonName :ASN.1 12:’cammacaco’
Certificate is to be certified until Nov 21 21:30:05 2024 GMT (825 days)

Write out database with 1 new entries
Data Base Updated

Client cammacaco added.

The configuration file has been written to /home/tullio/cammacaco.ovpn.
Download the .ovpn file and import it in your OpenVPN client.
Verrà creato un file per un nuovo utente, cammacaco.ovpn nella cartella root. Siccome questa cartella non è accessibile copiare il file .ovpn nella cartella home di tullio dove si troveranno tutti gli altri utenti creati precedentemente. Con FTP si può accedere a questa cartella e prelevare il file.

Se il nuovo utente è un raspberry rinominare il file .ovpn in .conf.

Installazione di un client OPENVPN su RASPBERRY BUSTER

OpenVPN client su Raspberry Pi

In un precedente articolo ho descritto passo passo come installare un server OpenVPN su Raspberry Pi. In questo articolo invece andrò a spiegare come installare il client OpenVPN e come lanciare una connessione VPN.

Per prima cosa andiamo ad installare openVPN con il seguente comando:

sudo apt-get install openvpn

ora andiamo a posizionare il file “.conf” generato dal server OpenVPN all’interno del seguente percorso:

/etc/openvpn/

Ora per prima cosa avviamo il servizio OpenVPN:

sudo /etc/init.d/openvpn start

Se il servizio OpenVPN non dovesse partire buttate un occhio al file di log con il seguente comando:

tail /var/log/daemon.log

Per lanciare la nostra connessione VPN eseguiamo il seguente comando:

sudo openvpn /etc/openvpn/cammacaco.conf

dove nel mio caso il file di configurazione è denominato cammacaco.conf
Per avviare OPENVPN al boot entrare nella cartella /etc/default/ ed editare il file openvpn qui sotto

# This is the configuration file for /etc/init.d/openvpn

#
# Start only these VPNs automatically via init script.
# Allowed values are "all", "none" or space separated list of
# names of the VPNs. If empty, "all" is assumed.
# The VPN name refers to the VPN configutation file name.
# i.e. "home" would be /etc/openvpn/home.conf
#
# If you're running systemd, changing this variable will
# require running "systemctl daemon-reload" followed by
# a restart of the openvpn service (if you removed entries
# you may have to stop those manually)
#
#AUTOSTART="all"
#AUTOSTART="none"
AUTOSTART="cammacaco"
#
# WARNING: If you're running systemd the rest of the
# options in this file are ignored.
#
# Refresh interval (in seconds) of default status files
 

Togliere il commento e inserire cammacaco a AUTOSTART=”cammacaco”

A questo punto lanciare il comando
sudo systemctl enable openvpn per avviare OPENVPN al boot

sudo systemctl enable openvpn@server.service
systemctl start openvpn@cammacaco.service
@reboot systemctl start openvpn@server.service to root's crontab

Lascia un commento