Initial stack: FreeRADIUS + Node API + docker-compose

This commit is contained in:
Codex Bot
2025-09-24 14:12:26 -06:00
commit 6ef48911ef
7 changed files with 189 additions and 0 deletions

7
freeradius/clients.conf Normal file
View File

@@ -0,0 +1,7 @@
client unifi {
ipaddr = %{env:RADIUS_CLIENTS_CIDR}
secret = %{env:RADIUS_SHARED_SECRET}
require_message_authenticator = no
nastype = other
}

View File

@@ -0,0 +1,22 @@
rest {
# Timeouts
connect_timeout = 4
read_timeout = 8
# Authorize: llama al API Node
authorize {
uri = "%{env:REST_ENDPOINT:-http://node:3000}/authorize"
method = "post"
body = "json"
# send_all = yes -> envía todos los atributos del paquete
# por defecto rlm_rest ya serializa atributos en JSON
}
# Accounting: opcional
accounting {
uri = "%{env:REST_ENDPOINT:-http://node:3000}/accounting"
method = "post"
body = "json"
}
}

View File

@@ -0,0 +1,43 @@
server default {
listen {
type = auth
ipaddr = *
port = 1812
}
listen {
type = acct
ipaddr = *
port = 1813
}
authorize {
# Llama a la API REST para decidir y añadir atributos
rest
# Si la API no estableció Auth-Type, aceptamos por defecto (demo)
if (!&control:Auth-Type) {
update control {
Auth-Type := Accept
}
}
}
authenticate {
# Aceptar todo cuando control:Auth-Type := Accept
Auth-Type Accept {
ok
}
}
accounting {
rest
ok
}
post-auth {
# Aquí podríamos volver a llamar a REST para atributos dinámicos
# rest
}
}