Skip to content

smahdevops/ScriptAuth-Updated

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScriptAuth

ScriptAuth plugin for 3PROXY.

This plugin allows to validate (proxy) client's username and password using script file.

Updated the scriptauth.c is per the required need.

Now, the script (scriptauth.c) enforces username/password and IP logic dynamically.

Install

Clone or download ScriptAuth plugin to /<3proxy source files>/src/plugins directory.

Edit Makefile.Linux file and add ScriptAuth to your plugins list, like in example below:

PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin ScriptAuth

Compile 3PROXY:

make -f Makefile.Linux

Configure

In your 3proxy.cfg file include scriptauth.ld.so library/plugin, like in example bellow:

plugin "/<path to>/scriptauth.ld.so" start "<script>"

Plugin settings:

  • start - run plugin
  • script - Path to you script file in order to execute. Ex. /etc/3proxy/scripts/auth.php

After that, in your 3proxy.cfg file you will be able to use ScriptAuth plugin in order to authenticate users:

...
authcache user,password 60
auth cache strong script
allow *
...

proxy -p3128

Example

An example in PHP (using curl to request your API) you can found in scripts/auth.php file.

Issues

Issue: error: ld returned 1 exit status...

...
make[2]: Entering directory `/root/3proxy/src/plugins/ScriptAuth'
gcc -o ../../scriptauth.ld.so -O2 -fno-strict-aliasing -pthread -shared -lpam scriptauth.o
/usr/bin/ld: cannot find -lpam
collect2: error: ld returned 1 exit status
make[2]: *** [scriptauth.ld.so] Error 1
make[2]: Leaving directory `/root/3proxy/src/plugins/ScriptAuth'
...

Solution:

Install libpam modules:

sudo apt-get install libpam0g-dev

About

Authorization plugin for 3PROXY

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 89.1%
  • Makefile 6.6%
  • PHP 2.6%
  • Perl 1.1%
  • Shell 0.6%