Hi everyone.. I have a little problem... I have users with a web service but I need to store the accounting in a mysql database because I use daloradius. So I have an authentication with SQL module but I need to add users before authorization. So I think if is possible to use the perl module in the authorization section to add users to MySQL database and after freeradius do an authorization with the mysql database. -- Fabricio A. Flores G. Egresado en Ingeniería en Sistemas Twitter: fabricioflores Skype: fabriciofloresgallardo Blog Personal <http://fabricioflores.wordpress.com/>
On Mon, Apr 9, 2012 at 10:17 PM, Fabricio Flores <fabrifloresg@gmail.com> wrote:
Hi everyone.. I have a little problem... I have users with a web service but I need to store the accounting in a mysql database because I use daloradius. So I have an authentication with SQL module but I need to add users before authorization. So I think if is possible to use the perl module in the authorization section to add users to MySQL database and after freeradius do an authorization with the mysql database.
If you're using a captive portal setup, then usually the captive portal web page will take care of adding users. No need to get perl or freeradius involved at that point. FR simply uses whatever is on the db. If, on the other hand, you have a setup that's like "I'll accept whatever username and password that the client sends, and add them to the db", then it should be possibe, as long as the client ONLY uses pap (or probably PEAP-GTC and TTLS-PAP as well). You can easily have multiple modules in authorize section, or even do unlang with "%{sql: INSERT INTO radcheck ....}". Pardon me if I say such setup is stupid though. The only time it might be useful is if you're taking over someone else's radius, with no access to existing user/password, and simply want to accept whatever the user sends just to keep the service going. -- Fajar
thanks for the answer... I want to obtain from the web service the users, but I need to use mysql with freeradius because I'm using daloradius. So I think if the web service authenticate with a perl client in this script add the user to mysql database and after freeradius connect to mysql to do auth... is possible to use the perl and mysql in authorization section? in the perl script i want to connect to my web service and if the user exists add in mysql... after the sql module do athorization, accounting, etc El 9 de abril de 2012 10:42, Fajar A. Nugraha <list@fajar.net> escribió:
On Mon, Apr 9, 2012 at 10:17 PM, Fabricio Flores <fabrifloresg@gmail.com> wrote:
Hi everyone.. I have a little problem... I have users with a web service but I need to store the accounting in a mysql database because I use daloradius. So I have an authentication with SQL module but I need to add users before authorization. So I think if is possible to use the perl module in the authorization section to add users to MySQL database and after freeradius do an authorization with the mysql database.
If you're using a captive portal setup, then usually the captive portal web page will take care of adding users. No need to get perl or freeradius involved at that point. FR simply uses whatever is on the db.
If, on the other hand, you have a setup that's like "I'll accept whatever username and password that the client sends, and add them to the db", then it should be possibe, as long as the client ONLY uses pap (or probably PEAP-GTC and TTLS-PAP as well). You can easily have multiple modules in authorize section, or even do unlang with "%{sql: INSERT INTO radcheck ....}". Pardon me if I say such setup is stupid though. The only time it might be useful is if you're taking over someone else's radius, with no access to existing user/password, and simply want to accept whatever the user sends just to keep the service going.
-- Fajar - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Fabricio A. Flores G. Egresado en Ingeniería en Sistemas MSN: fabri_floresg@hotmail.com Google: fabrifloresg@gmail.com Twitter: fabricioflores Skype: fabriciofloresgallardo Blog Personal <http://fabricioflores.wordpress.com/>
Hi... I worked in my perl script... i did the conection to the web service and it works... I configure freeradius (add perl and sql) in auth section, I made a debug with freeradius -X but I don´t know if freeradius read the perl script before work with mysql... i have this output: rad_recv: Access-Request packet from host 127.0.0.1 port 45894, id=120, length=62 User-Name = "1104015936" User-Password = "fabricio1" NAS-IP-Address = 127.0.1.1 NAS-Port = 1812 # Executing section authorize from file /etc/freeradius/sites-enabled/default +- entering group authorize {...} ++[preprocess] returns ok ++[chap] returns noop ++[mschap] returns noop ++[digest] returns noop [suffix] No '@' in User-Name = "usuario", looking up realm NULL [suffix] No such realm "NULL" ++[suffix] returns noop [eap] No EAP-Message, not doing EAP ++[eap] returns noop ++[files] returns noop rlm_perl: Added pair User-Name = usuario rlm_perl: Added pair User-Password = clave rlm_perl: Added pair NAS-Port = 1812 rlm_perl: Added pair NAS-IP-Address = 127.0.1.1 ++[perl] returns ok [sql] expand: %{User-Name} -> 1104015936 [sql] sql_set_user escaped user --> 'usuario' rlm_sql (sql): Reserving sql socket id: 2 [sql] expand: SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'usuario' ORDER BY id [sql] expand: SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM radusergroup WHERE username = 'usuario' ORDER BY priority rlm_sql (sql): Released sql socket id: 2 [sql] User usuario not found ++[sql] returns notfound ++[expiration] returns noop ++[logintime] returns noop [pap] WARNING! No "known good" password found for the user. Authentication may fail because of this. ++[pap] returns noop ERROR: No authenticate method (Auth-Type) found for the request: Rejecting the user Failed to authenticate the user. Using Post-Auth-Type Reject # Executing group from file /etc/freeradius/sites-enabled/default +- entering group REJECT {...} [attr_filter.access_reject] expand: %{User-Name} -> usuario attr_filter: Matched entry DEFAULT at line 11 ++[attr_filter.access_reject] returns updated Delaying reject of request 1 for 1 seconds Going to the next request Waking up in 0.9 seconds. Sending delayed reject for request 1 Sending Access-Reject of id 120 to 127.0.0.1 port 45894 Waking up in 4.9 seconds. Cleaning up request 1 ID 120 with timestamp +410 Ready to process requests. El 9 de abril de 2012 16:49, Fajar A. Nugraha <list@fajar.net> escribió:
On Mon, Apr 9, 2012 at 10:49 PM, Fabricio Flores <fabrifloresg@gmail.com> wrote:
is possible to use the perl and mysql in authorization section? in
As I've already said, yes.
-- Fajar - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Fabricio A. Flores G. Egresado en Ingeniería en Sistemas MSN: fabri_floresg@hotmail.com Google: fabrifloresg@gmail.com Twitter: fabricioflores Skype: fabriciofloresgallardo Blog Personal <http://fabricioflores.wordpress.com/>
Hi,
Hi... I worked in my perl script... i did the conection to the web service and it works... I configure freeradius (add perl and sql) in auth section, I made a debug with freeradius -X but I don�t know if freeradius read the perl script before work with mysql... i have this output:
the logs show the perl being called before the sql...and the sql failing with usuario userid not being found alan
ok i start the freeradius with freeradius -x and i have this error: Can't load '/usr/lib/perl5/auto/DBI/DBI.so' for module DBI: /usr/lib/perl5/auto/DBI/DBI.so: undefined symbol: PL_memory_wrap at /usr/lib/perl/5.12/DynaLoader.pm line 192. I read in another post that is an error because i use dbi of perl... so i started freeradius with: LD_PRELOAD=/usr/lib/libperl.so.5.12.4 freeradius -X in this way freeradius daemon starts but in the freeradius log i have this: Thu Apr 19 18:27:55 2012 : Info: Loaded virtual server inner-tunnel Thu Apr 19 18:27:55 2012 : Error: rlm_perl: perl_parse failed: /etc/freeradius/example.pl not found or has syntax errors. Thu Apr 19 18:27:55 2012 : Error: /etc/freeradius/modules/perl[7]: Instantiation failed for module "perl" Thu Apr 19 18:27:55 2012 : Error: /etc/freeradius/sites-enabled/default[265]: Failed to load module "perl". Thu Apr 19 18:27:55 2012 : Error: /etc/freeradius/sites-enabled/default[265]: Failed to parse "perl" entry. Thu Apr 19 18:27:55 2012 : Error: Failed to load virtual server <default> i test the perl script without freeradius variables and it works El 19 de abril de 2012 10:56, alan buxey <A.L.M.Buxey@lboro.ac.uk> escribió:
Hi,
Hi... I worked in my perl script... i did the conection to the web service and it works... I configure freeradius (add perl and sql) in auth section, I made a debug with freeradius -X but I don�t know if freeradius read the perl script before work with mysql... i have this output:
the logs show the perl being called before the sql...and the sql failing with usuario userid not being found
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Fabricio A. Flores G. Egresado en Ingeniería en Sistemas MSN: fabri_floresg@hotmail.com Google: fabrifloresg@gmail.com Twitter: fabricioflores Skype: fabriciofloresgallardo Blog Personal <http://fabricioflores.wordpress.com/>
participants (3)
-
alan buxey -
Fabricio Flores -
Fajar A. Nugraha