Skip to content

gouranga/sqlauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlauth for 3proxy

Untested alfa version, use at your own risk.

Requirements

  • *nix, gcc with c99 support
  • mysql, postgre or sqlite database with text usernames and passwords
  • libzdb-dev

How to compile

Debian / Ubuntu / deb-based

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

How to use

  1. Load plugin in config
plugin "/path/to/sqlauth.ld.so" load [debug]

debug parameter is optional

  1. 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"

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"
  1. Start the pool
sqlconnect
  1. 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.

  1. Run 3proxy and enjoy!

License

MIT

About

sql auth plugin for 3proxy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published