Page 1 of 1

Retrieve VPN client (private) IP address on web server

Posted: Tue Oct 16, 2018 2:05 pm
by gotenks
We are using OpenVPN to assign static IP addresses to clients based on their Common Name.

The server IP where OpenVPN is installed is using static IP address 192.168.1.240 (network 192.168.1.0/24).

OpenVPN running with this configuration, creating a network 192.168.255.0/24.

Server Config
server 192.168.255.0 255.255.255.0
verb 3
key /etc/openvpn/pki/private/xxx.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/xxxx.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun

proto udp
port 1194
dev tun0
status /tmp/openvpn-status.log

user nobody
group nogroup
comp-lzo no

push "block-outside-dns"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "comp-lzo no"


We are running Apache on 192.168.1.10. Is it possible for Apache to retrieve the IP address of the client connected to the VPN?

With the current configuration it shows the IP of the server on which OpenVPN is running:

Code: Select all

[SERVER_NAME] => 192.168.1.10
[SERVER_ADDR] => 192.168.1.10
[REMOTE_ADDR] => 192.168.1.240
Not sure this is possible with the current configuration, not a networking guru. :roll:

Re: Retrieve VPN client (private) IP address on web server

Posted: Fri Oct 19, 2018 3:45 pm
by gotenks
Solved using tap instead of tun