Hello , Please could any one provide the unlang syntax to check if the request:user-name is of type ipv4addr or ipv6addr Thanks Bassem
On Apr 15, 2022, at 8:30 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello , Please could any one provide the unlang syntax to check if the request:user-name is of type ipv4addr or ipv6addr
User-Name is a string. You can use regular expression to see if the string matches an IPv4 or IPv6 address. if (User-Name =~ /regex/) { ... } Alan DeKok.
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv Thanks a lot Le sam. 16 avr. 2022 à 16:44, Alan DeKok <aland@deployingradius.com> a écrit :
On Apr 15, 2022, at 8:30 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello , Please could any one provide the unlang syntax to check if the request:user-name is of type ipv4addr or ipv6addr
User-Name is a string. You can use regular expression to see if the string matches an IPv4 or IPv6 address.
if (User-Name =~ /regex/) { ... }
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address -- Matthew
Hello, i have used this regex for ipv4addr if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\) { } but when i try to start freeradius i get this error message: default[424]: Failed to find "{" as a module or policy. default[424]: Failed to parse "{" entry. How could I resolve this? Thanks Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn@freeradius.org> a écrit :
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address
-- Matthew - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
I haven’t read the regex itself to see if it makes sense, but / is not \ - so start there.
On 17/04/2022, at 9:31 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello,
i have used this regex for ipv4addr
if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
{
}
but when i try to start freeradius i get this error message:
default[424]: Failed to find "{" as a module or policy. default[424]: Failed to parse "{" entry.
How could I resolve this?
Thanks
Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn@freeradius.org> a écrit :
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address
-- Matthew - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
sorry by mistake i have writen this: if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\) but what i use actually on my freeradius server is this: if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/) and i get the same error message: Failed to find "{" as a module or policy. Le dim. 17 avr. 2022 à 10:33, Nathan Ward <lists+freeradius@daork.net> a écrit :
I haven’t read the regex itself to see if it makes sense, but / is not \ - so start there.
On 17/04/2022, at 9:31 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello,
i have used this regex for ipv4addr
if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
{
}
but when i try to start freeradius i get this error message:
default[424]: Failed to find "{" as a module or policy. default[424]: Failed to parse "{" entry.
How could I resolve this?
Thanks
Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn@freeradius.org> a écrit :
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address
-- Matthew - 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
Try put the { on the end of the if line, I have a vague recollection that that’s a thing. Otherwise - post the log (not just that line).
On 17/04/2022, at 9:48 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
sorry by mistake i have writen this: if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
but what i use actually on my freeradius server is this:
if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/)
and i get the same error message:
Failed to find "{" as a module or policy.
Le dim. 17 avr. 2022 à 10:33, Nathan Ward <lists+freeradius@daork.net> a écrit :
I haven’t read the regex itself to see if it makes sense, but / is not \ - so start there.
On 17/04/2022, at 9:31 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello,
i have used this regex for ipv4addr
if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
{
}
but when i try to start freeradius i get this error message:
default[424]: Failed to find "{" as a module or policy. default[424]: Failed to parse "{" entry.
How could I resolve this?
Thanks
Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn@freeradius.org> a écrit :
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address
-- Matthew - 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
Thanks a lot it is working now, the issue was the { at the second line for every one who need to check IPV4 and IPV6 below the configuration if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/) { ..... } elsif (User-Name =~ /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::(?:[0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:)?[0-9a-fA-F]{1,4}$|(?:[0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}::[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}::$/) { ..... } Le dim. 17 avr. 2022 à 13:11, Nathan Ward <lists+freeradius@daork.net> a écrit :
Try put the { on the end of the if line, I have a vague recollection that that’s a thing.
Otherwise - post the log (not just that line).
On 17/04/2022, at 9:48 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
sorry by mistake i have writen this: if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
but what i use actually on my freeradius server is this:
if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/)
and i get the same error message:
Failed to find "{" as a module or policy.
Le dim. 17 avr. 2022 à 10:33, Nathan Ward <lists+freeradius@daork.net> a écrit :
I haven’t read the regex itself to see if it makes sense, but / is not \ - so start there.
On 17/04/2022, at 9:31 PM, Bassem Mettichi <mettichi@gmail.com> wrote:
Hello,
i have used this regex for ipv4addr
if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
{
}
but when i try to start freeradius i get this error message:
default[424]: Failed to find "{" as a module or policy. default[424]: Failed to parse "{" entry.
How could I resolve this?
Thanks
Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn@freeradius.org> a écrit :
On 16/04/2022 19:50, Bassem Mettichi wrote:
Thanks a lot Alan please could you give me an example for regexp that match ipv4 and ipv
https://duckduckgo.com/?q=regex+to+match+ip+address
-- Matthew - 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
participants (4)
-
Alan DeKok -
Bassem Mettichi -
Matthew Newton -
Nathan Ward