added basic MySQL support for matching a token with an IP:PORT

The new command line option --sql-target-config     lets you specify  a file that looks like:

db=YOURDB
user=YOURUSER
passwd=YOURPASS
match_query=YOURQUERY

When someone connects to the proxy it will make a database connetion and run the query you specify to validate the users token.
the query should return 0 rows if the token is invalid, or return a row where the first column has the IP:Port
This commit is contained in:
Joe Huss 2013-08-05 13:59:30 -04:00
parent 292f6a5da7
commit 1277650122
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
#MySQL Configuration File
#
# database connection settings
db=YOURDB
user=YOURUSER
passwd=YOURPASS
# query to validate the token
# _TOKEN_ will be replaced with the token
# should return 0 rows if the token does not match,
# and the first field should be the IP:Port they are authenticated to connect to
match_query=select as_data, substr(as_data, 1, locate(':',as_data) - 1) as ip, substr(as_data, locate(':',as_data)+1) as port from appsession where concat(as_sid,'_',as_location)='_TOKEN_'