#!/usr/local/bin/perl #----------------------------------------------------------------------------------- # Author: Edmar Lourenco Borges; # Authenticator Squid/Radius; # Use perl modules perl RadiusPerl-0.05/MD5-1.7/IO-1.20 # Theses modules can be found in http://core.ring.gr.jp/archives/lang/perl/CPAN/modules #----------------------------------------------------------------------------------- $|=1; BEGIN {;} END {print "ERR" unless $GLOBAL{loaded};} #------------------------------------------------------------------------------ #Definition of globals variables: #Radius Server: $Global{hostname} = "hostname[:port]" or "ip address[:port]" #Simetric Key: $Global{key} = "string" #------------------------------------------------------------------------------ $GLOBAL{loaded} = 0; $GLOBAL{hostname} = "hostname.com.br:1645"; $GLOBAL{key} = "keyradius"; main(); sub main { authentication(); } # end of main sub authentication { local(@info,$radius); use Authen::Radius; $GLOBAL{loaded} = 1; while () { chop($_); @info = split(/ / , $_); $radius = new Authen::Radius(Host => $GLOBAL{hostname}, Secret => $GLOBAL{key}); print $radius->check_pwd(@info[0], @info[1]) ? "OK\n" : "ERR\n"; } } # end authentication