This is a script which adds current OpenVPN clients to a hosts file, in order to resolve them via DNS.
FeaturesThe vpnhost script comes with the following features:
creation and deletion of hosts file entries for connected clients custom file location configurable hostnames for clients execution of custom commands The command execution can be used to trigger automatic updating of your DNS server after the new hosts has been written. Integration for dnsmasq is provided in the package.
InstallationDownload the latest version of the script. Extract it, and move at minimum the file vpnhost.py to a location that can be accessed by your openvpn server (for a standard setup, this would be /etc/openvpn/vpnhost.py).
If you are using the dnsmasq DNS server, you might want to move the vpnhost-dnsmasq.sh script to the same location.
Make sure that the openvpn process that will be calling vpnhost can execute the vpnhost.py script and any scripts launched consecutively. Also, the process has to have write permissions for the hosts file you are going to use.
ConfigurationOpen the vpnhost.py script with your favorite editor, and change the settings at the top of the file. For reference, see the configuration wiki page.
If you are using the vpnhost-dnsmasq.sh script, you might have to edit it in order to specify the pidfile you are using.
Changelog24. Jul. 2009: initial version