OpenVPN Admin Tips

From PeerFreedom Wiki
Jump to navigation Jump to search

WebUI

You can set up https://github.com/Chocobozzz/OpenVPN-Admin to have nice WebUI to add new VPN users and provide them config files.

Optional: Disable logging in WebUI

In /etc/openvpn/scripts/connect.sh comment out or delete:

# We insert data in the log table
#mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "INSERT INTO log (log_id, user_id, log_trusted_ip, log_trusted_port, log_remote_ip, log_remote_port, log_start_time, log_end_time, log_received, log_send) VALUES(NULL, '$common_name','$trusted_ip', '$trusted_port','$ifconfig_pool_remote_ip', '$remote_port_1', now(),NULL, '$bytes_received', '$bytes_sent')"

# We specify that the user is online
#mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE user SET user_online=1 WHERE user_id='$common_name'"

And in /etc/openvpn/scripts/disconnect.sh comment out:

# We specify the user is offline
#mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE user SET user_online=0 WHERE user_id='$common_name'"

# We insert the deconnection datetime
#mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -e "UPDATE log SET log_end_time=now(), log_received='$bytes_received', log_send='$bytes_sent' WHERE log_trusted_ip='$trusted_ip' AND log_trusted_port='$trusted_port' AND user_id='$common_name' AND log_end_time IS NULL"