OpenVPN TLS HandShake falhou com o cliente Linux Server / Windows

1

Eu comprei recentemente um Odroid C2 com o sistema operacional Ubuntu 16.04. Eu instalei o OpenVPN para ter acesso de qualquer lugar à minha rede doméstica. Eu tenho pastas de compartilhamento do Samba ...

Eu segui este tutorial: link

Eu tenho problemas de TLS quando tento conectar meu cliente do Windows 10 ao servidor com a GUI do OpenVPN para Windows.

TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
TLS Error: TLS handshake failed

Log da GUI do OpenVPN:

Fri Jun 10 22:56:35 2016 OpenVPN 2.3.11 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on May 10 2016
Fri Jun 10 22:56:35 2016 Windows version 6.2 (Windows 8 or greater) 64bit
Fri Jun 10 22:56:35 2016 library versions: OpenSSL 1.0.1t  3 May 2016, LZO 2.09
Fri Jun 10 22:56:35 2016 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Fri Jun 10 22:56:35 2016 Need hold release from management interface, waiting...
Fri Jun 10 22:56:36 2016 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Fri Jun 10 22:56:36 2016 MANAGEMENT: CMD 'state on'
Fri Jun 10 22:56:36 2016 MANAGEMENT: CMD 'log all on'
Fri Jun 10 22:56:36 2016 MANAGEMENT: CMD 'hold off'
Fri Jun 10 22:56:36 2016 MANAGEMENT: CMD 'hold release'
Fri Jun 10 22:56:36 2016 Control Channel Authentication: tls-auth using INLINE static key file
Fri Jun 10 22:56:36 2016 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jun 10 22:56:36 2016 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jun 10 22:56:36 2016 Socket Buffers: R=[65536->65536] S=[65536->65536]
Fri Jun 10 22:56:36 2016 UDPv4 link local: [undef]
Fri Jun 10 22:56:36 2016 UDPv4 link remote: [AF_INET](My address IP):1194
Fri Jun 10 22:56:36 2016 MANAGEMENT: >STATE:1465613796,WAIT,,,
Fri Jun 10 22:57:36 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Fri Jun 10 22:57:36 2016 TLS Error: TLS handshake failed
Fri Jun 10 22:57:36 2016 SIGUSR1[soft,tls-error] received, process restarting
Fri Jun 10 22:57:36 2016 MANAGEMENT: >STATE:1465613856,RECONNECTING,tls-error,,
Fri Jun 10 22:57:36 2016 Restart pause, 2 second(s)
Fri Jun 10 22:57:38 2016 Socket Buffers: R=[65536->65536] S=[65536->65536]
Fri Jun 10 22:57:38 2016 UDPv4 link local: [undef]
Fri Jun 10 22:57:38 2016 UDPv4 link remote: [AF_INET] (My address IP):1194
Fri Jun 10 22:57:38 2016 MANAGEMENT: >STATE:1465613858,WAIT,,,

Minha configuração de cliente (arquivo .ovpn) sem o texto no comentário:

client
dev tun
proto udp
remote (My address IP) 1194
resolv-retry infinite
nobind
persist-tun
remote-cert-tls server
comp-lzo
verb 3
key-direction 1

(The ca.crt, the client.crt and the client.key files are include in the ovpn file)

Minha configuração do servidor (server.conf) sem o texto no comentário:

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
tls-auth ta.key 0
key-direction 0
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

No meu roteador eu configurei o Port Forwarding para a porta 1194 com o endereço IP do Odroid: veja a foto

Eu também tento o protocolo TCP, mas repito a conexão a cada 5 segundos.

Você pode me ajudar por favor! :)

    
por Julien D. 11.06.2016 / 05:30

1 resposta

1

Se você tiver certeza de que está se conectando ao endereço IP público correto, o firewall Ubuntus pode estar bloqueando a conexão. O OpenVPN funciona para mim com as seguintes regras:

iptables -A INPUT -i eth0 -p udp -m state --state NEW -m udp --dport 1194 -j ACCEPT
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A OUTPUT -o tun+ -j ACCEPT

E claro, é preciso salvar as regras. Iptables-persistent é uma boa ferramenta para isso:

sudo apt-get install iptables-persistent

Depois de instalado, você pode salvar / recarregar as regras do iptables a qualquer momento:

sudo /etc/init.d/iptables-persistent save 
sudo /etc/init.d/iptables-persistent reload

Para solucionar problemas adicionais, você pode monitorar o tráfego do lado do servidor para ver se algo está atingindo a porta 1194:

sudo apt-get-install ngrep
ngrep port 1194

Boa sorte

    
por Taavi 13.06.2016 / 10:36