PS. You should run your script in authorize. Ivan Kalik Kalik Informatika ISP
Dana 15/5/2008, "Bishal" <[EMAIL PROTECTED]> piše: > >Hello Ivan, > > I came up with this scripts but looks like it;s not working. In >radiusd.conf > >perl{ > modules = /usr/local/etc/raddb/mac_check.pl > } > >Instantiate { > exec > expr > dailycounter > noresetcounter > perl >} > >radius debug shows perl modules loaded. But my script is not working. How >can I assign variables username and callingStationid in my script during >authentication process. rlm_perl doc show %RAD_REQUEST{'User-name'} >but it's not helping? > > > > > > >#!/usr/bin/perl ># Check for MAC Authentication is enable or not > > >#$username = $ARGV[4]; > >#$username = %RAD_REQUEST{'User-Name'}; >#$callerid = %RAD_REQUEST{'Calling-Station-Id'}; > > >use DBI; > > > > $database = "radius"; > $user = "freeradius"; > $password = "blaba2r"; > $option = "localhost"; > > $dsn = "DBI:mysql:$database"; > $dsn = "DBI:mysql:database=$database;$option"; > $dbh = DBI->connect($dsn, $user, $password); > > my $sql = $dbh->prepare( "SELECT Usemac FROM radcheck WHERE >UserName='$RAD_REQUEST{'User-Name'}' AND Attribute='Expiration' >"); > my $sql2 = $dbh->prepare( "SELECT Value FROM radcheck WHERE >Attribute='Calling-Station-Id' AND UserName='tori' "); > my $sql3 = $dbh->prepare( "INSERT INTO radcheck >(id,UserName,Attribute,op,Value) >VALUES('','$RAD_REQUEST{'User-Name'}','Calling-Statio >n-Id','+=','$RAD_REQUEST{'Calling-Station-Id'}' "); > > > $rowcount = $sql->execute > or die "Cannot execute SQL statement: $DBI::errstr\n"; > > my @row; > while ( @row = $sql->fetchrow_array() ) { > $mac = $row[0]; > chomp($mac); > } ># Check if MAC authentication is enabled or not if enabled then insert >the mac > if ($mac == 1 ){ > > $rowcount = $sql3->execute > or die "Cannot execute SQL Statement: $DBI::errstr\n"; > > >}else { >exit; >} >$sql->finish; >$dbh->disconnect() >or warn "Disconnection failed: $DBI::errstr\n"; > > >On 5/14/2008, "Bishal" <[EMAIL PROTECTED]> wrote: > >> >>Any sample scripts IVAN? >> >> >> >>On 5/14/2008, "Ivan Kalik" <[EMAIL PROTECTED]> wrote: >> >>>> >>>> I am using sql for AAA. >>> >>>I have news for you - you are not. You are using it to store attributes. >>> >>>>Can u give me some exaples how can I do that >>>>withl Rlm_perl modules.? >>>> >>> >>>Do Google: mysql perl tutorial. If it's not MySQL, replace that with the >>>name of your sql server. >>> >>>Ivan Kalik >>>Kalik Informatika ISP >>> >>>- >>>List info/subscribe/unsubscribe? See >>>http://www.freeradius.org/list/users.html >>> >>> >> >>- >>List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html >> >> > >- >List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html > > - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html