sqlauth for 3proxy
Untested alfa version, use at your own risk.
- *nix, gcc with c99 support
- mysql, postgre or sqlite database with text usernames and passwords
- libzdb-dev
sudo apt-get install libzdb-dev
git clone https://github.com/z3APA3A/3proxy.git
cd 3proxy/src/plugins
git clone https://github.com/gouranga/sqlauth.git
cd ../../
cp Makefile.Linux Makefile.Linux.bak
sed '/^PLUGINS =/ s/$/ sqlauth/' Makefile.Linux.bak > Makefile.Linux
make -f Makefile.Linux
- Load plugin in config
plugin "/path/to/sqlauth.ld.so" load [debug]
debug
parameter is optional
- Setup SQL options
sqlopts max_connections INT
sqlopts connection_timeout INT
sqlopts sweep_interval INT
sqlopts dsn "<protocol>://<authority><path>?<query>"
sqlopts query "SELECT `password` FROM `auth` WHERE `username` = ? LIMIT 1"
max_connections
max connections within the poolconnection_timeout
connection inactive timeout in secondssweep_interval
number of seconds between sweeps of the reaper threaddsn
data source name in libzdb formatquery
prepared select statement with 1 parameter (username) and 1 result column with password
For example, with MySQL table auth
in database users
:
CREATE TABLE `auth` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NULL DEFAULT NULL,
`password` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `username` (`username`)
)
COLLATE='utf8_general_ci' ENGINE=InnoDB;
You can setup like this
sqlopts max_connections 25
sqlopts connection_timeout 10
sqlopts sweep_interval 10
sqlopts dsn "mysql://localhost:3306/users?charset=utf8&user=USERNAME&password=PASSWORD"
sqlopts query "SELECT `password` FROM `auth` WHERE `username` = ? LIMIT 1"
- Start the pool
sqlconnect
- Set up authcache and method.
authcache user,password 300
auth cache strong sqlauth
If you don't change passwords frequently you can setup higher cache time.
- Run 3proxy and enjoy!
MIT