I have activated rlm_cache so as to reduce the amount of times the freeradius will query the DB. I made the Calling-Station-Id the cache key and have added this code to the accounting section: cache if (ok){ sql } else { if ("%{sql:select case when exists(select * from [TABLE_NAME] where ne_id='%{Calling-Station-Id}') then 1 else 0 end}" == 1){ sql } } However what happens is that all Calling-Station-Ids are stored to the cache and so the 2nd time I get a packet they execute the sql module. How can I configure filtering of the cache in the “else” section so as to decide which Calling-Station-Id to save in cache and which not? Thanks Liran
The "sql" is executed from each statement? so, please share your debug output. https://wiki.freeradius.org/guide/radiusd-X On Mon, Jul 15, 2019 at 11:35 AM liran kessel <lirankessel@gmail.com> wrote:
I have activated rlm_cache so as to reduce the amount of times the freeradius will query the DB. I made the Calling-Station-Id the cache key and have added this code to the accounting section:
cache if (ok){ sql } else { if ("%{sql:select case when exists(select * from [TABLE_NAME] where ne_id='%{Calling-Station-Id}') then 1 else 0 end}" == 1){ sql } }
However what happens is that all Calling-Station-Ids are stored to the cache and so the 2nd time I get a packet they execute the sql module. How can I configure filtering of the cache in the “else” section so as to decide which Calling-Station-Id to save in cache and which not?
Thanks Liran - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Yes the sql is executed for each statement and I am trying to see if I can control which keys are stored to the rlm_cache?
Here is the output of debug:
[root@xxxxxxxx ~]# radiusd -X
FreeRADIUS Version 3.0.13
Copyright (C) 1999-2017 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 /usr/share/freeradius/dictionary
including dictionary file /usr/share/freeradius/dictionary.dhcp
including dictionary file /usr/share/freeradius/dictionary.vqp
including dictionary file /etc/raddb/dictionary
including configuration file /etc/raddb/radiusd.conf
including configuration file /etc/raddb/proxy.conf
including configuration file /etc/raddb/postgresql.conf
including configuration file /etc/raddb/clients.conf
including files in directory /etc/raddb/mods-enabled/
including configuration file /etc/raddb/mods-enabled/sql
including configuration file /etc/raddb/mods-config/sql/main/postgresql/queries.conf
including configuration file /etc/raddb/mods-enabled/utf8
including configuration file /etc/raddb/mods-enabled/unpack
including configuration file /etc/raddb/mods-enabled/unix
including configuration file /etc/raddb/mods-enabled/sradutmp
including configuration file /etc/raddb/mods-enabled/soh
including configuration file /etc/raddb/mods-enabled/replicate
including configuration file /etc/raddb/mods-enabled/realm
including configuration file /etc/raddb/mods-enabled/radutmp
including configuration file /etc/raddb/mods-enabled/preprocess
including configuration file /etc/raddb/mods-enabled/passwd
including configuration file /etc/raddb/mods-enabled/pap
including configuration file /etc/raddb/mods-enabled/ntlm_auth
including configuration file /etc/raddb/mods-enabled/mschap
including configuration file /etc/raddb/mods-enabled/logintime
including configuration file /etc/raddb/mods-enabled/linelog
including configuration file /etc/raddb/mods-enabled/files
including configuration file /etc/raddb/mods-enabled/expr
including configuration file /etc/raddb/mods-enabled/expiration
including configuration file /etc/raddb/mods-enabled/exec
including configuration file /etc/raddb/mods-enabled/echo
including configuration file /etc/raddb/mods-enabled/eap
including configuration file /etc/raddb/mods-enabled/dynamic_clients
including configuration file /etc/raddb/mods-enabled/digest
including configuration file /etc/raddb/mods-enabled/dhcp
including configuration file /etc/raddb/mods-enabled/detail.log
including configuration file /etc/raddb/mods-enabled/detail
including configuration file /etc/raddb/mods-enabled/date
including configuration file /etc/raddb/mods-enabled/chap
including configuration file /etc/raddb/mods-enabled/cache_eap
including configuration file /etc/raddb/mods-enabled/attr_filter
including configuration file /etc/raddb/mods-enabled/always
including configuration file /etc/raddb/mods-enabled/cache
including files in directory /etc/raddb/policy.d/
including configuration file /etc/raddb/policy.d/accounting
including configuration file /etc/raddb/policy.d/canonicalization
including configuration file /etc/raddb/policy.d/control
including configuration file /etc/raddb/policy.d/cui
including configuration file /etc/raddb/policy.d/debug
including configuration file /etc/raddb/policy.d/dhcp
including configuration file /etc/raddb/policy.d/eap
including configuration file /etc/raddb/policy.d/filter
including configuration file /etc/raddb/policy.d/operator-name
including files in directory /etc/raddb/sites-enabled/
including configuration file /etc/raddb/sites-enabled/inner-tunnel
including configuration file /etc/raddb/sites-enabled/default
main {
security {
user = "root"
group = "root"
allow_core_dumps = no
}
name = "radiusd"
prefix = "/usr"
localstatedir = "/var"
logdir = "/var/log/radius"
run_dir = "/var/run/radiusd"
}
main {
name = "radiusd"
prefix = "/usr"
localstatedir = "/var"
sbindir = "/usr/sbin"
logdir = "/var/log/radius"
run_dir = "/var/run/radiusd"
libdir = "/usr/lib64/freeradius"
radacctdir = "/var/log/radius/radacct"
hostname_lookups = no
max_request_time = 30
cleanup_delay = 5
max_requests = 16384
pidfile = "/var/run/radiusd/radiusd.pid"
checkrad = "/usr/sbin/checkrad"
debug_level = 0
proxy_requests = yes
log {
stripped_names = no
auth = no
auth_badpass = no
auth_goodpass = no
colourise = yes
msg_denied = "You are already logged in - access denied"
}
resources {
}
security {
max_attributes = 200
reject_delay = 1.000000
status_server = 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.000000
response_timeouts = 1
max_outstanding = 65536
zombie_period = 40
status_check = "status-server"
ping_interval = 30
check_interval = 30
check_timeout = 4
num_answers_to_alive = 3
revive_interval = 120
limit {
max_connections = 16
max_requests = 0
lifetime = 0
idle_timeout = 0
}
coa {
irt = 2
mrt = 16
mrc = 5
mrd = 30
}
}
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
}
}
client localhost_ipv6 {
ipv6addr = ::1
require_message_authenticator = no
secret = <<< secret >>>
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
client GGSN_XXXXX {
ipaddr = XXX.XXX.XXX.0
netmask = 24
require_message_authenticator = no
secret = <<< XXXX >>>
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
client GGSN_XXXXX_2 {
ipaddr = XXX.XXX.XXX.0
netmask = 24
require_message_authenticator = no
secret = <<< XXXX >>>
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
Debugger not attached
# Creating Auth-Type = mschap
# Creating Auth-Type = eap
# Creating Auth-Type = PAP
# Creating Auth-Type = CHAP
# Creating Auth-Type = MS-CHAP
# Creating Auth-Type = digest
radiusd: #### Instantiating modules ####
modules {
# Loaded module rlm_sql
# Loading module "sql" from file /etc/raddb/mods-enabled/sql
sql {
driver = "rlm_sql_postgresql"
server = "XXXXXXXXXX"
port = 5432
login = "postgres"
password = <<< XXXXX >>>
radius_db = "postgres"
read_groups = yes
read_profiles = yes
read_clients = no
delete_stale_sessions = yes
sql_user_name = "%{User-Name}"
default_user_profile = ""
client_query = "SELECT id, nasname, shortname, type, secret, server FROM nas"
authorize_check_query = "SELECT id, UserName, Attribute, Value, Op FROM radcheck WHERE Username = '%{SQL-User-Name}' ORDER BY id"
authorize_reply_query = "SELECT id, UserName, Attribute, Value, Op FROM radreply WHERE Username = '%{SQL-User-Name}' ORDER BY id"
authorize_group_check_query = "SELECT id, GroupName, Attribute, Value, op FROM radgroupcheck WHERE GroupName = '%{SQL-Group}' ORDER BY id"
authorize_group_reply_query = "SELECT id, GroupName, Attribute, Value, op FROM radgroupreply WHERE GroupName = '%{SQL-Group}' ORDER BY id"
group_membership_query = "SELECT GroupName FROM radusergroup WHERE UserName='%{SQL-User-Name}' ORDER BY priority"
simul_count_query = "SELECT COUNT(*) FROM radacct WHERE UserName='%{SQL-User-Name}' AND AcctStopTime IS NULL"
simul_verify_query = "SELECT RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, FramedIPAddress, CallingStationId, FramedProtocol FROM radacct WHERE UserName='%{SQL-User-Name}' AND AcctStopTime IS NULL"
safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
accounting {
reference = "%{tolower:type.%{%{Acct-Status-Type}:-none}.query}"
type {
accounting-on {
query = "UPDATE radacct SET AcctStopTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctUpdateTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctSessionTime = (%{integer:Event-Timestamp} - EXTRACT(EPOCH FROM(AcctStartTime))), AcctTerminateCause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE AcctStopTime IS NULL AND NASIPAddress= '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' AND AcctStartTime <= '%S'::timestamp"
}
accounting-off {
query = "UPDATE radacct SET AcctStopTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctUpdateTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctSessionTime = (%{integer:Event-Timestamp} - EXTRACT(EPOCH FROM(AcctStartTime))), AcctTerminateCause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE AcctStopTime IS NULL AND NASIPAddress= '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' AND AcctStartTime <= '%S'::timestamp"
}
start {
query = "INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctUpdateTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_Stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, mccmnc, sgsnaddress, locationinfo, rat, imei, FramedIpAddress) VALUES('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', NULLIF('%{Realm}', ''), '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}', NULLIF('%{%{NAS-Port-ID}:-%{NAS-Port}}', ''), '%{NAS-Port-Type}', TO_TIMESTAMP(%{integer:Event-Timestamp}), TO_TIMESTAMP(%{integer:Event-Timestamp}), NULL, 0, '%{Acct-Authentic}', '%{Connect-Info}', NULL, 0, 0, '%{Called-Station-Id}', '%{Calling-Station-Id}', NULL, '%{Service-Type}', '%{Framed-Protocol}', '%{3GPP-SGSN-MCC-MNC}', '%{3GPP-SGSN-Address}', '%{3GPP-Location-Info}', '%{3GPP-RAT-Type}', '%{3GPP-IMEISV}', NULLIF('%{Framed-IP-Address}', '')::inet)"
}
interim-update {
query = "UPDATE radacct SET FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, AcctSessionTime = %{%{Acct-Session-Time}:-NULL}, AcctInterval = (%{integer:Event-Timestamp} - EXTRACT(EPOCH FROM (COALESCE(AcctUpdateTime, AcctStartTime)))), AcctUpdateTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), sgsnaddress = '%{3GPP-SGSN-Address}', locationinfo = '%{3GPP-Location-Info}', rat = '%{3GPP-RAT-Type}', AcctInputOctets = (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), AcctOutputOctets = (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint) WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}' AND AcctStopTime IS NULL"
}
stop {
query = "UPDATE radacct SET AcctStopTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctUpdateTime = TO_TIMESTAMP(%{integer:Event-Timestamp}), AcctSessionTime = COALESCE(%{%{Acct-Session-Time}:-NULL}, (%{integer:Event-Timestamp} - EXTRACT(EPOCH FROM(AcctStartTime)))), AcctInputOctets = (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), AcctOutputOctets = (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint), AcctTerminateCause = '%{Acct-Terminate-Cause}', FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, sgsnaddress = '%{3GPP-SGSN-Address}', locationinfo = '%{3GPP-Location-Info}', rat = '%{3GPP-RAT-Type}', ConnectInfo_stop = '%{Connect-Info}' WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}' AND AcctStopTime IS NULL"
}
}
}
post-auth {
reference = ".query"
query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES('%{User-Name}', '%{%{User-Password}:-Chap-Password}', '%{reply:Packet-Type}', NOW())"
}
}
rlm_sql (sql): Driver rlm_sql_postgresql (module rlm_sql_postgresql) loaded and linked
Creating attribute SQL-Group
# Loaded module rlm_utf8
# Loading module "utf8" from file /etc/raddb/mods-enabled/utf8
# Loaded module rlm_unpack
# Loading module "unpack" from file /etc/raddb/mods-enabled/unpack
# Loaded module rlm_unix
# Loading module "unix" from file /etc/raddb/mods-enabled/unix
unix {
radwtmp = "/dev/null"
}
Creating attribute Unix-Group
# Loaded module rlm_radutmp
# Loading module "sradutmp" from file /etc/raddb/mods-enabled/sradutmp
radutmp sradutmp {
filename = "/var/log/radius/sradutmp"
username = "%{User-Name}"
case_sensitive = yes
check_with_nas = yes
permissions = 420
caller_id = no
}
# Loaded module rlm_soh
# Loading module "soh" from file /etc/raddb/mods-enabled/soh
soh {
dhcp = yes
}
# Loaded module rlm_replicate
# Loading module "replicate" from file /etc/raddb/mods-enabled/replicate
# Loaded module rlm_realm
# Loading module "IPASS" from file /etc/raddb/mods-enabled/realm
realm IPASS {
format = "prefix"
delimiter = "/"
ignore_default = no
ignore_null = no
}
# Loading module "suffix" from file /etc/raddb/mods-enabled/realm
realm suffix {
format = "suffix"
delimiter = "@"
ignore_default = no
ignore_null = no
}
# Loading module "realmpercent" from file /etc/raddb/mods-enabled/realm
realm realmpercent {
format = "suffix"
delimiter = "%"
ignore_default = no
ignore_null = no
}
# Loading module "ntdomain" from file /etc/raddb/mods-enabled/realm
realm ntdomain {
format = "prefix"
delimiter = "\\"
ignore_default = no
ignore_null = no
}
# Loading module "radutmp" from file /etc/raddb/mods-enabled/radutmp
radutmp {
filename = "/var/log/radius/radutmp"
username = "%{User-Name}"
case_sensitive = yes
check_with_nas = yes
permissions = 384
caller_id = yes
}
# Loaded module rlm_preprocess
# Loading module "preprocess" from file /etc/raddb/mods-enabled/preprocess
preprocess {
huntgroups = "/etc/raddb/mods-config/preprocess/huntgroups"
hints = "/etc/raddb/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
}
# Loaded module rlm_passwd
# Loading module "etc_passwd" from file /etc/raddb/mods-enabled/passwd
passwd etc_passwd {
filename = "/etc/passwd"
format = "*User-Name:Crypt-Password:"
delimiter = ":"
ignore_nislike = no
ignore_empty = yes
allow_multiple_keys = no
hash_size = 100
}
# Loaded module rlm_pap
# Loading module "pap" from file /etc/raddb/mods-enabled/pap
pap {
normalise = yes
}
# Loaded module rlm_exec
# Loading module "ntlm_auth" from file /etc/raddb/mods-enabled/ntlm_auth
exec ntlm_auth {
wait = yes
program = "/path/to/ntlm_auth --request-nt-key --domain=MYDOMAIN --username=%{mschap:User-Name} --password=%{User-Password}"
shell_escape = yes
}
# Loaded module rlm_mschap
# Loading module "mschap" from file /etc/raddb/mods-enabled/mschap
mschap {
use_mppe = yes
require_encryption = no
require_strong = no
with_ntdomain_hack = yes
passchange {
}
allow_retry = yes
winbind_retry_with_normalised_username = no
}
# Loaded module rlm_logintime
# Loading module "logintime" from file /etc/raddb/mods-enabled/logintime
logintime {
minimum_timeout = 60
}
# Loaded module rlm_linelog
# Loading module "linelog" from file /etc/raddb/mods-enabled/linelog
linelog {
filename = "/var/log/radius/linelog"
escape_filenames = no
syslog_severity = "info"
permissions = 384
format = "This is a log message for %{User-Name}"
reference = "messages.%{%{reply:Packet-Type}:-default}"
}
# Loading module "log_accounting" from file /etc/raddb/mods-enabled/linelog
linelog log_accounting {
filename = "/var/log/radius/linelog-accounting"
escape_filenames = no
syslog_severity = "info"
permissions = 384
format = ""
reference = "Accounting-Request.%{%{Acct-Status-Type}:-unknown}"
}
# Loaded module rlm_files
# Loading module "files" from file /etc/raddb/mods-enabled/files
files {
filename = "/etc/raddb/mods-config/files/authorize"
acctusersfile = "/etc/raddb/mods-config/files/accounting"
preproxy_usersfile = "/etc/raddb/mods-config/files/pre-proxy"
}
# Loaded module rlm_expr
# Loading module "expr" from file /etc/raddb/mods-enabled/expr
expr {
safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /äéöüàâæçèéêëîïôœùûüaÿÄÉÖÜßÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ"
}
# Loaded module rlm_expiration
# Loading module "expiration" from file /etc/raddb/mods-enabled/expiration
# Loading module "exec" from file /etc/raddb/mods-enabled/exec
exec {
wait = no
input_pairs = "request"
shell_escape = yes
timeout = 10
}
# Loading module "echo" from file /etc/raddb/mods-enabled/echo
exec echo {
wait = yes
program = "/bin/echo %{User-Name}"
input_pairs = "request"
output_pairs = "reply"
shell_escape = yes
}
# Loaded module rlm_eap
# Loading module "eap" from file /etc/raddb/mods-enabled/eap
eap {
default_eap_type = "md5"
timer_expire = 60
ignore_unknown_eap_types = no
cisco_accounting_username_bug = no
max_sessions = 16384
}
# Loaded module rlm_dynamic_clients
# Loading module "dynamic_clients" from file /etc/raddb/mods-enabled/dynamic_clients
# Loaded module rlm_digest
# Loading module "digest" from file /etc/raddb/mods-enabled/digest
# Loaded module rlm_dhcp
# Loading module "dhcp" from file /etc/raddb/mods-enabled/dhcp
# Loaded module rlm_detail
# Loading module "auth_log" from file /etc/raddb/mods-enabled/detail.log
detail auth_log {
filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/auth-detail-%Y%m%d"
header = "%t"
permissions = 384
locking = no
escape_filenames = no
log_packet_header = no
}
# Loading module "reply_log" from file /etc/raddb/mods-enabled/detail.log
detail reply_log {
filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/reply-detail-%Y%m%d"
header = "%t"
permissions = 384
locking = no
escape_filenames = no
log_packet_header = no
}
# Loading module "pre_proxy_log" from file /etc/raddb/mods-enabled/detail.log
detail pre_proxy_log {
filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/pre-proxy-detail-%Y%m%d"
header = "%t"
permissions = 384
locking = no
escape_filenames = no
log_packet_header = no
}
# Loading module "post_proxy_log" from file /etc/raddb/mods-enabled/detail.log
detail post_proxy_log {
filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/post-proxy-detail-%Y%m%d"
header = "%t"
permissions = 384
locking = no
escape_filenames = no
log_packet_header = no
}
# Loading module "detail" from file /etc/raddb/mods-enabled/detail
detail {
filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d"
header = "%t"
permissions = 384
locking = no
escape_filenames = no
log_packet_header = no
}
# Loaded module rlm_date
# Loading module "date" from file /etc/raddb/mods-enabled/date
date {
format = "%b %e %Y %H:%M:%S %Z"
}
# Loaded module rlm_chap
# Loading module "chap" from file /etc/raddb/mods-enabled/chap
# Loaded module rlm_cache
# Loading module "cache_eap" from file /etc/raddb/mods-enabled/cache_eap
cache cache_eap {
driver = "rlm_cache_rbtree"
key = "%{%{control:State}:-%{%{reply:State}:-%{State}}}"
ttl = 15
max_entries = 0
epoch = 0
add_stats = no
}
# Loaded module rlm_attr_filter
# Loading module "attr_filter.post-proxy" from file /etc/raddb/mods-enabled/attr_filter
attr_filter attr_filter.post-proxy {
filename = "/etc/raddb/mods-config/attr_filter/post-proxy"
key = "%{Realm}"
relaxed = no
}
# Loading module "attr_filter.pre-proxy" from file /etc/raddb/mods-enabled/attr_filter
attr_filter attr_filter.pre-proxy {
filename = "/etc/raddb/mods-config/attr_filter/pre-proxy"
key = "%{Realm}"
relaxed = no
}
# Loading module "attr_filter.access_reject" from file /etc/raddb/mods-enabled/attr_filter
attr_filter attr_filter.access_reject {
filename = "/etc/raddb/mods-config/attr_filter/access_reject"
key = "%{User-Name}"
relaxed = no
}
# Loading module "attr_filter.access_challenge" from file /etc/raddb/mods-enabled/attr_filter
attr_filter attr_filter.access_challenge {
filename = "/etc/raddb/mods-config/attr_filter/access_challenge"
key = "%{User-Name}"
relaxed = no
}
# Loading module "attr_filter.accounting_response" from file /etc/raddb/mods-enabled/attr_filter
attr_filter attr_filter.accounting_response {
filename = "/etc/raddb/mods-config/attr_filter/accounting_response"
key = "%{User-Name}"
relaxed = no
}
# Loaded module rlm_always
# Loading module "reject" from file /etc/raddb/mods-enabled/always
always reject {
rcode = "reject"
simulcount = 0
mpp = no
}
# Loading module "fail" from file /etc/raddb/mods-enabled/always
always fail {
rcode = "fail"
simulcount = 0
mpp = no
}
# Loading module "ok" from file /etc/raddb/mods-enabled/always
always ok {
rcode = "ok"
simulcount = 0
mpp = no
}
# Loading module "handled" from file /etc/raddb/mods-enabled/always
always handled {
rcode = "handled"
simulcount = 0
mpp = no
}
# Loading module "invalid" from file /etc/raddb/mods-enabled/always
always invalid {
rcode = "invalid"
simulcount = 0
mpp = no
}
# Loading module "userlock" from file /etc/raddb/mods-enabled/always
always userlock {
rcode = "userlock"
simulcount = 0
mpp = no
}
# Loading module "notfound" from file /etc/raddb/mods-enabled/always
always notfound {
rcode = "notfound"
simulcount = 0
mpp = no
}
# Loading module "noop" from file /etc/raddb/mods-enabled/always
always noop {
rcode = "noop"
simulcount = 0
mpp = no
}
# Loading module "updated" from file /etc/raddb/mods-enabled/always
always updated {
rcode = "updated"
simulcount = 0
mpp = no
}
# Loading module "cache" from file /etc/raddb/mods-enabled/cache
cache {
driver = "rlm_cache_rbtree"
key = "%{Calling-Station-Id}"
ttl = 600
max_entries = 0
epoch = 0
add_stats = no
}
instantiate {
}
# Instantiating module "sql" from file /etc/raddb/mods-enabled/sql
postgresql {
send_application_name = no
}
rlm_sql (sql): Attempting to connect to database "postgres"
rlm_sql (sql): Initialising connection pool
pool {
start = 5
min = 3
max = 32
spare = 10
uses = 0
lifetime = 0
cleanup_interval = 30
idle_timeout = 60
retry_delay = 30
spread = no
}
rlm_sql (sql): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql_postgresql: Connecting using parameters: dbname='postgres' host='XXXXXXX' port=5432 user='postgres' password='XXXXXXX'
Connected to database 'postgres' on 'XXXXXXX' server version 100001, protocol version 3, backend PID 34557
# Instantiating module "IPASS" from file /etc/raddb/mods-enabled/realm
# Instantiating module "suffix" from file /etc/raddb/mods-enabled/realm
# Instantiating module "realmpercent" from file /etc/raddb/mods-enabled/realm
# Instantiating module "ntdomain" from file /etc/raddb/mods-enabled/realm
# Instantiating module "preprocess" from file /etc/raddb/mods-enabled/preprocess
reading pairlist file /etc/raddb/mods-config/preprocess/huntgroups
reading pairlist file /etc/raddb/mods-config/preprocess/hints
# Instantiating module "etc_passwd" from file /etc/raddb/mods-enabled/passwd
rlm_passwd: nfields: 3 keyfield 0(User-Name) listable: no
# Instantiating module "pap" from file /etc/raddb/mods-enabled/pap
# Instantiating module "mschap" from file /etc/raddb/mods-enabled/mschap
rlm_mschap (mschap): using internal authentication
# Instantiating module "logintime" from file /etc/raddb/mods-enabled/logintime
# Instantiating module "linelog" from file /etc/raddb/mods-enabled/linelog
# Instantiating module "log_accounting" from file /etc/raddb/mods-enabled/linelog
# Instantiating module "files" from file /etc/raddb/mods-enabled/files
reading pairlist file /etc/raddb/mods-config/files/authorize
reading pairlist file /etc/raddb/mods-config/files/accounting
reading pairlist file /etc/raddb/mods-config/files/pre-proxy
# Instantiating module "expiration" from file /etc/raddb/mods-enabled/expiration
# Instantiating module "eap" from file /etc/raddb/mods-enabled/eap
# Linked to sub-module rlm_eap_md5
# Linked to sub-module rlm_eap_leap
# Linked to sub-module rlm_eap_gtc
gtc {
challenge = "Password: "
auth_type = "PAP"
}
# Linked to sub-module rlm_eap_tls
tls {
tls = "tls-common"
}
tls-config tls-common {
verify_depth = 0
ca_path = "/etc/raddb/certs"
pem_file_type = yes
private_key_file = "/etc/raddb/certs/server.pem"
certificate_file = "/etc/raddb/certs/server.pem"
ca_file = "/etc/raddb/certs/ca.pem"
private_key_password = <<< secret >>>
dh_file = "/etc/raddb/certs/dh"
fragment_size = 1024
include_length = yes
auto_chain = yes
check_crl = no
check_all_crl = no
cipher_list = "DEFAULT"
cipher_server_preference = no
ecdh_curve = "prime256v1"
cache {
enable = no
lifetime = 24
max_entries = 255
}
verify {
skip_if_ocsp_ok = no
}
ocsp {
enable = no
override_cert_url = yes
url = "http://127.0.0.1/ocsp/"
use_nonce = yes
timeout = 0
softfail = no
}
}
# Linked to sub-module rlm_eap_ttls
ttls {
tls = "tls-common"
default_eap_type = "md5"
copy_request_to_tunnel = no
use_tunneled_reply = no
virtual_server = "inner-tunnel"
include_length = yes
require_client_cert = no
}
tls: Using cached TLS configuration from previous invocation
# Linked to sub-module rlm_eap_peap
peap {
tls = "tls-common"
default_eap_type = "mschapv2"
copy_request_to_tunnel = no
use_tunneled_reply = no
proxy_tunneled_request_as_eap = yes
virtual_server = "inner-tunnel"
soh = no
require_client_cert = no
}
tls: Using cached TLS configuration from previous invocation
# Linked to sub-module rlm_eap_mschapv2
mschapv2 {
with_ntdomain_hack = no
send_error = no
}
# Instantiating module "auth_log" from file /etc/raddb/mods-enabled/detail.log
rlm_detail (auth_log): 'User-Password' suppressed, will not appear in detail output
# Instantiating module "reply_log" from file /etc/raddb/mods-enabled/detail.log
# Instantiating module "pre_proxy_log" from file /etc/raddb/mods-enabled/detail.log
# Instantiating module "post_proxy_log" from file /etc/raddb/mods-enabled/detail.log
# Instantiating module "detail" from file /etc/raddb/mods-enabled/detail
# Instantiating module "cache_eap" from file /etc/raddb/mods-enabled/cache_eap
rlm_cache (cache_eap): Driver rlm_cache_rbtree (module rlm_cache_rbtree) loaded and linked
# Instantiating module "attr_filter.post-proxy" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/post-proxy
# Instantiating module "attr_filter.pre-proxy" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/pre-proxy
# Instantiating module "attr_filter.access_reject" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/access_reject
[/etc/raddb/mods-config/attr_filter/access_reject]:11 Check item "FreeRADIUS-Response-Delay" found in filter list for realm "DEFAULT".
[/etc/raddb/mods-config/attr_filter/access_reject]:11 Check item "FreeRADIUS-Response-Delay-USec" found in filter list for realm "DEFAULT".
# Instantiating module "attr_filter.access_challenge" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/access_challenge
# Instantiating module "attr_filter.accounting_response" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/accounting_response
# Instantiating module "reject" from file /etc/raddb/mods-enabled/always
# Instantiating module "fail" from file /etc/raddb/mods-enabled/always
# Instantiating module "ok" from file /etc/raddb/mods-enabled/always
# Instantiating module "handled" from file /etc/raddb/mods-enabled/always
# Instantiating module "invalid" from file /etc/raddb/mods-enabled/always
# Instantiating module "userlock" from file /etc/raddb/mods-enabled/always
# Instantiating module "notfound" from file /etc/raddb/mods-enabled/always
# Instantiating module "noop" from file /etc/raddb/mods-enabled/always
# Instantiating module "updated" from file /etc/raddb/mods-enabled/always
# Instantiating module "cache" from file /etc/raddb/mods-enabled/cache
rlm_cache (cache): Driver rlm_cache_rbtree (module rlm_cache_rbtree) loaded and linked
} # modules
radiusd: #### Loading Virtual Servers ####
server { # from file /etc/raddb/radiusd.conf
} # server
server inner-tunnel { # from file /etc/raddb/sites-enabled/inner-tunnel
# Loading authenticate {...}
# Loading authorize {...}
Ignoring "ldap" (see raddb/mods-available/README.rst)
# Loading post-proxy {...}
# Loading post-auth {...}
# Skipping contents of 'if' as it is always 'false' -- /etc/raddb/sites-enabled/inner-tunnel:330
} # server inner-tunnel
server default { # from file /etc/raddb/sites-enabled/default
# Loading authenticate {...}
# Loading authorize {...}
# Loading preacct {...}
# Loading accounting {...}
# Loading post-proxy {...}
# Loading post-auth {...}
} # server default
radiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = 127.0.0.1
port = 18120
}
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
}
}
listen {
type = "auth"
ipv6addr = ::
port = 0
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
listen {
type = "acct"
ipv6addr = ::
port = 0
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
Listening on auth address 127.0.0.1 port 18120 bound to server inner-tunnel
Listening on auth address * port 1812 bound to server default
Listening on acct address * port 1813 bound to server default
Listening on auth address :: port 1812 bound to server default
Listening on acct address :: port 1813 bound to server default
Listening on proxy address * port 42860
Listening on proxy address :: port 49805
Ready to process requests
(0) Received Accounting-Request Id 79 from XXXXX.65:59126 to XXXXX:1813 length 383
(0) NAS-IP-Address = XXXXX.65
(0) NAS-Identifier = "EPGrm"
(0) Called-Station-Id = "XXXXXXX"
(0) Framed-Protocol = GPRS-PDP-Context
(0) Service-Type = Framed-User
(0) NAS-Port-Type = Virtual
(0) NAS-Port = 63960000
(0) Calling-Station-Id = "XXXXXXX"
(0) Acct-Status-Type = Start
(0) Framed-IP-Address = XXXXXXX
(0) Acct-Session-Id = "5B876082A57A48FE"
(0) User-Name = "pcl@3g"
(0) Acct-Session-Time = 0
(0) Event-Timestamp = "Jul 15 2019 22:09:37 IDT"
(0) Acct-Authentic = Local
(0) Acct-Delay-Time = 0
(0) 3GPP-IMSI = "XXXXXXX"
(0) 3GPP-PDP-Type = 0
(0) 3GPP-Charging-Gateway-Address = 0.0.0.0
(0) 3GPP-NSAPI = "5"
(0) 3GPP-Selection-Mode = "0"
(0) 3GPP-Charging-Characteristics = "0800"
(0) 3GPP-IMEISV = "XXXXXXX"
(0) 3GPP-RAT-Type = EUTRAN
(0) 3GPP-Location-Info = XXXXXXX
(0) 3GPP-MS-Time-Zone = 0x2101
(0) 3GPP-Negotiated-DSCP = 20
(0) # Executing section preacct from file /etc/raddb/sites-enabled/default
(0) preacct {
(0) [preprocess] = ok
(0) policy acct_unique {
(0) update request {
(0) &Tmp-String-9 := "ai:"
(0) } # update request = noop
(0) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) {
(0) EXPAND %{hex:&Class}
(0) -->
(0) EXPAND ^%{hex:&Tmp-String-9}
(0) --> ^61693a
(0) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) -> FALSE
(0) else {
(0) update request {
(0) EXPAND %{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}
(0) --> 54c108aa5b0960d8231db583c6066b4c
(0) &Acct-Unique-Session-Id := 54c108aa5b0960d8231db583c6066b4c
(0) } # update request = noop
(0) } # else = noop
(0) } # policy acct_unique = noop
(0) suffix: Checking for suffix after "@"
(0) suffix: Looking up realm "3g" for User-Name = "pcl@3g"
(0) suffix: No such realm "3g"
(0) [suffix] = noop
(0) [files] = noop
(0) } # preacct = ok
(0) # Executing section accounting from file /etc/raddb/sites-enabled/default
(0) accounting {
(0) [unix] = ok
(0) cache: EXPAND %{Calling-Station-Id}
(0) cache: --> XXXXXXX
(0) cache: No cache entry found for "XXXXXXX"
(0) cache: Creating new cache entry
(0) cache: EXPAND Cache last updated at %t
(0) cache: --> Cache last updated at Mon Jul 15 22:09:37 2019
(0) cache: &reply:Reply-Message += Cache last updated at Mon Jul 15 22:09:37 2019
(0) cache: EXPAND %{randstr:ssssssssssssssssssssssssssssssss}
(0) cache: --> 3xbPqtXrBkEH9O7XtIKxbgyHlpEHCTQS
(0) cache: &reply:Class := 0x3378625071745872426b4548394f375874494b78626779486c70454843545153
(0) cache: Merging cache entry into request
(0) cache: &reply:Reply-Message += "Cache last updated at Mon Jul 15 22:09:37 2019"
(0) cache: &reply:Class := 0x3378625071745872426b4548394f375874494b78626779486c70454843545153
(0) cache: Committed entry, TTL 600 seconds
(0) [cache] = updated
(0) if (ok){
(0) if (ok) -> FALSE
(0) else {
(0) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1){
(0) EXPAND %{User-Name}
(0) --> pcl@3g
(0) SQL-User-Name set to 'pcl@3g'
rlm_sql (sql): Reserved connection (0)
(0) Executing select query: select case when exists(select * from pa.t_prov_subscribers where msisdn='XXXXXXX') then 1 else 0 end
rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 1 , fields = 1
rlm_sql (sql): Released connection (0)
Need 5 more connections to reach 10 spares
rlm_sql (sql): Opening additional connection (5), 1 of 27 pending slots used
rlm_sql_postgresql: Connecting using parameters: dbname='postgres' host='XXXXXXX' port=5432 user='postgres' password='XXXXXXX'
Connected to database 'postgres' on '10.190.101.20' server version 100001, protocol version 3, backend PID 34562
(0) EXPAND %{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}
(0) --> 0
(0) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1) -> FALSE
(0) } # else = updated
(0) [exec] = noop
(0) attr_filter.accounting_response: EXPAND %{User-Name}
(0) attr_filter.accounting_response: --> pcl@3g
(0) attr_filter.accounting_response: Matched entry DEFAULT at line 12
(0) [attr_filter.accounting_response] = updated
(0) } # accounting = updated
(0) Sent Accounting-Response Id 79 from XXXXX:1813 to XXXXX.65:59126 length 0
(0) Finished request
(0) Cleaning up request packet ID 79 with timestamp +0
Ready to process requests
(1) Received Accounting-Request Id 196 from XXXXXXX:60882 to XXXXXXX:1813 length 393
(1) NAS-IP-Address = 10.233.57.66
(1) NAS-Identifier = "EPGka"
(1) Called-Station-Id = "XXXXXXX"
(1) Framed-Protocol = GPRS-PDP-Context
(1) Service-Type = Framed-User
(1) NAS-Port-Type = Virtual
(1) NAS-Port = 1805583648
(1) Calling-Station-Id = "XXXXXXX"
(1) Acct-Status-Type = Stop
(1) Framed-IP-Address = 10.175.56.71
(1) Acct-Session-Id = "5B8760636A967DC0"
(1) User-Name = "pcl@3g"
(1) Acct-Session-Time = 4
(1) Acct-Input-Gigawords = 0
(1) Acct-Input-Octets = 12079
(1) Acct-Output-Gigawords = 0
(1) Acct-Output-Octets = 16057
(1) Acct-Terminate-Cause = User-Request
(1) Event-Timestamp = "Jul 15 2019 22:09:37 IDT"
(1) Acct-Authentic = Local
(1) Acct-Delay-Time = 0
(1) 3GPP-IMSI = "XXXXXXX"
(1) 3GPP-Charging-ID = XXXXXXX
(1) 3GPP-PDP-Type = 0
(1) 3GPP-Charging-Gateway-Address = 0.0.0.0
(1) 3GPP-NSAPI = "5"
(1) 3GPP-Session-Stop-Indicator = 255
(1) 3GPP-Selection-Mode = "0"
(1) 3GPP-Charging-Characteristics = "0800"
(1) 3GPP-RAT-Type = UTRAN
(1) 3GPP-Location-Info = XXXXXXX
(1) 3GPP-MS-Time-Zone = 0x2101
(1) 3GPP-Negotiated-DSCP = 20
(1) # Executing section preacct from file /etc/raddb/sites-enabled/default
(1) preacct {
(1) [preprocess] = ok
(1) policy acct_unique {
(1) update request {
(1) &Tmp-String-9 := "ai:"
(1) } # update request = noop
(1) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) {
(1) EXPAND %{hex:&Class}
(1) -->
(1) EXPAND ^%{hex:&Tmp-String-9}
(1) --> ^61693a
(1) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) -> FALSE
(1) else {
(1) update request {
(1) EXPAND %{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}
(1) --> 0d5309ed90e235d01efca703d8f9e5fc
(1) &Acct-Unique-Session-Id := 0d5309ed90e235d01efca703d8f9e5fc
(1) } # update request = noop
(1) } # else = noop
(1) } # policy acct_unique = noop
(1) suffix: Checking for suffix after "@"
(1) suffix: Looking up realm "3g" for User-Name = "pcl@3g"
(1) suffix: No such realm "3g"
(1) [suffix] = noop
(1) [files] = noop
(1) } # preacct = ok
(1) # Executing section accounting from file /etc/raddb/sites-enabled/default
(1) accounting {
(1) [unix] = ok
(1) cache: EXPAND %{Calling-Station-Id}
(1) cache: --> XXXXXXX
(1) cache: No cache entry found for "XXXXXXX"
(1) cache: Creating new cache entry
(1) cache: EXPAND Cache last updated at %t
(1) cache: --> Cache last updated at Mon Jul 15 22:09:37 2019
(1) cache: &reply:Reply-Message += Cache last updated at Mon Jul 15 22:09:37 2019
(1) cache: EXPAND %{randstr:ssssssssssssssssssssssssssssssss}
(1) cache: --> Wq6flKT.4GG0hrGaw/Fst.2QUGPujOUJ
(1) cache: &reply:Class := 0x577136666c4b542e3447473068724761772f4673742e3251554750756a4f554a
(1) cache: Merging cache entry into request
(1) cache: &reply:Reply-Message += "Cache last updated at Mon Jul 15 22:09:37 2019"
(1) cache: &reply:Class := 0x577136666c4b542e3447473068724761772f4673742e3251554750756a4f554a
(1) cache: Committed entry, TTL 600 seconds
(1) [cache] = updated
(1) if (ok){
(1) if (ok) -> FALSE
(1) else {
(1) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1){
(1) EXPAND %{User-Name}
(1) --> pcl@3g
(1) SQL-User-Name set to 'pcl@3g'
rlm_sql (sql): Reserved connection (1)
(1) Executing select query: select case when exists(select * from pa.t_prov_subscribers where msisdn='XXXXXXX') then 1 else 0 end
rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 1 , fields = 1
rlm_sql (sql): Released connection (1)
(1) EXPAND %{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}
(1) --> 0
(1) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1) -> FALSE
(1) } # else = updated
(1) [exec] = noop
(1) attr_filter.accounting_response: EXPAND %{User-Name}
(1) attr_filter.accounting_response: --> pcl@3g
(1) attr_filter.accounting_response: Matched entry DEFAULT at line 12
(1) [attr_filter.accounting_response] = updated
(1) } # accounting = updated
(1) Sent Accounting-Response Id 196 from XXXXXXX:1813 to XXXXXXX:60882 length 0
(1) Finished request
(1) Cleaning up request packet ID 196 with timestamp +0
Ready to process requests
(2) Received Accounting-Request Id 17 from XXXXXXX:61042 to XXXXXXX:1813 length 364
(2) NAS-IP-Address = XXXXXXX
(2) NAS-Identifier = "EPGrm"
(2) Called-Station-Id = "uwap.orange.co.il"
(2) Framed-Protocol = GPRS-PDP-Context
(2) Service-Type = Framed-User
(2) NAS-Port-Type = Virtual
(2) NAS-Port = 1531923936
(2) Calling-Station-Id = "XXXXXXX"
(2) Acct-Status-Type = Start
(2) Framed-IP-Address = XXXXXXX
(2) Acct-Session-Id = "5B876083A124DF59"
(2) Acct-Session-Time = 0
(2) Event-Timestamp = "Jul 15 2019 22:09:37 IDT"
(2) Acct-Authentic = Local
(2) Acct-Delay-Time = 0
(2) 3GPP-IMSI = "XXXXXXX"
(2) 3GPP-Charging-ID = XXXXXXX
(2) 3GPP-PDP-Type = 0
(2) 3GPP-Charging-Gateway-Address = 0.0.0.0
(2) 3GPP-SGSN-Address = XXXXXXX
(2) 3GPP-GGSN-Address = XXXXXXX
(2) 3GPP-IMSI-MCC-MNC = "XXXXXXX"
(2) 3GPP-GGSN-MCC-MNC = "XXXXXXX"
(2) 3GPP-NSAPI = "5"
(2) 3GPP-Selection-Mode = "0"
(2) 3GPP-Charging-Characteristics = "0800"
(2) 3GPP-IMEISV = "XXXXXXX"
(2) 3GPP-RAT-Type = UTRAN
(2) 3GPP-Location-Info = XXXXXXX
(2) 3GPP-MS-Time-Zone = 0x2101
(2) 3GPP-Negotiated-DSCP = 20
(2) # Executing section preacct from file /etc/raddb/sites-enabled/default
(2) preacct {
(2) [preprocess] = ok
(2) policy acct_unique {
(2) update request {
(2) &Tmp-String-9 := "ai:"
(2) } # update request = noop
(2) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) {
(2) EXPAND %{hex:&Class}
(2) -->
(2) EXPAND ^%{hex:&Tmp-String-9}
(2) --> ^61693a
(2) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) -> FALSE
(2) else {
(2) update request {
(2) EXPAND %{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}
(2) --> 74d9a4e3906fe0df4dde260697a525cb
(2) &Acct-Unique-Session-Id := 74d9a4e3906fe0df4dde260697a525cb
(2) } # update request = noop
(2) } # else = noop
(2) } # policy acct_unique = noop
(2) [suffix] = noop
(2) [files] = noop
(2) } # preacct = ok
(2) # Executing section accounting from file /etc/raddb/sites-enabled/default
(2) accounting {
(2) [unix] = noop
(2) cache: EXPAND %{Calling-Station-Id}
(2) cache: --> XXXXXXX
(2) cache: No cache entry found for "XXXXXXX"
(2) cache: Creating new cache entry
(2) cache: EXPAND Cache last updated at %t
(2) cache: --> Cache last updated at Mon Jul 15 22:09:37 2019
(2) cache: &reply:Reply-Message += Cache last updated at Mon Jul 15 22:09:37 2019
(2) cache: EXPAND %{randstr:ssssssssssssssssssssssssssssssss}
(2) cache: --> zlsUwVqj4UN9qW7cmFoGs8w/gRA29Aty
(2) cache: &reply:Class := 0x7a6c73557756716a34554e39715737636d466f477338772f6752413239417479
(2) cache: Merging cache entry into request
(2) cache: &reply:Reply-Message += "Cache last updated at Mon Jul 15 22:09:37 2019"
(2) cache: &reply:Class := 0x7a6c73557756716a34554e39715737636d466f477338772f6752413239417479
(2) cache: Committed entry, TTL 600 seconds
(2) [cache] = updated
(2) if (ok){
(2) if (ok) -> FALSE
(2) else {
(2) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1){
(2) EXPAND %{User-Name}
(2) -->
(2) SQL-User-Name set to ''
rlm_sql (sql): Reserved connection (2)
(2) Executing select query: select case when exists(select * from pa.t_prov_subscribers where msisdn='XXXXXXX') then 1 else 0 end
rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 1 , fields = 1
rlm_sql (sql): Released connection (2)
(2) EXPAND %{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}
(2) --> 0
(2) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1) -> FALSE
(2) } # else = updated
(2) [exec] = noop
(2) attr_filter.accounting_response: EXPAND %{User-Name}
(2) attr_filter.accounting_response: -->
(2) [attr_filter.accounting_response] = noop
(2) } # accounting = updated
(2) Sent Accounting-Response Id 17 from XXXXX:1813 to XXXXX.66:61042 length 0
(2) Reply-Message = "Cache last updated at Mon Jul 15 22:09:37 2019"
(2) Class = 0x7a6c73557756716a34554e39715737636d466f477338772f6752413239417479
(2) Finished request
(2) Cleaning up request packet ID 17 with timestamp +0
Ready to process requests
(3) Received Accounting-Request Id 118 from XXXXXXX:58701 to XXXXXXX:1813 length 383
(3) NAS-IP-Address = XXXXXXX
(3) NAS-Identifier = "EPGrm"
(3) Called-Station-Id = "XXXXXXX"
(3) Framed-Protocol = GPRS-PDP-Context
(3) Service-Type = Framed-User
(3) NAS-Port-Type = Virtual
(3) NAS-Port = 1540334112
(3) Calling-Station-Id = "XXXXXXX"
(3) Acct-Status-Type = Start
(3) Framed-IP-Address = XXXXXXX
(3) Acct-Session-Id = "5B876082BE39FFD4"
(3) User-Name = "pcl@3g"
(3) Acct-Session-Time = 0
(3) Event-Timestamp = "Jul 15 2019 22:09:37 IDT"
(3) Acct-Authentic = Local
(3) Acct-Delay-Time = 0
(3) 3GPP-IMSI = "XXXXXXX"
(3) 3GPP-Charging-ID = XXXXXXX
(3) 3GPP-PDP-Type = 0
(3) 3GPP-Charging-Gateway-Address = 0.0.0.0
(3) 3GPP-SGSN-Address = XXXXXXX
(3) 3GPP-GGSN-Address = XXXXXXX
(3) 3GPP-NSAPI = "5"
(3) 3GPP-Selection-Mode = "0"
(3) 3GPP-Charging-Characteristics = "0800"
(3) 3GPP-IMEISV = "XXXXXXX"
(3) 3GPP-RAT-Type = EUTRAN
(3) 3GPP-Location-Info = XXXXXXX
(3) 3GPP-MS-Time-Zone = 0x2101
(3) 3GPP-Negotiated-DSCP = 20
(3) # Executing section preacct from file /etc/raddb/sites-enabled/default
(3) preacct {
(3) [preprocess] = ok
(3) policy acct_unique {
(3) update request {
(3) &Tmp-String-9 := "ai:"
(3) } # update request = noop
(3) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) {
(3) EXPAND %{hex:&Class}
(3) -->
(3) EXPAND ^%{hex:&Tmp-String-9}
(3) --> ^61693a
(3) if (("%{hex:&Class}" =~ /^%{hex:&Tmp-String-9}/) && ("%{string:&Class}" =~ /^ai:([0-9a-f]{32})/i)) -> FALSE
(3) else {
(3) update request {
(3) EXPAND %{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}
(3) --> 25ef8bac225e1ff88676440dbc85789e
(3) &Acct-Unique-Session-Id := 25ef8bac225e1ff88676440dbc85789e
(3) } # update request = noop
(3) } # else = noop
(3) } # policy acct_unique = noop
(3) suffix: Checking for suffix after "@"
(3) suffix: Looking up realm "3g" for User-Name = "pcl@3g"
(3) suffix: No such realm "3g"
(3) [suffix] = noop
(3) [files] = noop
(3) } # preacct = ok
(3) # Executing section accounting from file /etc/raddb/sites-enabled/default
(3) accounting {
(3) [unix] = ok
(3) cache: EXPAND %{Calling-Station-Id}
(3) cache: --> XXXXXXX
(3) cache: No cache entry found for "XXXXXXX"
(3) cache: Creating new cache entry
(3) cache: EXPAND Cache last updated at %t
(3) cache: --> Cache last updated at Mon Jul 15 22:09:37 2019
(3) cache: &reply:Reply-Message += Cache last updated at Mon Jul 15 22:09:37 2019
(3) cache: EXPAND %{randstr:ssssssssssssssssssssssssssssssss}
(3) cache: --> PYIW4kxHw4LJm87S9q3ahHP/gNd6Wk0O
(3) cache: &reply:Class := 0x50594957346b784877344c4a6d383753397133616848502f674e6436576b304f
(3) cache: Merging cache entry into request
(3) cache: &reply:Reply-Message += "Cache last updated at Mon Jul 15 22:09:37 2019"
(3) cache: &reply:Class := 0x50594957346b784877344c4a6d383753397133616848502f674e6436576b304f
(3) cache: Committed entry, TTL 600 seconds
(3) [cache] = updated
(3) if (ok){
(3) if (ok) -> FALSE
(3) else {
(3) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1){
(3) EXPAND %{User-Name}
(3) --> pcl@3g
(3) SQL-User-Name set to 'pcl@3g'
rlm_sql (sql): Reserved connection (3)
(3) Executing select query: select case when exists(select * from pa.t_prov_subscribers where msisdn='XXXXXXX') then 1 else 0 end
rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 1 , fields = 1
rlm_sql (sql): Released connection (3)
(3) EXPAND %{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}
(3) --> 0
(3) if ("%{sql:select case when exists(select * from pa.t_prov_subscribers where msisdn='%{Calling-Station-Id}') then 1 else 0 end}" == 1) -> FALSE
(3) } # else = updated
(3) [exec] = noop
(3) attr_filter.accounting_response: EXPAND %{User-Name}
(3) attr_filter.accounting_response: --> pcl@3g
(3) attr_filter.accounting_response: Matched entry DEFAULT at line 12
(3) [attr_filter.accounting_response] = updated
(3) } # accounting = updated
(3) Sent Accounting-Response Id 118 from XXXXXXX:1813 to XXXXXXX:58701 length 0
(3) Finished request
(3) Cleaning up request packet ID 118 with timestamp +0
thanks
> On 15 Jul 2019, at 21:03, Jorge Pereira <jpereira@freeradius.org> wrote:
>
> The "sql" is executed from each statement? so, please share your debug
> output. https://wiki.freeradius.org/guide/radiusd-X
>
> On Mon, Jul 15, 2019 at 11:35 AM liran kessel <lirankessel@gmail.com> wrote:
>
>> I have activated rlm_cache so as to reduce the amount of times the
>> freeradius will query the DB.
>> I made the Calling-Station-Id the cache key and have added this code to
>> the accounting section:
>>
>> cache
>> if (ok){
>> sql
>> }
>> else {
>> if ("%{sql:select case when exists(select * from
>> [TABLE_NAME] where ne_id='%{Calling-Station-Id}') then 1 else 0 end}" == 1){
>> sql
>> }
>> }
>>
>> However what happens is that all Calling-Station-Ids are stored to the
>> cache and so the 2nd time I get a packet they execute the sql module.
>> How can I configure filtering of the cache in the “else” section so as to
>> decide which Calling-Station-Id to save in cache and which not?
>>
>>
>> Thanks
>> Liran
>> -
>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Jul 15, 2019, at 4:34 PM, liran kessel <lirankessel@gmail.com> wrote:
I have activated rlm_cache so as to reduce the amount of times the freeradius will query the DB.
No. You need to read the instructions in mods-available/cache. You can't just call the "cache" module and expect it to do what you want. The documentation explains how the module works.
I made the Calling-Station-Id the cache key and have added this code to the accounting section:
cache
Which does... what? Read the documentation for the "cache" module. The behaviour is explained there.
if (ok){ sql } else { if ("%{sql:select case when exists(select * from [TABLE_NAME] where ne_id='%{Calling-Station-Id}') then 1 else 0 end}" == 1){ sql } }
That doesn't do what you want. It still hits SQL for users who aren't your users.
However what happens is that all Calling-Station-Ids are stored to the cache and so the 2nd time I get a packet they execute the sql module. How can I configure filtering of the cache in the “else” section so as to decide which Calling-Station-Id to save in cache and which not?
Read the documentation for the cache module. It always caches what you tell it to cache. The solution here is to *not* cache the Calling-Station-Id. But instead cache the *status* of the user. In English, what you want is something like: cache lookup if (noop) { # user status is unknown if (check SQL for user) { update control { my-user := yes } } else { update control { my-user := no } } cache store } elsif (my-user) { sql } You will have to: * create the "my-user" attribute in raddb/dictionary * update the "cache" module to cache the "my-user" attribute * set &control:Cache-Status-Only attribute before doing the cache lookup * set the cache TTL to something reasonable (larger than 10) * update the above pseudo-code to more correct "unlang" The above will do the following: * for cached entries, ONLY hit SQL for your users, and NEVER for other users * for non-cached entries, hit SQL twice for your users, and once for other users If you set the cache TTL to a larger value (i.e. hours), then 99% of packets will hit the cache. The other thing to note is that you may want to investigate your SQL server. It should be able to handle 100's to 1000's of reads per second. And if you only have 100K users, you shouldn't be getting 100's of packets per second. So something else may be going wrong there. Either you're receiving too many packets to be normal, OR your SQL server is extremely slow. Alan DeKok.
participants (3)
-
Alan DeKok -
Jorge Pereira -
liran kessel