AW: Read Client Hostname

Nikos Mavrogiannopoulos n.mavrogiannopoulos at
Fri Mar 4 08:00:56 PST 2016

On Thu, Mar 3, 2016 at 7:00 PM, Matthias Mandlmeier
<matthias.mandlmeier at> wrote:
> I tested it with the the ocserv-script and added the value $Hostname in it get the Hostname.
> The Line in the ocserv-script now looks like echo "User '$USERNAME' from '$IP_REAL' connected. Local IP is '$IP_REMOTE' Hostname is '$Hostname'" >> /etc/ocserv/test2.txt and output it to a file that I can see the variables. When a client connects I get the following Output "User 'test' from 'X.X.X.X' connected. Local IP is 'X.X.X.X' Hostname is ''" and the Value of the Hostname variable is empty all other variables in the script has the correct value in it. In the debug log I see the correct hostname in this entry HTTP: X-CSTP-Hostname.

You're right, that's indeed an issue. It seems that the hostname
information is only known to ocserv after the user successfully
connects so it cannot forward it to the up-down scripts. Due to a bug
it wasn't even available on occtl (fixed now in master branch). Not
sure what we can do there except document the fact that this variable
is not provided to the up script.


More information about the openconnect-devel mailing list