Linux – QNAP TS-419 QTS 4.1.2 Using OpenVPN to Connect as a VPN Client

linuxnetwork-attached-storageopenvpnqnap

I'm following up on a similar user request:
QNAP TS-419p as a VPN Gateway?

I have a QNAP TS-419 II, with Firmware 4.1.2.
I have a VPN service provider than uses OpenVPN to connect to their VPN services.
Within the files given I have a ca.crt, myUser.crt, myUser.key, and a bunch of opvn configuration files for proxied or fully routed vpn connections.

I have rather followed these instructions:
http://support.purevpn.com/qnap-nas-qts-4-x-openvpn-setup-guide

When I click connect and failed after a few minutes. The following are the output within the log:

Sun Aug  9 00:40:02 2015 OpenVPN 2.2.1-8+deb7u3 arm-none-linux-gnueabi [SSL] [LZO2] [EPOLL] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Aug  4 2015
Sun Aug  9 00:40:02 2015 WARNING: file '/share/MD0_DATA/Download/vpn/pass1.txt' is group or others accessible
Sun Aug  9 00:40:02 2015 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Sun Aug  9 00:40:02 2015 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sun Aug  9 00:40:02 2015 WARNING: file '/share/MD0_DATA/Download/vpn/vpn.key' is group or others accessible
Sun Aug  9 00:40:02 2015 Control Channel Authentication: using '/share/MD0_DATA/Download/vpn/vpn.key' as a free-form passphrase file
Sun Aug  9 00:40:02 2015 Key file '/share/MD0_DATA/Download/vpn/vpn.key' used in --tls-auth contains insufficient key material [keys found=1 required=2] -- try generating a new key file with 'openvpn --genkey --secret [file]', or use the existing key file in bidirectional mode by specifying --tls-auth without a key direction parameter

For the Warnings, I understand it is a file permission issue, can someone tell me what it should be?

For the Note and OpenVPN security suggestion, does anyone know what I am suppose to do from that point on to get it working properly?

My Client configuration file:

client
dev tun
proto tcp
tls-client
remote <remote IP> 80
persist-key
persist-tun
ca /share/MD0_DATA/Download/vpn/ca.crt
tls-auth /share/MD0_DATA/Download/vpn/key.key
cert /share/MD0_DATA/Download/vpn/cert.crt
cipher AES-256-CBC
comp-lzo
auth-user-pass /share/MD0_DATA/Download/vpn/pass1.txt
auth-retry interact
script-security 3
log-append /share/MD0_DATA/Download/vpn/openvpn.log
verb 3
mute 20
keepalive 10 60
writepid /var/run/openvpn.client.pid
up /etc/openvpn/openvpn_up
down /etc/openvpn/openvpn_down
explicit-exit-notify 2
ifconfig-nowarn
auth-nocache

Best Answer

As per the first warning, you should add ns-cert-type server to your client config [OpenVPN Manual][1]

As per the last line, you need to regenerate one of your keys, or change your config:

  1. openvpn --genkey --secret /share/MD0_DATA/Download/vpn/vpn.key ; or

  2. Remove the number from behind --tls-auth in your client config.

You need to then remove Group and Other rights from the 2 keyfiles:

chmod go= /share/MD0_DATA/Download/vpn/pass1.txt ;

chmod go= /share/MD0_DATA/Download/vpn/vpn.key ;

That will take care of "group or others accessible"

[1][https://openvpn.net/index.php/open-source/documentation/howto.html#mitm]

By the way, this is more-or-less a dupe of https://unix.stackexchange.com/questions/57798/openvpn-warning-no-server-certificate-verification-method-has-been-enabled