listo funcionmiento por usuario y contraseña

This commit is contained in:
2025-09-24 16:08:16 -06:00
parent 4f409cb4ec
commit c77ec9943b
9 changed files with 140 additions and 8 deletions

View File

@@ -0,0 +1,41 @@
eap {
default_eap_type = peap
timer_expire = 60
ignore_unknown_eap_types = no
cisco_accounting_username_bug = no
max_sessions = ${max_requests}
tls-config tls-common {
private_key_password = whatever
private_key_file = ${certdir}/server.pem
certificate_file = ${certdir}/server.pem
ca_file = ${cadir}/ca.pem
dh_file = ${certdir}/dh
random_file = /dev/urandom
fragment_size = 1024
include_length = yes
auto_chain = yes
}
tls {
tls = tls-common
}
ttls {
tls = tls-common
default_eap_type = pap
virtual_server = "inner-tunnel"
}
peap {
tls = tls-common
default_eap_type = mschapv2
copy_request_to_tunnel = yes
use_tunneled_reply = yes
virtual_server = "inner-tunnel"
}
mschapv2 {
}
}

View File

@@ -18,4 +18,11 @@ rest {
method = "post"
body = "json"
}
# Autorize para inner-tunnel (EAP)
authorize_inner_tunnel {
uri = "http://node:3000/authorize-inner"
method = "post"
body = "json"
}
}

View File

@@ -0,0 +1,3 @@
user1 Cleartext-Password := "contra1"
user2 Cleartext-Password := "contra2"

View File

@@ -0,0 +1,2 @@
$INCLUDE /etc/freeradius/mods-available/eap

View File

@@ -12,16 +12,23 @@ server default {
}
authorize {
# Llama a la API REST para decidir y añadir atributos
# Si es EAP (WPA-Enterprise), procesar EAP y salir para no interferir
if (&EAP-Message) {
eap
return
}
# MAC-Auth / Portal: Llama a la API REST para decidir y añadir atributos
rest
# Para laboratorio: aceptar todo siempre (MAC-Auth / pruebas)
# Laboratorio: aceptar todo en flujos no EAP
update control {
Auth-Type := Accept
}
}
authenticate {
# Aceptar todo cuando control:Auth-Type := Accept
# EAP para WPA-Enterprise
eap
# Aceptar todo cuando control:Auth-Type := Accept (no EAP)
Auth-Type Accept {
ok
}
@@ -33,7 +40,7 @@ server default {
}
post-auth {
# Aquí podríamos volver a llamar a REST para atributos dinámicos
# rest
# Añadir atributos dinámicos (VLAN/BW) también en EAP (outer reply)
rest
}
}

View File

@@ -0,0 +1,29 @@
server inner-tunnel {
listen {
type = auth
ipaddr = 127.0.0.1
port = 18120
}
authorize {
# Primero obtenemos credenciales del usuario desde el API
rest.authorize_inner_tunnel
# Luego dejamos que EAP procese (PEAP/MSCHAPv2)
eap
# mschap puede establecer Auth-Type si procede
mschap
}
authenticate {
# Autenticación EAP (PEAP/MSCHAPv2)
eap
Auth-Type MS-CHAP {
mschap
}
}
post-auth {
# Aquí podríamos añadir lógica adicional de auditoría si se desea
# No agregamos atributos de reply aquí; se añadirán en el outer post-auth
}
}