I am having issues getting TLS working. Initially I had an Bridged + OpenLDAP setup. I got that working after a bit of a rough patch with some networking issues. Here are my configs
Server config:
port 1194
proto tcp
dev tap0
mode server
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
ifconfig-pool-persist ipp.txt
server-bridge 192.168.101.14 255.255.255.0 192.168.101.223 192.168.101.253
push "dhcp-option DNS 192.168.101.17"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
duplicate-cn
keepalive 10 60
tls-auth ta.key 0
cipher BF-CBC
comp-lzo
user nobody
group nobody
persist-key
persist-tun
log /var/log/openvpn.log
verb 5
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-ldap.so "/etc/openvpn/auth/ldap.conf"
client-cert-not-required
Client config:
client
dev tap0
proto tcp
remote 38..xx.yy.zzz
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
#cert client.crt
#key client.key
#ns-cert-type server
tls-auth ta.key 1
comp-lzo
cipher BF-CBC
verb 6
auth-user-pass
I double checked that both ta.keys and ca.crt on the server/client have the same MD5 so they're definitely the same files. Here's what happens when I try and connect.
Server:
Mon Jun 25 14:12:25 2012 us=571309 146.xx.yy.zz:50467 TLS: Initial packet from 146.115.xx.yy:50467, sid=e23feba0 7a0ff0d1
Mon Jun 25 14:12:25 2012 us=571335 146.xx.yy.zz:50467 Authenticate/Decrypt packet error: packet HMAC authentication failed
Mon Jun 25 14:12:25 2012 us=571354 146.xx.yy.zz:50467 TLS Error: incoming packet authentication failed from 146.115.xx.yy:50467
Mon Jun 25 14:12:25 2012 us=571515 146.xx.yy.zz:50467 Fatal TLS error (check_tls_errors_co), restarting
Client:
Wed Jun 27 08:29:21 2012 us=704000 Control Channel Authentication: tls-auth using INLINE static key file
Wed Jun 27 08:29:21 2012 us=704000 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed Jun 27 08:29:21 2012 us=704000 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed Jun 27 08:29:21 2012 us=704000 LZO compression initialized
Wed Jun 27 08:29:21 2012 us=704000 Control Channel MTU parms [ L:1576 D:168 EF:68 EB:0 ET:0 EL:0 ]
Wed Jun 27 08:29:21 2012 us=704000 Socket Buffers: R=[8192->8192] S=[8192->8192]
Wed Jun 27 08:29:21 2012 us=704000 Data Channel MTU parms [ L:1576 D:1450 EF:44 EB:135 ET:32 EL:0 AF:3/1 ]
Wed Jun 27 08:29:21 2012 us=704000 Local Options String: 'V4,dev-type tap,link-mtu 1576,tun-mtu 1532,proto TCPv4_CLIENT,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-client'
Wed Jun 27 08:29:21 2012 us=704000 Expected Remote Options String: 'V4,dev-type tap,link-mtu 1576,tun-mtu 1532,proto TCPv4_SERVER,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-server'
Wed Jun 27 08:29:21 2012 us=704000 Local Options hash (VER=V4): '2259a6dc'
Wed Jun 27 08:29:21 2012 us=704000 Expected Remote Options hash (VER=V4): '692eb0f5'
Wed Jun 27 08:29:21 2012 us=704000 Attempting to establish TCP connection with 38.xx.yy.zz:1194
Wed Jun 27 08:29:21 2012 us=704000 MANAGEMENT: >STATE:1340800161,TCP_CONNECT,,,
Wed Jun 27 08:29:21 2012 us=736000 TCP connection established with 38.xx.yy.zz:1194
Wed Jun 27 08:29:21 2012 us=736000 TCPv4_CLIENT link local: [undef]
Wed Jun 27 08:29:21 2012 us=736000 TCPv4_CLIENT link remote: 38.xx.yy.zz:1194
Wed Jun 27 08:29:21 2012 us=736000 MANAGEMENT: >STATE:1340800161,WAIT,,,
Wed Jun 27 08:29:21 2012 us=736000 TCPv4_CLIENT WRITE [42] to 38.xx.yy.zz:1194: P_CONTROL_HARD_RESET_CLIENT_V2 kid=0 pid=[ #1 ] [ ] pid=0 DATA len=0
Wed Jun 27 08:29:21 2012 us=751000 Connection reset, restarting [0]
Wed Jun 27 08:29:21 2012 us=751000 TCP/UDP: Closing socket
From Googling it would seem that either the keys are mismatched, there is network corruption, or the port numbers are messed up. I've also tried the configs without ciphers but the problem persists. Any thoughts? Maybe I should ask a more simple question: can I not use a combination of the LDAP auth with TLS?