Problem with OpenVPN and FreeNAS 11 - where did I make a mistake?

Status
Not open for further replies.

Xaint

Dabbler
Joined
Jan 17, 2018
Messages
10
<div class="bbWrapper">Hi,<br /> <br /> Recently I use this guide to install OpenVPN insiede a jail --&gt; <a href="https://forums.freenas.org/index.php?threads/how-to-install-openvpn-inside-a-jail-in-freenas-9-2-1-6-with-access-to-remote-hosts-via-nat.22873/" target="_blank" class="link link--external" rel="nofollow ugc noopener">https://forums.freenas.org/index.ph...-6-with-access-to-remote-hosts-via-nat.22873/</a><br /> I don't see why I can't connect from my PC to my VPN. Could you help me please?<br /> <br /> My setup:<br /> Modem: 192.168.1.254<br /> FreeNAS: 192.168.1.70<br /> OpenVPN Jail: 192.168.1.69<br /> My PC: 192.168.1.65<br /> <br /> My <tt style="color: #007a00;">openvpn.conf</tt> file<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> port 10011 proto udp dev tun ca ca.crt cert openvpn-server.crt #Server public key key openvpn-server.key #Server private key dh dh.pem #Diffie-Hellman parameters server 172.16.8.0 255.255.255.0 #Purple network ifconfig-pool-persist ipp.txt push &quot;route 192.168.1.0 255.255.255.0&quot; #Yellow network tls-auth ta.key 0 #crl-verify crl.pem keepalive 10 120 cipher AES-256-CBC auth SHA256 group nobody user nobody comp-lzo persist-key persist-tun verb 3 </pre></div><br /> <br /> My <tt style="color: #007a00;">ipfw.rules</tt> file<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> !/bin/sh EPAIR=$(/sbin/ifconfig -l | tr &quot; &quot; &quot;\n&quot; | /usr/bin/grep epair) ipfw -q -f flush ipfw -q nat 1 config if ${EPAIR} ipfw -q add nat 1 all from 172.16.8.0/24 to any out via ${EPAIR} ipfw -q add nat 1 all from any to any in via ${EPAIR} TUN=$(/sbin/ifconfig -l | tr &quot; &quot; &quot;\n&quot; | /usr/bin/grep tun) ifconfig ${TUN} name tun0 </pre></div><br /> <br /> My client config for OpenVPN<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> client dev tun proto udp remote 2.xxx.xx.xxx 443 resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert myname.crt key myname.key remote-cert-tls server cipher AES-256-CBC tls-auth ta.key 1 dhcp-option DNS 192.168.1.254 redirect-gateway def1 comp-lzo verb 3 </pre></div><br /> <br /> ---------------------------------------------------------------------------<br /> <br /> If I check <code style="background-color: #dee3e7; padding: .2px; margin: .1em; display: inline-block;"> <kbd>ipfw list</kbd></code><br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> 00100 nat 1 ip from 172.16.8.0/24 to any out via epair0b 00200 nat 1 ip from any to any in via epair0b 65535 allow ip from any to any </pre></div><br /> <br /> and <code style="background-color: #dee3e7; padding: .2px; margin: .1em; display: inline-block;"> <kbd>sockstat -4 -l</kbd></code><br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS nobody openvpn 54714 6 udp46 *:10011 *:* root syslogd 54675 7 udp4 *:514 *:* </pre></div><br /> <br /> <code style="background-color: #dee3e7; padding: .2px; margin: .1em; display: inline-block;"> <kbd>ps aux</kbd></code><br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> root 53571 0.0 0.0 10592 1832 - IsJ 16:22 0:00.00 dhclient: epair0b [priv] (dhclient) _dhcp 53636 0.0 0.0 10592 1872 - IsJ 16:22 0:00.00 dhclient: epair0b (dhclient) root 54675 0.0 0.0 10472 1880 - IsJ 16:22 0:00.01 /usr/sbin/syslogd -s nobody 54714 0.0 0.0 20412 4052 - SsJ 16:22 0:00.01 /usr/local/sbin/openvpn --cd /mnt/keys --daemon openvpn --config /mnt/keys/openvpn.conf --writepid /var/run/openvpn.pid root 54746 0.0 0.0 12564 1792 - IsJ 16:22 0:00.00 /usr/sbin/cron -s root 56138 0.0 0.0 13972 2892 0 SJ 16:54 0:00.01 bash root 57792 0.0 0.0 21244 1964 0 R+J 17:26 0:00.00 ps aux </pre></div><br /> <br /> ------------------------------------------------------------------------------<br /> My Router fw<br /> <script class="js-extraPhrases" type="application/json"> { "lightbox_close": "Close", "lightbox_next": "Next", "lightbox_previous": "Previous", "lightbox_error": "The requested content cannot be loaded. Please try again later.", "lightbox_start_slideshow": "Start slideshow", "lightbox_stop_slideshow": "Stop slideshow", "lightbox_full_screen": "Full screen", "lightbox_thumbnails": "Thumbnails", "lightbox_download": "Download", "lightbox_share": "Share", "lightbox_zoom": "Zoom", "lightbox_new_window": "New window", "lightbox_toggle_sidebar": "Toggle sidebar" } </script> <div class="bbImageWrapper js-lbImage" title="w8rh9w.png" data-src="http://i64.tinypic.com/w8rh9w.png" data-lb-sidebar-href="" data-lb-caption-extra-html="" data-single-image="1"> <img src="http://i64.tinypic.com/w8rh9w.png" data-url="http://i64.tinypic.com/w8rh9w.png" class="bbImage" data-zoom-target="1" style="" alt="w8rh9w.png" title="" width="" height="" loading="lazy" /> </div> <br /> <br /> And my OpenVPN log error:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> Thu Feb 01 17:03:48 2018 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Feb 01 17:03:48 2018 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication Thu Feb 01 17:03:48 2018 TCP/UDP: Preserving recently used remote address: [AF_INET]2.xxx.xx.xxx:443 Thu Feb 01 17:03:48 2018 Socket Buffers: R=[65536-&gt;65536] S=[65536-&gt;65536] Thu Feb 01 17:03:48 2018 UDP link local: (not bound) Thu Feb 01 17:03:48 2018 UDP link remote: [AF_INET]2.xxx.xx.xxx:443 Thu Feb 01 17:03:48 2018 MANAGEMENT: &gt;STATE:1517501028,WAIT,,,,,, Thu Feb 01 17:04:48 2018 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity) Thu Feb 01 17:04:48 2018 TLS Error: TLS handshake failed Thu Feb 01 17:04:48 2018 SIGUSR1[soft,tls-error] received, process restarting </pre></div><br /> ---------------------------------------------------------------------------------<br /> If you have some ideas... please help me :)</div>
 
Last edited by a moderator:

Gabi

Dabbler
Joined
Jul 21, 2016
Messages
12
<div class="bbWrapper">Hi, I faced a similar issue a few months ago. Try to remove the comments in the openvpn.conf and restart the service. Other than that, your config seems correct. That guide is a bit tricky though and quite old. Oh, and I hope you are not keeping your keys in the server or the jail. Good luck, let me know if there's some improvement.</div>
 

Xaint

Dabbler
Joined
Jan 17, 2018
Messages
10
<div class="bbWrapper"><blockquote data-attributes="member: 61840" data-quote="Gabi" data-source="post: 435444" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=435444" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-435444">Gabi said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> Hi, I faced a similar issue a few months ago. Try to remove the comments in the openvpn.conf and restart the service. Other than that, your config seems correct. That guide is a bit tricky though and quite old. Oh, and I hope you are not keeping your keys in the server or the jail. Good luck, let me know if there's some improvement. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote>The first problem was that I have to specify the keys directory. Now I have to do this in openvpn.conf<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> ... ca /mnt/keys/ca.crt cert /mnt/keys/openvpn-server.crt #Server public key key /mnt/keys/openvpn-server.key #Server private key dh /mnt/keys/dh.pem #Diffie-Hellman parameters ... tls-auth /mnt/keys/ta.key 0 </pre></div><br /> <br /> &quot;I hope you are not keeping your keys in the server or the jail&quot; you mean the personal keys? Or other?</div>
 

joebad1

Explorer
Joined
Nov 21, 2015
Messages
58
<div class="bbWrapper">Same errors on my part. Similar set-up as yours. Same TLS handshake negotiation failed error</div>
 

joebad1

Explorer
Joined
Nov 21, 2015
Messages
58
<div class="bbWrapper"><blockquote data-attributes="member: 82275" data-quote="Xaint" data-source="post: 436115" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=436115" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-436115">Xaint said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> The first problem was that I have to specify the keys directory. Now I have to do this in openvpn.conf<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> ... ca /mnt/keys/ca.crt cert /mnt/keys/openvpn-server.crt #Server public key key /mnt/keys/openvpn-server.key #Server private key dh /mnt/keys/dh.pem #Diffie-Hellman parameters ... tls-auth /mnt/keys/ta.key 0 </pre></div><br /> <br /> &quot;I hope you are not keeping your keys in the server or the jail&quot; you mean the personal keys? Or other? </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote><br /> <br /> Found this on the wiki.archlinux.org OpenVPN website last night. I haven't had a chance to try it, but you might give these two items a try:<br /> 1) &quot;tls-crypt ta.key&quot; replaces &quot;tls-auth ta.key 0&quot; (make sure you replace it in both the server and client)<br /> 2) Due to a bug in OpenVPN 2.4.0, &quot;persist-tun&quot; should NOT be used.<br /> <br /> I won't be able to get to my server work until late tonight. If you get a chance to try it, let me know if it works!!!</div>
 

joebad1

Explorer
Joined
Nov 21, 2015
Messages
58
<div class="bbWrapper">Tried it tonight. Neither of those fixes worked for me.</div>
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
<div class="bbWrapper">Did you rebooted your FreeNAS server after configuring everything? I struggled to get OpenVPN running in a jail, but after a reboot it all worked fine.</div>
 

captainkent

Dabbler
Joined
Nov 12, 2016
Messages
10
<div class="bbWrapper">I would suggest to use SoftEther, VPN speed is a lot faster and it is much easier to set up. You can even serve OpenVPN through it if you would prefer.</div>
 

Xaint

Dabbler
Joined
Jan 17, 2018
Messages
10
<div class="bbWrapper"><blockquote data-attributes="member: 54427" data-quote="joebad1" data-source="post: 436666" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-title"> <a href="/community/goto/post?id=436666" class="bbCodeBlock-sourceJump" rel="nofollow" data-xf-click="attribution" data-content-selector="#post-436666">joebad1 said:</a> </div> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> Tried it tonight. Neither of those fixes worked for me. </div> <div class="bbCodeBlock-expandLink js-expandLink"><a role="button" tabindex="0">Click to expand...</a></div> </div> </blockquote>I follow another guide and works for me! <br /> <a href="https://www.kirkg.us/posts/running-an-openvpn-server-in-a-freenas-910-jail/" target="_blank" class="link link--external" rel="nofollow ugc noopener">https://www.kirkg.us/posts/running-an-openvpn-server-in-a-freenas-910-jail/</a></div>
 

joebad1

Explorer
Joined
Nov 21, 2015
Messages
58
<div class="bbWrapper">Found this new post by Bibi40k. It worked perfectly:<br /> <br /> <a href="https://forums.freenas.org/index.php?posts/440783/" target="_blank" class="link link--external" rel="nofollow ugc noopener">https://forums.freenas.org/index.php?posts/440783/</a></div>
 

gsrcrxsi

Explorer
Joined
Apr 15, 2018
Messages
86
<div class="bbWrapper">i'm having the same problem as OP. gettng the TLS-auth timeout. <br /> <br /> i followed the guides in both previous posts with no solution. <br /> <br /> current setup: <br /> <br /> I have a Netgear router. LAN address is 192.168.1.0, router at 192.168.1.1<br /> PiHole VM running on FreeNAS at 192.168.1.250, PiHole getting DNS from 1.1.1.1 and 1.0.0.1<br /> Netgear router getting DNS from PiHole at 192.168.1.250, with a backup of 1.1.1.1 (this gives me whole home ad blocking)<br /> Netgear router forwarding internal and external port 1194 to 192.168.1.117 (im not sure why this guide has different ports between server/client, other guides have them the same, can someone explain why?)<br /> OpenVPN jail running at 192.168.1.117<br /> <br /> openvpn server config &quot;openvpn.conf @ /usr/local/etc/openvpn/&quot;:<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> local 192.168.1.117 port 1194 proto udp dev tun ca /usr/local/etc/openvpn/keys/ca.crt cert /usr/local/etc/openvpn/keys/openvpn-server.crt key /usr/local/etc/openvpn/keys/openvpn-server.key dh /usr/local/etc/openvpn/keys/dh.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt push &quot;route 192.168.1.0 255.255.255.0&quot; push &quot;dhcp-option DNS 192.168.1.250&quot; #do i need this line? i thought since pihole is my DNS that i would, please advise ;push &quot;dhcp-option DNS 1.1.1.1&quot; keepalive 10 120 tls-auth /usr/local/etc/openvpn/keys/ta.key 0 remote-cert-tls client cipher AES-256-CBC comp-lzo user nobody group nobody persist-key persist-tun status openvpn-status.log verb 3 explicit-exit-notify 1 </pre></div><br /> <br /> rc.conf @ /etc/<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> portmap_enable=&quot;NO&quot; sshd_enable=&quot;NO&quot; sendmail_enable=&quot;NO&quot; sendmail_submit_enable=&quot;NO&quot; sendmail_outbound_enable=&quot;NO&quot; sendmail_msp_queue_enable=&quot;NO&quot; hostname=&quot;OpenVPN&quot; devfs_enable=&quot;YES&quot; devfs_system_ruleset=&quot;devfsrules_common&quot; inet6_enable=&quot;YES&quot; ip6addrctl_enable=&quot;YES&quot; openvpn_enable=&quot;YES&quot; openvpn_if=&quot;tun&quot; openvpn_configfile=&quot;/usr/local/etc/openvpn/openvpn.conf&quot; openvpn_dir=&quot;/usr/local/etc/openvpn/&quot; cloned_interfaces=&quot;tun&quot; gateway_enable=&quot;YES&quot; firewall_enable=&quot;YES&quot; firewall_script=&quot;/usr/local/etc/ipfw.rules&quot; </pre></div><br /> <br /> ipfw.rules @ /usr/local/etc/<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> #!/bin/sh ipfw -q -f flush ipfw -q nat 1 config if epair2b ipfw -q add nat 1 all from 10.8.0.0/24 to any out via epair2b ipfw -q add nat 1 all from any to any in via epair2b TUN=$(/sbin/ifconfig -l | tr &quot; &quot; &quot;/n&quot; | /usr/bin/grep tun) ifconfig ${TUN} name tun0 </pre></div><br /> <br /> output of command &quot;/sbin/ifconfig -l | tr &quot; &quot; &quot;/n&quot; | /usr/bin/grep tun&quot;<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> # /sbin/ifconfig -l | tr &quot; &quot; &quot;/n&quot; | /usr/bin/grep tun lo0/epair2b/tun5 </pre></div><br /> <br /> output of command &quot;ipfw list&quot;<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> # ipfw list 00100 nat 1 ip from 10.8.0.0/24 to any out via epair2b 00200 nat 1 ip from any to any in via epair2b 65535 allow ip from any to any </pre></div><br /> <br /> output of command &quot;sockstat -4 -l&quot;<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> # sockstat -4 -l USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root syslogd 25305 7 udp4 *:514 *:* </pre></div><br /> it does not show openvpn here. but i do not know why. <br /> <br /> Client config on Windows 10 machine &quot;Xinyi.conf @ C:\Users\Ian\OpenVPN\config\client&quot;<br /> ca.crt, ta.key, Xinyi.crt, Xinyi.key are also in this directory<br /> <div class="bbCodeBlock bbCodeCode"><div class="type">Code:</div><pre> client dev tun proto udp remote 192.168.1.117 1194 # i know this is the local IP, i was trying to connect from within the network as a test, still doesnt work with the outside IP added here resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert Xinyi.crt key Xinyi.key remote-cert-tls server tls-auth ta.key 1 cipher AES-256-CBC comp-lzo verb 3 </pre></div></div>
 
Status
Not open for further replies.
Top