Perl xlat
BALSIANOK, Peter
Peter.BALSIANOK at orange.com
Tue Sep 9 22:39:35 CEST 2014
Hi,
I try to assign Framed-IP-Address via perl xlat, but freeradius stoped with panic. Pls, help me.
policy.d/SkyToll:
SkyToll {
if(Called-Station-Id =~ /SkyToll\.OBU/) {
if(User-name =~ /23101395(.*)/) {
update reply {
Framed-IP-Address := "%{perl: SkyToll %{1} %{Called-Station-Id} %{NAS-IP-Address}}"
Framed-IP-Netmask := 255.255.255.255
Cisco-AVPair += 'ip:dns-servers=10.10.10.10 10.10.10.11'
Cisco-AVPair += 'lcp:interface-config=ip vrf forwarding OBU \nip unnumbered Loopback1'
}
update control {
Response-Packet-Type := Access-Accept
}
handled
}
else {
update reply {
Reply-Message := "Not valid IMSI"
}
reject
}
}
}
debug output:
radiusd: FreeRADIUS Version 3.0.3, for host i686-pc-linux-gnu, built on Sep 1 2014 at 21:59:53
Copyright (C) 1999-2014 The FreeRADIUS server project and contributors
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License
For more information about these matters, see the file named COPYRIGHT
Starting - reading configuration files ...
including dictionary file /mnt/sdcard/software/freeradius-server-3.0.3/share/freeradius/dictionary
including dictionary file /mnt/sdcard/software/freeradius-server-3.0.3/share/freeradius/dictionary.dhcp
including dictionary file /mnt/sdcard/software/freeradius-server-3.0.3/share/freeradius/dictionary.vqp
including dictionary file ./dictionary
including configuration file ./radiusd.conf
including configuration file ./proxy.conf
including configuration file ./clients.conf
including files in directory ./mods-enabled/
including configuration file ./mods-enabled/digest
including configuration file ./mods-enabled/pap
including configuration file ./mods-enabled/cache
including configuration file ./mods-enabled/attr_filter
including configuration file ./mods-enabled/chap
including configuration file ./mods-enabled/linelog
including configuration file ./mods-enabled/expr
including configuration file ./mods-enabled/preprocess
including configuration file ./mods-enabled/realm
including configuration file ./mods-enabled/perl
including configuration file ./mods-enabled/unpack
including configuration file ./mods-enabled/files
including configuration file ./mods-enabled/always
including files in directory ./policy.d/
including configuration file ./policy.d/cui
including configuration file ./policy.d/control
including configuration file ./policy.d/filter
including configuration file ./policy.d/eap
including configuration file ./policy.d/nas
including configuration file ./policy.d/SkyToll
including configuration file ./policy.d/accounting
including configuration file ./policy.d/dhcp
including configuration file ./policy.d/operator-name
including configuration file ./policy.d/canonicalization
including files in directory ./sites-enabled/
including configuration file ./sites-enabled/default
main {
name = "radiusd"
prefix = "/mnt/sdcard/software/freeradius-server-3.0.3"
localstatedir = "/mnt/sdcard/software/freeradius-server-3.0.3/var"
sbindir = "/mnt/sdcard/software/freeradius-server-3.0.3/sbin"
logdir = "/mnt/sdcard/software/freeradius-server-3.0.3/var/log/radius"
run_dir = "/mnt/sdcard/software/freeradius-server-3.0.3/var/run/radiusd"
libdir = "/mnt/sdcard/software/freeradius-server-3.0.3/lib"
radacctdir = "/mnt/sdcard/software/freeradius-server-3.0.3/var/log/radius/radacct"
hostname_lookups = no
max_request_time = 30
cleanup_delay = 5
max_requests = 1024
pidfile = "/mnt/sdcard/software/freeradius-server-3.0.3/var/run/radiusd/radiusd.pid"
checkrad = "/mnt/sdcard/software/freeradius-server-3.0.3/sbin/checkrad"
debug_level = 0
proxy_requests = yes
log {
stripped_names = no
auth = yes
auth_badpass = yes
auth_goodpass = yes
colourise = yes
msg_denied = "You are already logged in - access denied"
}
security {
max_attributes = 200
reject_delay = 0
status_server = yes
allow_vulnerable_openssl = "yes"
}
}
radiusd: #### Loading Realms and Home Servers ####
proxy server {
retry_delay = 5
retry_count = 3
default_fallback = no
dead_time = 120
wake_all_if_all_dead = no
}
home_server localhost {
ipaddr = 127.0.0.1
port = 1812
type = "auth"
secret = <<< secret >>>
response_window = 20
max_outstanding = 65536
zombie_period = 40
status_check = "status-server"
ping_interval = 30
check_interval = 30
num_answers_to_alive = 3
revive_interval = 120
status_check_timeout = 4
coa {
irt = 2
mrt = 16
mrc = 5
mrd = 30
}
limit {
max_connections = 16
max_requests = 0
lifetime = 0
idle_timeout = 0
}
}
home_server_pool my_auth_failover {
type = fail-over
home_server = localhost
}
realm example.com {
auth_pool = my_auth_failover
}
realm LOCAL {
}
radiusd: #### Loading Clients ####
client localhost {
ipaddr = 127.0.0.1
require_message_authenticator = no
secret = <<< secret >>>
nas_type = "other"
proto = "*"
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
radiusd: #### Instantiating modules ####
instantiate {
# Loaded module rlm_perl
# Instantiating module "perl" from file ./mods-enabled/perl
perl {
filename = "./mods-config/perl/example.pl"
func_authorize = "authorize"
func_authenticate = "authenticate"
func_post_auth = "post_auth"
func_accounting = "accounting"
func_preacct = "preacct"
func_checksimul = "checksimul"
func_detach = "detach"
func_xlat = "xlat"
func_pre_proxy = "pre_proxy"
func_post_proxy = "post_proxy"
func_recv_coa = "recv_coa"
func_send_coa = "send_coa"
}
rlm_perl (perl): parsing 'config' section...
config {
name = value
sub-config {
name = value of name from config.sub-config
}
}
rlm_perl (perl): done parsing 'config'.
}
modules {
# Loaded module rlm_digest
# Instantiating module "digest" from file ./mods-enabled/digest
# Loaded module rlm_pap
# Instantiating module "pap" from file ./mods-enabled/pap
pap {
normalise = yes
}
# Loaded module rlm_cache
# Instantiating module "cache" from file ./mods-enabled/cache
cache {
key = "%{User-Name}"
ttl = 86400
max_entries = 16384
epoch = 0
add_stats = yes
}
# Loaded module rlm_attr_filter
# Instantiating module "attr_filter.post-proxy" from file ./mods-enabled/attr_filter
attr_filter attr_filter.post-proxy {
filename = "./mods-config/attr_filter/post-proxy"
key = "%{Realm}"
relaxed = no
}
reading pairlist file ./mods-config/attr_filter/post-proxy
# Instantiating module "attr_filter.pre-proxy" from file ./mods-enabled/attr_filter
attr_filter attr_filter.pre-proxy {
filename = "./mods-config/attr_filter/pre-proxy"
key = "%{Realm}"
relaxed = no
}
reading pairlist file ./mods-config/attr_filter/pre-proxy
# Instantiating module "attr_filter.access_reject" from file ./mods-enabled/attr_filter
attr_filter attr_filter.access_reject {
filename = "./mods-config/attr_filter/access_reject"
key = "%{User-Name}"
relaxed = no
}
reading pairlist file ./mods-config/attr_filter/access_reject
# Instantiating module "attr_filter.access_challenge" from file ./mods-enabled/attr_filter
attr_filter attr_filter.access_challenge {
filename = "./mods-config/attr_filter/access_challenge"
key = "%{User-Name}"
relaxed = no
}
reading pairlist file ./mods-config/attr_filter/access_challenge
# Instantiating module "attr_filter.accounting_response" from file ./mods-enabled/attr_filter
attr_filter attr_filter.accounting_response {
filename = "./mods-config/attr_filter/accounting_response"
key = "%{User-Name}"
relaxed = no
}
reading pairlist file ./mods-config/attr_filter/accounting_response
# Loaded module rlm_chap
# Instantiating module "chap" from file ./mods-enabled/chap
# Loaded module rlm_linelog
# Instantiating module "linelog" from file ./mods-enabled/linelog
linelog {
filename = "/mnt/sdcard/software/freeradius-server-3.0.3/var/log/radius/linelog"
permissions = 384
format = "This is a log message for %{User-Name}"
reference = "messages.%{%{Packet-Type}:-default}"
}
# Instantiating module "log_accounting" from file ./mods-enabled/linelog
linelog log_accounting {
filename = "/mnt/sdcard/software/freeradius-server-3.0.3/var/log/radius/linelog-accounting"
permissions = 384
format = ""
reference = "Accounting-Request.%{%{Acct-Status-Type}:-unknown}"
}
# Loaded module rlm_expr
# Instantiating module "expr" from file ./mods-enabled/expr
expr {
safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
}
# Loaded module rlm_preprocess
# Instantiating module "preprocess" from file ./mods-enabled/preprocess
preprocess {
huntgroups = "./mods-config/preprocess/huntgroups"
hints = "./mods-config/preprocess/hints"
with_ascend_hack = no
ascend_channels_per_line = 23
with_ntdomain_hack = no
with_specialix_jetstream_hack = no
with_cisco_vsa_hack = no
with_alvarion_vsa_hack = no
}
reading pairlist file ./mods-config/preprocess/huntgroups
reading pairlist file ./mods-config/preprocess/hints
# Loaded module rlm_realm
# Instantiating module "IPASS" from file ./mods-enabled/realm
realm IPASS {
format = "prefix"
delimiter = "/"
ignore_default = no
ignore_null = no
}
# Instantiating module "suffix" from file ./mods-enabled/realm
realm suffix {
format = "suffix"
delimiter = "@"
ignore_default = no
ignore_null = no
}
# Instantiating module "realmpercent" from file ./mods-enabled/realm
realm realmpercent {
format = "suffix"
delimiter = "%"
ignore_default = no
ignore_null = no
}
# Instantiating module "ntdomain" from file ./mods-enabled/realm
realm ntdomain {
format = "prefix"
delimiter = "\"
ignore_default = no
ignore_null = no
}
# Loaded module rlm_unpack
# Instantiating module "unpack" from file ./mods-enabled/unpack
# Loaded module rlm_files
# Instantiating module "files" from file ./mods-enabled/files
files {
filename = "./mods-config/files/authorize"
usersfile = "./mods-config/files/authorize"
acctusersfile = "./mods-config/files/accounting"
preproxy_usersfile = "./mods-config/files/pre-proxy"
compat = "cistron"
}
reading pairlist file ./mods-config/files/authorize
[./mods-config/files/authorize]:84 Cistron compatibility checks for entry dummy ...
reading pairlist file ./mods-config/files/authorize
[./mods-config/files/authorize]:84 Cistron compatibility checks for entry dummy ...
reading pairlist file ./mods-config/files/accounting
reading pairlist file ./mods-config/files/pre-proxy
# Loaded module rlm_always
# Instantiating module "reject" from file ./mods-enabled/always
always reject {
rcode = "reject"
simulcount = 0
mpp = no
}
# Instantiating module "fail" from file ./mods-enabled/always
always fail {
rcode = "fail"
simulcount = 0
mpp = no
}
# Instantiating module "ok" from file ./mods-enabled/always
always ok {
rcode = "ok"
simulcount = 0
mpp = no
}
# Instantiating module "handled" from file ./mods-enabled/always
always handled {
rcode = "handled"
simulcount = 0
mpp = no
}
# Instantiating module "invalid" from file ./mods-enabled/always
always invalid {
rcode = "invalid"
simulcount = 0
mpp = no
}
# Instantiating module "userlock" from file ./mods-enabled/always
always userlock {
rcode = "userlock"
simulcount = 0
mpp = no
}
# Instantiating module "notfound" from file ./mods-enabled/always
always notfound {
rcode = "notfound"
simulcount = 0
mpp = no
}
# Instantiating module "noop" from file ./mods-enabled/always
always noop {
rcode = "noop"
simulcount = 0
mpp = no
}
# Instantiating module "updated" from file ./mods-enabled/always
always updated {
rcode = "updated"
simulcount = 0
mpp = no
}
} # modules
radiusd: #### Loading Virtual Servers ####
server { # from file ./radiusd.conf
} # server
server default { # from file ./sites-enabled/default
# Loading authenticate {...}
# Loading authorize {...}
Ignoring "sql" (see raddb/mods-available/README.rst)
Ignoring "ldap" (see raddb/mods-available/README.rst)
# Loading preacct {...}
# Loading accounting {...}
# Loading post-auth {...}
} # server default
radiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = *
port = 0
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
listen {
type = "acct"
ipaddr = *
port = 0
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
Listening on auth address * port 1812 as server default
Listening on acct address * port 1813 as server default
Opening new proxy socket 'proxy address * port 0'
Listening on proxy address * port 56160
Ready to process requests.
Received Access-Request Id 107 from 127.0.0.1:39181 to 127.0.0.1:1812 length 157
NAS-Port-Type = Virtual
CHAP-Password = 0x0143d6783ff7ae79654650a37b8cfb1f9e
Service-Type = Framed-User
Called-Station-Id = 'SkyToll.OBU'
Calling-Station-Id = '421945128228'
Framed-Protocol = PPP
CHAP-Challenge = 0xe5da1ef5c27f521eebbc9289ae5c9d34
User-Name = '231013950043478'
Connect-Info = '8640000'
NAS-IP-Address = 85.237.224.1
NAS-Port = 390
NAS-Port-Id = 'Uniq-Sess-ID390'
(0) # Executing section authorize from file ./sites-enabled/default
(0) authorize {
(0) verify_nas verify_nas {
(0) if ( ! NAS-IP-Address )
(0) if ( ! NAS-IP-Address ) -> FALSE
(0) } # verify_nas verify_nas = notfound
(0) SkyToll SkyToll {
(0) if (Called-Station-Id =~ /SkyToll\.OBU/)
(0) if (Called-Station-Id =~ /SkyToll\.OBU/) -> TRUE
(0) if (Called-Station-Id =~ /SkyToll\.OBU/) {
(0) if (User-name =~ /23101395(.*)/)
(0) if (User-name =~ /23101395(.*)/) -> TRUE
(0) if (User-name =~ /23101395(.*)/) {
(0) update reply {
panic: memory wrap.
More information about the Freeradius-Users
mailing list