Retrieve VPN client (private) IP address on web server

This forum is for admins who are looking to build or expand their OpenVPN setup.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
gotenks
OpenVpn Newbie
Posts: 4
Joined: Tue Oct 16, 2018 1:39 pm

Retrieve VPN client (private) IP address on web server

Post by gotenks » Tue Oct 16, 2018 2:05 pm

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:

gotenks
OpenVpn Newbie
Posts: 4
Joined: Tue Oct 16, 2018 1:39 pm

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

Post by gotenks » Fri Oct 19, 2018 3:45 pm

Solved using tap instead of tun

Post Reply