Difference between revisions of "OpenVPN"
Line 103: | Line 103: | ||
copiare i tre files che vi sono stati inviati nella directory /etc/openvpn/ | copiare i tre files che vi sono stati inviati nella directory /etc/openvpn/ | ||
aggiustare i | aggiustare i permesi; | ||
chmod 600 ''hostname''.key | chmod 600 ''hostname''.key | ||
aprire eventuali porte nel firewall | aprire eventuali porte nel firewall | ||
Line 110: | Line 110: | ||
riavviare openvpn e settarlo che parta all'avvio (questo dipende dalla distro): | riavviare openvpn e settarlo che parta all'avvio (questo dipende dalla distro): | ||
/etc/init.d/openvpn start | /etc/init.d/openvpn start | ||
== client rejecting options == | |||
* in my case I wanted to skip the dns nameserver setting from my linux client. | |||
=== push option === | |||
Push a config file option back to the client for remote execution. Note that option must be enclosed in double quotes (""). | |||
The client must specify --pull in its config file. The set of options which can be pushed is limited by both feasibility and | |||
security. Some options such as those which would execute scripts are banned, since they would effectively allow a compromised | |||
server to execute arbitrary code on the client. Other options such as TLS or MTU parameters cannot be pushed because the | |||
client needs to know them before the connection to the server can be initiated. | |||
This is a partial list of options which can currently be pushed: --route, --route-gateway, --route-delay, --redirect-gateway, | |||
--ip-win32, --dhcp-option, --inactive, --ping, --ping-exit, --ping-restart, --setenv, --persist-key, --persist-tun, --echo, | |||
--comp-lzo, --socket-flags, --sndbuf, --rcvbuf | |||
=== push-reset === | |||
Don't inherit the global push list for a specific client instance. Specify this option in a client-specific context such as | |||
with a --client-config-dir configuration file. This option will ignore --push options at the global config file level. | |||
=== disable === | |||
Disable a particular client (based on the common name) from connecting. Don't use this option to disable a client due to key | |||
or password compromise. Use a CRL (certificate revocation list) instead (see the --crl-verify option). | |||
This option must be associated with a specific client instance, which means that it must be specified either in a client | |||
instance config file using --client-config-dir or dynamically generated using a --client-connect script. | |||
== Server == | == Server == |
Revision as of 18:54, 5 April 2012
Entrare nella VPN
Richiedere un Certificato
comunicare via e-mail il nome dell'host che vuole aggiungersi alla rete virtuale.
in linux:
# hostname zombie #
in windows:
Click destro su risorse del computer -> Proprietà -> (Scheda) Nome Computer -> "Full Computer Name"
l'host name sarà il vostro identificatore, quindi da ora in poi se mi riferisco a hostname intendo il vostro.
Installazione Client
Solo quando si ricevirà il certificato, sarà possibile proseguire Scaricare il client dalla pagina di openvpn.
- Download:
Linux http://openvpn.net/download.html Mac http://www.tunnelblick.net/ Windows http://www.openvpn.se/
installare i client nel sistema (richiede privilegi amministrativi)
Client Windows
spostarsi nella cartella
%ProgramFiles%\OpenVPN\config
copiare qui dentro i tre file dei certificati ricevuti da noi
hostname.crt hostname.key ca.crt
creare un file di testo chiamandolo
client.ovpn
aprirlo con BloccoNote e incollarci quanto segue
client dev tun proto udp remote porcelinux.gotdns.org 1194 resolv-retry infinite nobind verb 3 comp-lzo ca ca.crt #in queste due linee, cambiare il valore di hostname con il vostro cert hostname.crt key hostname.key
copiare i tre files che vi sono stati inviati nella directory /etc/openvpn/ aprire eventuali porte nel firewall
- on windows vista you'll need to add the following to your onfiguration:
route-method exe route-delay 2
Client Linux
installare openvpn a seconda della distribuzione che si usa: copiare il seguente testo in /etc/openvpn/openvpn.conf
client remote porcelinux.gotdns.org 1194 dev tun nobind ca ca.crt port 1194 persist-key persist-tun comp-lzo resolv-retry infinite #in queste due linee, cambiare il valore di hostname con il vostro cert hostname.crt key hostname.key
copiare i tre files che vi sono stati inviati nella directory /etc/openvpn/ aggiustare i permessi;
chmod 600 hostname.key
aprire eventuali porte nel firewall
iptables -A INPUT -p tcp -m tcp --dport 1194 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 1194 -j ACCEPT
riavviare openvpn e settarlo che parta all'avvio (questo dipende dalla distro):
/etc/init.d/openvpn start
Debian/Ubuntu
- in ubuntu spesso l'utente nobody non esiste, crearlo o usarne uno esistente:
adduser nobody groupadd nobody
Client Mac OS/X (intel e non)
scaricare Tunnelblick Universal e installarlo www.tunnelblick.net
copiare il seguente testo in /etc/openvpn/openvpn.conf
client remote porcelinux.gotdns.org 1194 dev tun nobind ca ca.crt port 1194 persist-key persist-tun comp-lzo user nobody group nobody resolv-retry infinite #in queste due linee, cambiare il valore di hostname con il vostro cert hostname.crt key hostname.key
copiare i tre files che vi sono stati inviati nella directory /etc/openvpn/ aggiustare i permesi;
chmod 600 hostname.key
aprire eventuali porte nel firewall
iptables -A INPUT -p tcp -m tcp --dport 1194 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 1194 -j ACCEPT
riavviare openvpn e settarlo che parta all'avvio (questo dipende dalla distro):
/etc/init.d/openvpn start
client rejecting options
- in my case I wanted to skip the dns nameserver setting from my linux client.
push option
Push a config file option back to the client for remote execution. Note that option must be enclosed in double quotes (""). The client must specify --pull in its config file. The set of options which can be pushed is limited by both feasibility and security. Some options such as those which would execute scripts are banned, since they would effectively allow a compromised server to execute arbitrary code on the client. Other options such as TLS or MTU parameters cannot be pushed because the client needs to know them before the connection to the server can be initiated.
This is a partial list of options which can currently be pushed: --route, --route-gateway, --route-delay, --redirect-gateway, --ip-win32, --dhcp-option, --inactive, --ping, --ping-exit, --ping-restart, --setenv, --persist-key, --persist-tun, --echo, --comp-lzo, --socket-flags, --sndbuf, --rcvbuf
push-reset
Don't inherit the global push list for a specific client instance. Specify this option in a client-specific context such as with a --client-config-dir configuration file. This option will ignore --push options at the global config file level.
disable
Disable a particular client (based on the common name) from connecting. Don't use this option to disable a client due to key or password compromise. Use a CRL (certificate revocation list) instead (see the --crl-verify option). This option must be associated with a specific client instance, which means that it must be specified either in a client instance config file using --client-config-dir or dynamically generated using a --client-connect script.
Server
- listare gli ip connessi
grep openvpn /var/log/messages|grep 'ifconfig 10.8.0'|awk '{print $18}'|sort|uniq
oppure
cat /var/log/openvpn-status.log
- route statica per accedere alla VPN dalla rete locale
route add -net 10.8.0.0/24 gw 192.168.82.1