I have always had Client Specific Options enabled in the OPenVPN server1. Server2 has always been disabled. BTW, what would be the use of 2 Servers?
In case someone need two servers with different configurations. For instance, you might have one set to redirect Internet access while abroad, and the other only gives you LAN access.
Ok, I can see why it would be useful to have two server instances,
But my reboot earlier today also caused my vpn client routing file to be lost, which was my original problem in this thread.
I have tried to put that 'kaukini' file in /jffs/openvpn/ccd* but after a vpn server restart it is never restored.
I have followed the suggestions of the AIProtection page and changed the root login name from 'admin' to 'rob', but I think I had the same problem before the name change.
As a first try to fix any file permissions problem, I have changed permissions to 660 and see nothing in syslog to suggest what I am doing wrong.
rob@RT-AC68U-7658:/tmp/home/root# ls -l /jffs/openvpn/ccd*
/jffs/openvpn/ccd:
-rw-rw---- 1 rob root 35 Mar 26 16:46 kaukini
/jffs/openvpn/ccd1:
-rw-rw---- 1 rob root 35 Mar 26 16:46 kaukini
rob@RT-AC68U-7658:/tmp/home/root# ls /etc/openvpn/server1/ccd/
rob@RT-AC68U-7658:/tmp/home/root#
Is anyone willing to write a step by step guide to this?
I am trying to have same setup, but I am missing configs and ccd directories (my original post: https://www.snbforums.com/threads/openvpn-site-to-site-problems.37259/ )
Now clients can see server and server can see clients (ping and etc.) but clients can not see each other (server must be blocking them). Any workaround on this? Maybe I should add route on client side for remote client (via server?
Can I give clients different names in Server? (they show up under different usernames in VPN status page, but they both have the same common name - "client"). - can this be an issue?
Any idea about this?
--duplicate-cn
--client-connect
....but there does not seem to be a "FM" out there for this kind of stuff
#!/bin/sh
#=============================================================================
#
# This VPN Server custom script will create a CCD/tmp_file based on 'User names' when they share the same 'Common name' e.g. 'client'
#
# i.e. CCD file '/jffs/configs/openvpn/ccd1/client' is inappropriate for multiple concurrent clients
#
# The remote subnets for each individual User (identified by login credentials) will be defined etc.
#
# e.g. VPN Server 192.168.5.0 will host two clients (each with its own LAN subnet) and all three will communicate with each other over the VPN tunnels
#
# Requires VPN Server directives:
#
# client-to-client
# duplicate-cn
# # Custom Configuration
# client-connect /jffs/scripts/VPNClientConnect.sh
#
logger -st "($(basename $0))" $$ "VPN Client user '"$username"' CCD configuration starting...." [$@]
# Configure the VPN Client CCD/file dynamically
STATUS="OK" # Let's be positive! ;-)
# Identify client
case "$username" in
"clientone")
echo "iroute 192.168.3.0 255.255.255.0" >>$1
;;
"clienttwo")
echo "iroute 192.168.4.0 255.255.255.0" >>$1
;;
*)
STATUS="FAIL"
;;
esac
if [ "$STATUS" == "OK" ];then
logger -st "($(basename $0))" $$ "VPN Client user '"$username"' CCD config:" `cat $1`
else
echo -e "\a"
logger -st "($(basename $0))" $$ "**WARNING VPN Client user '"$username"' not defined - dynamic CCD config skipped."
fi
#Send_email [file | "A_single_line_text_message_in_quotes_to_be_emailed" ] [email_method]
TEMPFILE="/tmp/VPNClientConnect"${username}".txt"
echo "Common Name: $common_name" >>$TEMPFILE
echo "Username: $username" >>$TEMPFILE
echo "I/P: $trusted_ip" >>$TEMPFILE
echo "PORT:$trusted_port" >>$TEMPFILE
echo "MTU: $tun_mtu" >>$TEMPFILE
#Send_email $TEMPFILE
logger -st "($(basename $0))" $$ "VPN Client CCD configuration ended."
exit 0
I get a following message: Initialinzing the settings of OpenVPN server now, please wait a few minutes to let the server to setup completed before VPN clients establish the connection.
an no clients seem to be able to connect.
daemon.err openvpn[20335]: Options error: Unrecognized option or missing or extra parameter(s) in config.ovpn:37: client-connect (2.4.0)
and/or
user.info syslog: VPN_LOG_ERROR: 1506: Starting VPN instance failed
openvpn[5345]: wan.xxx.xxx.xxx TLS: Initial packet from [AF_INET6]::ffff:wan.xxx.xxx.xxx:47257, sid=zzzzzzzz zzzzzzzzz
wan.xxx.xxx.xxx VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC68U, emailAddress=me@myhost.mydomain
wan.xxx.xxx.xxx VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=client, emailAddress=me@myhost.mydomain
wan.xxx.xxx.xxx peer info: IV_VER=2.5_master
wan.xxx.xxx.xxx peer info: IV_PLAT=android
wan.xxx.xxx.xxx peer info: IV_PROTO=2
wan.xxx.xxx.xxx peer info: IV_NCP=2
wan.xxx.xxx.xxx peer info: IV_LZ4=1
wan.xxx.xxx.xxx peer info: IV_LZ4v2=1
wan.xxx.xxx.xxx peer info: IV_LZO=1
wan.xxx.xxx.xxx peer info: IV_COMP_STUB=1
wan.xxx.xxx.xxx peer info: IV_COMP_STUBv2=1
wan.xxx.xxx.xxx peer info: IV_TCPNL=1
wan.xxx.xxx.xxx peer info: IV_GUI_VER=de.blinkt.openvpn_0.6.64
wan.xxx.xxx.xxx PLUGIN_CALL: POST /usr/lib/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=0
wan.xxx.xxx.xxx TLS: Username/Password authentication succeeded for username 'SGS5'
wan.xxx.xxx.xxx Control Channel: TLSv1.2, cipher TLSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 1024 bit RSA
wan.xxx.xxx.xxx [client] Peer Connection Initiated with [AF_INET6]::ffff:wan.xxx.xxx.xxx:47257
wan.xxx.xxx.xxx MULTI_sva: pool returned IPv4=10.188.0.2, IPv6=(Not enabled)
(VPNClientConnect.sh): 6097 VPN Client user 'SGS5' CCD configuration starting.... [/tmp/openvpn_cc_078e278fc86f0c3f396a88b6000df8d8.tmp]
(VPNClientConnect.sh): 6097 VPN Client user 'SGS5' CCD config: iroute 192.168.3.0 255.255.255.0
(VPNClientConnect.sh): 6097 VPN Client CCD configuration ended.
wan.xxx.xxx.xxx OPTIONS IMPORT: reading client specific options from: /tmp/openvpn_cc_078e278fc86f0c3f396a88b6000df8d8.tmp
wan.xxx.xxx.xxx MULTI: Learn: 10.188.0.2 -> client/wan.xxx.xxx.xxx
wan.xxx.xxx.xxx MULTI: primary virtual IP for client/wan.xxx.xxx.xxx: 10.188.0.2
wan.xxx.xxx.xxx MULTI: internal route 192.168.3.0/24 -> client/wan.xxx.xxx.xxx
wan.xxx.xxx.xxx MULTI: Learn: 192.168.3.0/24 -> client/wan.xxx.xxx.xxx
wan.xxx.xxx.xxx REMOVE PUSH ROUTE: 'route 192.168.3.0 255.255.255.0'
wan.xxx.xxx.xxx PUSH: Received control message: 'PUSH_REQUEST'
wan.xxx.xxx.xxx SENT CONTROL [client]: 'PUSH_REPLY,route 10.88.8.0 255.255.255.0,dhcp-option DNS 10.88.8.1,route 192.168.4.0 255.255.255.0,route-gateway 10.188.0.1,topology subnet,ping 15,ping-restart 60,ifconfig 10.188.0.2 255.255.255.0,peer-id 0,cipher AES-128-GCM' (status=1)
wan.xxx.xxx.xxx Data Channel Encrypt: Cipher 'AES-128-GCM' initialized with 128 bit key
Feb 10 07:28:23 openvpn[26646]: OpenVPN 2.4.0 arm-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Feb 3 2017
Feb 10 07:28:23 openvpn[26646]: library versions: OpenSSL 1.0.2k 26 Jan 2017, LZO 2.08
Feb 10 07:28:23 openvpn[26647]: WARNING: using --duplicate-cn and --client-config-dir together is probably not what you want
Feb 10 07:28:23 openvpn[26647]: NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
Feb 10 07:28:23 openvpn[26647]: NOTE: starting with OpenVPN 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables
Feb 10 07:28:23 openvpn[26647]: PLUGIN_INIT: POST /usr/lib/openvpn-plugin-auth-pam.so '[/usr/lib/openvpn-plugin-auth-pam.so] [openvpn]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY
Feb 10 07:28:23 openvpn[26647]: Diffie-Hellman initialized with 2048 bit key
Feb 10 07:28:23 openvpn[26647]: TUN/TAP device tun21 opened
Feb 10 07:28:23 openvpn[26647]: TUN/TAP TX queue length set to 100
Feb 10 07:28:23 openvpn[26647]: do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Feb 10 07:28:23 openvpn[26647]: /usr/sbin/ip link set dev tun21 up mtu 1500
Feb 10 07:28:23 kernel: ADDRCONF(NETDEV_CHANGE): tun21: link becomes ready
Feb 10 07:28:23 openvpn[26647]: /usr/sbin/ip addr add dev tun21 10.8.0.1/24 broadcast 10.8.0.255
Feb 10 07:28:23 openvpn[26647]: /usr/sbin/ip route add 192.168.3.0/24 via 10.8.0.2
Feb 10 07:28:23 openvpn[26647]: /usr/sbin/ip route add 192.168.4.0/24 via 10.8.0.2
Feb 10 07:28:23 openvpn[26647]: Could not determine IPv4/IPv6 protocol. Using AF_INET6
Feb 10 07:28:23 openvpn[26647]: Socket Buffers: R=[122880->122880] S=[122880->122880]
Feb 10 07:28:23 openvpn[26647]: setsockopt(IPV6_V6ONLY=0)
Feb 10 07:28:23 openvpn[26647]: UDPv6 link local (bound): [AF_INET6][undef]:1194
Feb 10 07:28:23 openvpn[26647]: UDPv6 link remote: [AF_UNSPEC]
Feb 10 07:28:23 openvpn[26647]: MULTI: multi_init called, r=256 v=256
Feb 10 07:28:23 openvpn[26647]: IFCONFIG POOL: base=10.8.0.2 size=252, ipv6=0
Feb 10 07:28:23 openvpn[26647]: Initialization Sequence Completed
Bump?
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.0 * 255.255.255.0 U 0 0 0 tun21
192.168.3.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun21
192.168.4.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun21
client-connect /jffs/scripts/VPNClientConnect.sh
Feb 13 20:26:17 openvpn[11644]: OpenVPN 2.4.0 arm-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Feb 3 2017
Feb 13 20:26:17 openvpn[11644]: library versions: OpenSSL 1.0.2k 26 Jan 2017, LZO 2.08
Feb 13 20:26:17 openvpn[11645]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Feb 13 20:26:18 openvpn[11645]: TCP/UDP: Preserving recently used remote address: [AF_INET]rem.ote.ipa.ddr:1194
Feb 13 20:26:18 openvpn[11645]: Socket Buffers: R=[122880->122880] S=[122880->122880]
Feb 13 20:26:18 openvpn[11645]: UDP link local: (not bound)
Feb 13 20:26:18 openvpn[11645]: UDP link remote: [AF_INET]rem.ote.ipa.ddr:1194
Feb 13 20:26:18 openvpn[11645]: TLS: Initial packet from [AF_INET]rem.ote.ipa.ddr:1194, sid=b8c7196a 45243e62
Feb 13 20:26:18 openvpn[11645]: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Feb 13 20:26:19 openvpn[11645]: VERIFY OK: depth=1, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC68U, emailAddress=me@myhost.mydomain
Feb 13 20:26:19 openvpn[11645]: VERIFY OK: nsCertType=SERVER
Feb 13 20:26:19 openvpn[11645]: VERIFY OK: depth=0, C=TW, ST=TW, L=Taipei, O=ASUS, CN=RT-AC68U, emailAddress=me@myhost.mydomain
Feb 13 20:26:19 dnsmasq-dhcp[1044]: DHCPDISCOVER(br0) ma:ca:dd:re:ss:11
Feb 13 20:26:19 dnsmasq-dhcp[1044]: DHCPOFFER(br0) 192.168.3.15 ma:ca:dd:re:ss:11
Feb 13 20:26:19 openvpn[11645]: Control Channel: TLSv1.2, cipher TLSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 1024 bit RSA
Feb 13 20:26:19 openvpn[11645]: [RT-AC68U] Peer Connection Initiated with [AF_INET]rem.ote.ipa.ddr:1194
Feb 13 20:26:20 openvpn[11645]: SENT CONTROL [RT-AC68U]: 'PUSH_REQUEST' (status=1)
Feb 13 20:26:21 openvpn[11645]: AUTH: Received control message: AUTH_FAILED
Feb 13 20:26:21 openvpn[11645]: SIGTERM[soft,auth-failure] received, process exiting
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!