I'm trying to set up a radius server using a rest backend for authentication. I used the following project as example: https://github.com/fgsants/REST-API-FreeRADIUS
Everything is setup already, and everything works if I use the following command to simulated a login on radius:
radtest bar passwd 127.0.0.1 10 testing123
The rest backend receives /user/:username/mac?action=authorize
and then /user/:username/mac?action=authenticate&password=passwd
.
When I configure the AP to use this radius server, the request seems to be different than expected and the auth fails. This is the output of the radius server when trying to login through the AP:
(0) Received Access-Request Id 105 from 172.21.0.1:46358 to 172.21.0.3:1812 length 126
(0) User-Name = "bar"
(0) NAS-IP-Address = 192.168.0.21
(0) NAS-Identifier = "RalinkAP1"
(0) NAS-Port = 0
(0) Called-Station-Id = "1A-0D-2C-1B-49-11"
(0) Calling-Station-Id = "D4-9A-20-70-F4-0E"
(0) Framed-MTU = 1400
(0) NAS-Port-Type = Wireless-802.11
(0) EAP-Message = 0x0201000801626172
(0) Message-Authenticator = 0xbffda6639904c9026259be2a45b378c4
(0) # Executing section authorize from file /etc/freeradius/3.0/sites-enabled/default
(0) authorize {
rlm_rest (rest): Reserved connection (0)
(0) rest: Expanding URI components
(0) rest: EXPAND http://rest:3000
(0) rest: --> http://rest:3000
(0) rest: EXPAND /user/%{User-Name}/mac?action=authorize
(0) rest: --> /user/bar/mac?action=authorize
(0) rest: Sending HTTP GET to "http://rest:3000/user/bar/mac?action=authorize"
(0) rest: Processing response header
(0) rest: Status : 204 (No Content)
rlm_rest (rest): Released connection (0)
Need 5 more connections to reach 10 spares
rlm_rest (rest): Opening additional connection (5), 1 of 27 pending slots used
rlm_rest (rest): Connecting to "http://rest:3000"
(0) [rest] = ok
(0) if (ok) {
(0) if (ok) -> TRUE
(0) if (ok) {
(0) update control {
(0) Auth-Type := rest
(0) } # update control = noop
(0) } # if (ok) = noop
(0) } # authorize = ok
(0) Found Auth-Type = rest
(0) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(0) Auth-Type rest {
(0) rest: ERROR: You set 'Auth-Type = REST' for a request that does not contain a User-Password attribute!
(0) [rest] = invalid
(0) } # Auth-Type rest = invalid
(0) Failed to authenticate the user
(0) Using Post-Auth-Type Reject
(0) Post-Auth-Type sub-section not found. Ignoring.
(0) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(0) Delaying response for 1.000000 seconds
Waking up in 0.2 seconds.
Waking up in 0.7 seconds.
(0) (0) Discarding duplicate request from client ipv4 port 46358 - ID: 105 due to delayed response
(0) Sending delayed response
(0) Sent Access-Reject Id 105 from 172.21.0.3:1812 to 172.21.0.1:46358 length 20
Waking up in 3.9 seconds.
(0) Cleaning up request packet ID 105 with timestamp +15
Ready to process requests
The radius server don't seem to be receiving a password from the AP:
(0) User-Name = "bar"
(0) NAS-IP-Address = 192.168.0.21
(0) NAS-Identifier = "RalinkAP1"
(0) NAS-Port = 0
(0) Called-Station-Id = "1A-0D-2C-1B-49-11"
(0) Calling-Station-Id = "D4-9A-20-70-F4-0E"
(0) Framed-MTU = 1400
(0) NAS-Port-Type = Wireless-802.11
(0) EAP-Message = 0x0201000801626172
(0) Message-Authenticator = 0xbffda6639904c9026259be2a45b378c4
So later the authorization fails:
(0) rest: ERROR: You set 'Auth-Type = REST' for a request that does not contain a User-Password attribute!
This is my configuration file:
server default {
listen {
type = auth
ipaddr = *
port = 0
limit {
max_connections = 16
lifetime = 0
idle_timeout = 30
}
}
listen {
ipaddr = *
port = 0
type = acct
limit {
}
}
authorize {
rest
if (ok) {
update control {
Auth-Type := rest
}
}
}
authenticate {
Auth-Type rest {
rest {
updated = 1
}
if (updated) {
ok
}
}
}
preacct {
preprocess
acct_unique
suffix
}
accounting {
detail
rest
}
post-auth {
update {
&reply: += &session-state:
}
}
}
What's missing? What needs to be done so I can receive the password from the access point?
Thanks