Forum Discussion
irule to insert http header with values based on received radius accounting avp
I have a requirement to insert msisdn gotten from radius logs into https virtual server (http irule). It is pretty similar to this.
insert HTTP header according to a value received in Radius accounting | DevCentral
"
Radius accounting arrives with following attributes:
Acct-Status-Type=1
Calling-Station-Id=123456789
Framed-IP-Address=1.1.1.1
An entry is inserted to a table
1.1.1.1 (key) -> 123456789 (value)
HTTP request arrives from source IP 1.1.1.1
The F5 will insert a header "MSISDN: 123456789" to the HTTP request before forwarding.
Radius accounting arrives with following attributes:
Acct-Status-Type=2
Calling-Station-Id=123456789
Framed-IP-Address=1.1.1.1
The value is removed
1.1.1.1 (key) -> (empty)
HTTP request arrives from source IP 1.1.1.1
The F5 will not insert a header (not "MSISDN: 123456789" and not "MSISDN: ")
"
I have created two virtual servers. one , a radius accounting virtual server (with no pool members) on port 1813.
it uses this irule.
when CLIENT_DATA {
set avp40 [RADIUS::avp 40 integer]
set client_ip [RADIUS::avp 8 ip4]
set msisdn [RADIUS::avp 31 string]
if { $avp40 == 1 || $avp40 == 3 } {
# Start or Interim-Update → refresh TTL
table set -subtable "ip2msisdn" $client_ip $msisdn 540
} elseif { $avp40 == 2 } {
table delete -subtable "ip2msisdn" $client_ip
}
} The HTTPs virtual server with ssl termination, has following irule.
when HTTP_REQUEST {
set client_ip [IP::client_addr]
set msisdn [table lookup -subtable "ip2msisdn" $client_ip]
if { $msisdn ne "" } {
HTTP::header insert "X-MSISDN" $msisdn
HTTP::header insert "X-Auth-Status" "AUTHORIZED"
} else {
HTTP::header insert "X-Auth-Status" "UNKNOWN"
HTTP::header insert "X-MSISDN" "NOT_FOUND"
}
} we see several logs when logs are added on radius irule. Yet, we never get to see ip-msisdn match, when user browser attempts to access the website. We can confirm radius feeds are being sent by GGSN. example.
Aug 20 13:14:02 slot1/OAU info tmm6[19301]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.27.96 -> 2347038201355
Aug 20 13:14:02 slot1/OAU info tmm16[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.36.203.125
Aug 20 13:14:02 slot1/OAU info tmm6[19301]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.36.203.125
Aug 20 13:14:02 slot1/OAU info tmm16[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.27.62 -> 2347069332877
Aug 20 13:14:02 slot1/OAU info tmm8[19301]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.27.62 -> 2347069332877
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.29.44.232
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.38.116.115
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.15.231 -> 2347070645170
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.29.44.232
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS STOP: removed 10.38.116.115
Aug 20 13:14:02 slot1/OAU info tmm17[19302]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.15.231 -> 2347070645170
Aug 20 13:14:02 slot1/OAU info tmm6[19301]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.15.190 -> 2348137835053
Aug 20 13:14:02 slot1/OAU info tmm[19301]: Rule /Common/awo <CLIENT_DATA>: RADIUS START: 10.63.15.224 -> 2348140105877 . How do we force write the radius logs to memory on F5. The F5 is a VIPRION.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com