Lower case to Upper case in Calling-Station-Id at policy.conf
Hi, How can I use uc function below in order to change lower case to upper case? Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2 In the policy.conf: mac-phase { if("%{request:Calling-Station-Id}" =~ /([0-9a-f]{2})[-:]?([0-9a-f]{2})[-:]?([0-9a-f]{2})[-:]?([0-9a-f]{2,})[-:]?([0-9a-f]{2})[-:]?([0-9A-F]{2})/i){ update request { Calling-Station-Id := "%{1}-%{2}-%{3}-%{4}-%{5}-%{6}" } } else { noop } } Best regards
Hi, Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction. The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it. Cheers -- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
Ok... I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file! Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-( Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work? Guaraldi 2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Did you create an alias in modules/perl that uses this script for authorize? Did you add the alias name to the authorize section of your default server? What return value are you using in the script (RLM_UPDATED)? -----Original Message----- From: freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org [mailto:freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org] On Behalf Of Hilton Guaraldi Sent: Friday, September 18, 2009 1:13 PM To: FreeRadius users mailing list Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf Ok... I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file! Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-( Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work? Guaraldi 2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 that _should_ work for you: - -- cut -- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut -- and add "perl" in preacct { } section after preprocess in radiusd.conf - ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34 - ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 20:12:34 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqz14AACgkQRAN48r0+OnqSKQCghcDigoyUZFXMTvsLDFJ6lMMg +fwAoIyDW+Ik5UVhoGih0AOIHOGqZBrv =2IlH -----END PGP SIGNATURE-----
Ok...
I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file!
Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-(
Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work?
Guaraldi
2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper
case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Thanks Saraev, Again, a new problem emerged... :-( In /etc/raddb/modules I do not see perl module... :-( I am running opensuse 11.1 and freeradius 2.1.1-1.27 from opensuse repository. Is there a way to get this problem solved, i.e. , perl module missing in modules subdirectory? Is there a way to supply it? Guaraldi 2009/9/18 Stefan Saraev <seo@link.bg>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
that _should_ work for you:
- -- cut -- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); }
sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut --
and add "perl" in preacct { } section after preprocess in radiusd.conf
- ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34
- ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 20:12:34 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqz14AACgkQRAN48r0+OnqSKQCghcDigoyUZFXMTvsLDFJ6lMMg +fwAoIyDW+Ik5UVhoGih0AOIHOGqZBrv =2IlH -----END PGP SIGNATURE-----
Ok...
I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file!
Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-(
Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work?
Guaraldi
2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper
case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- 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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 http://wiki.freeradius.org/Rlm_perl radiusd.conf: - -- cut -- modules { ... perl { module = /path/to/blah.pl .... } } ... authorize { preprocess ... sql ... perl ... } ... preacct { preprocess perl ... } ... - -- cut -- you need rlm_perl compiled and installed, check the documentation blah:pl - --- cut --- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut --- - ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34 - ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 22:12:41 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqz7JoACgkQRAN48r0+OnrKsACgnvZ0Wri61AYc2q62zMHQNBnU vrgAnjnrHYiPocolDZcO7BmDEwuyHyk8 =eAsR -----END PGP SIGNATURE-----
Thanks Saraev, Again, a new problem emerged... :-(
In /etc/raddb/modules I do not see perl module... :-(
I am running opensuse 11.1 and freeradius 2.1.1-1.27 from opensuse repository.
Is there a way to get this problem solved, i.e. , perl module missing in modules subdirectory? Is there a way to supply it?
Guaraldi
2009/9/18 Stefan Saraev <seo@link.bg>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
that _should_ work for you:
- -- cut -- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); }
sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut --
and add "perl" in preacct { } section after preprocess in radiusd.conf
- ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34
- ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 20:12:34 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqz14AACgkQRAN48r0+OnqSKQCghcDigoyUZFXMTvsLDFJ6lMMg +fwAoIyDW+Ik5UVhoGih0AOIHOGqZBrv =2IlH -----END PGP SIGNATURE-----
Ok...
I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file!
Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-(
Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work?
Guaraldi
2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper
case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- 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
Thank you Kalik, Saraev and Garber. I will upgrade my freeradius. Give a time to do this. I come back later with news... Guaraldi 2009/9/18 Stefan Saraev <seo@link.bg>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
http://wiki.freeradius.org/Rlm_perl
radiusd.conf: - -- cut -- modules { ... perl { module = /path/to/blah.pl .... } } ... authorize { preprocess ... sql ... perl ... } ... preacct { preprocess perl ... } ... - -- cut --
you need rlm_perl compiled and installed, check the documentation
blah:pl - --- cut --- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);
sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut ---
- ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34
- ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 22:12:41 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqz7JoACgkQRAN48r0+OnrKsACgnvZ0Wri61AYc2q62zMHQNBnU vrgAnjnrHYiPocolDZcO7BmDEwuyHyk8 =eAsR -----END PGP SIGNATURE-----
Thanks Saraev, Again, a new problem emerged... :-(
In /etc/raddb/modules I do not see perl module... :-(
I am running opensuse 11.1 and freeradius 2.1.1-1.27 from opensuse repository.
Is there a way to get this problem solved, i.e. , perl module missing in modules subdirectory? Is there a way to supply it?
Guaraldi
2009/9/18 Stefan Saraev <seo@link.bg>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
that _should_ work for you:
- -- cut -- use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); sub authorize { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); }
sub preacct { $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}); } - -- cut --
and add "perl" in preacct { } section after preprocess in radiusd.conf
- ----------------- Regards Stefan Saraev Link+ Ltd. +359 899 19 15 34
- ----- Original Message ----- From: Hilton Guaraldi [mailto:guaraldi@gmail.com] To: FreeRadius users mailing list [mailto:freeradius-users@lists.freeradius.org] Sent: Fri, 18 Sep 2009 20:12:34 +0300 Subject: Re: Lower case to Upper case in Calling-Station-Id at policy.conf
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqz14AACgkQRAN48r0+OnqSKQCghcDigoyUZFXMTvsLDFJ6lMMg +fwAoIyDW+Ik5UVhoGih0AOIHOGqZBrv =2IlH -----END PGP SIGNATURE-----
Ok...
I tried $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}). I guess in the sub authorize of example.pl ..............The only file I saw sub authorize in... If I am wrong, please help me what is the correct file!
Running radiusd -X nothing happens in MAC address. If it is 00-18-e7-41-ad-c2, it remains the same, not 00-18-E7-41-AD-C2, :-(
Must I "include" example.pl to radius in order to do $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) work?
Guaraldi
2009/9/18 Alexander Clouter <alex@digriz.org.uk>:
Hi,
Hilton Guaraldi <guaraldi@gmail.com> wrote:
How can I use uc function below in order to change lower case to upper
case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
In the policy.conf:
When I last nosied through the source code there is no way. I normally make sure all the polies are case insensitive *in* FreeRADIUS and when things get spat out to my SQL server I slip 'lower(...)' around the MAC addresses going in that direction.
The only other way is to have a Perl script doing the work for you, but as you can use case insensitive regex to replace string matching, I would say it is not worth it.
Cheers
-- Alexander Clouter .sigmonster says: Idleness is the holiday of fools.
- 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
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
How can I use uc function below in order to change lower case to upper case?
Ex. 00-18-e7-41-ad-c2 ---> 00-18-E7-41-AD-C2
It's a perl function. So you put in sub authorize: $RAD_REQUEST{'Calling-Station-Id'} = uc($RAD_REQUEST{'Calling-Station-Id'}) Ivan Kalik Kalik Informatika ISP
participants (5)
-
Alexander Clouter -
Garber, Neal -
Hilton Guaraldi -
Ivan Kalik -
Stefan Saraev