chantra/openvpn-mysql-auth — Issue #3: connect and disconnect query
Author: wrekwired
Created: 2011-10-13 04:51:56+00:00
State: open

Hi, i'm having problem with my connect and disconnect query. Authentication and user access verification is fine but user connect and disconnect query is not called even if i use the example config and mysql dumps.

here is my mysql-auth.conf

hostname localhost
login root
password pass
db vpn_db
port 0
default_pf_rules_clients ACCEPT
default_pf_rules_subnets ACCEPT

auth_user_pass_verify_query SELECT id FROM users WHERE username='{{escaped_username}}' AND password=SHA1('{{escaped_password}}')

auth_user_pass_verify_user_access_query SELECT id FROM users WHERE users.id ={{user_id}} AND users.active=0 AND users.enabled=1

client_connect_query UPDATE users SET start_time=NOW(), active=1, protocol='{{proto_1}}', trusted_ip='{{trusted_ip}}', trusted_port={{trusted_port}} WHERE id={{user_id}}

client_disconnect_query UPDATE users SET end_time=NOW(), active=0, bytes_sent={{bytes_sent}}, bytes_received={{bytes_received}} WHERE id={{user_id}}

connect and disconnect query only updates one table and does not insert new data.

another question. is it possible to have 2 connect and disconnect query like one client_connect_query to set active=1 making user status online and insert data for user log? same as client_disconnect_query where active is set to 0 and update user log.

Thanks!