Der FreeRADIUS Server verarbeitet Anfragen sequenziell in den Phasen: Authorize → Authenticate → Post-Auth → Accounting.
Die meisten Module sind standardmäßig per Symlink aktiviert. Konfigurationen in Dateien werden von oben nach unten abgearbeitet.
| Datei / Ordner | Beschreibung |
|---|---|
| radiusd.conf | Hauptkonfigurationsdatei des RADIUS-Servers |
| clients.conf | Registrierung der Authenticatoren (Switche) |
| sites-enabled/default | Verarbeitung von Auth- und Accounting-Anfragen, EAP-TLS-Tunnelaufbau |
| sites-enabled/inner-tunnel | Austausch der Authentifizierungsdaten im TLS-Tunnel |
| mods-available/files | Authentifizierung gegen lokale Nutzerdatei (kein LDAP/SQL) |
| certs/ | Speicherort für TLS-Zertifikate |
| policy.d/ | Policy-Skripte (z.B. VLAN-Zuweisung per OU) |
EAP-TLS verwendet clientseitige Zertifikate zur Authentifizierung. Zertifikate müssen vorab unter certs/ abgelegt werden.
server default {
listen {
type = auth
ipaddr = *
port = 1812
}
authorize {
files
eap
}
authenticate {
eap
}
}
eap {
default_eap_type = tls
tls-config tls-common {
private_key_file = ${certdir}/server.key
certificate_file = ${certdir}/server.pem
ca_file = ${certdir}/ca.pem
fragment_size = 1024
include_length = yes
}
tls { tls = tls-common }
}
client aruba {
ipaddr = 10.0.10.1
secret = testing123
}
ctrl_interface=/var/run/wpa_supplicant
ap_scan=0
network={
key_mgmt=IEEE8021X
eap=TLS
identity="radiustest"
anonymous_identity="anonymous@domain"
ca_cert="/etc/wpa_supplicant/ca.pem"
client_cert="/etc/wpa_supplicant/radiustest.pem"
private_key="/etc/wpa_supplicant/radiustest.key"
eapol_flags=0
}
EAP-TTLS-PAP baut einen TLS-Tunnel auf und überträgt Zugangsdaten via PAP. Erfordert den inner-tunnel virtuellen Server.
ttls {
tls = tls-common
default_eap_type = pap
virtual_server = "inner-tunnel"
}
# inner-tunnel
server inner-tunnel {
authorize { files; pap }
authenticate {
Auth-Type PAP { pap }
}
}
EAP-PEAP-MSCHAPv2 authentifiziert gegen Active Directory via winbind. MSCHAPv2 läuft im inner-tunnel.
In AD-Umgebungen immer zuerst die Zeitsynchronisation sicherstellen!
peap {
tls = tls-common
default_eap_type = mschapv2
virtual_server = "inner-tunnel"
}
mschapv2 {}
# mschap module
mschap {
winbind_username = "%{mschap:User-Name}"
winbind_domain = "%{mschap:NT-Domain}"
}
MAB erlaubt Geräten ohne 802.1X-Supplicant den Netzwerkzugang über ihre MAC-Adresse als Identifier.
authorize {
if (!EAP-Message) {
update request {
User-Name := "%{User-Name}"
}
}
files
eap
}
Alle Zertifikate werden mit ECDSA P-256 erstellt. Der CN des Client-Zertifikats wird bei EAP-TLS als Identifier verwendet.
openssl ecparam -name prime256v1 -genkey -noout -out ca.key
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.pem \
-subj "/C=DE/ST=State/L=City/O=Org/OU=CA/CN=Org-CA"
openssl ecparam -name prime256v1 -genkey -noout -out server.key
openssl req -new -key server.key -out server.csr \
-subj "/C=DE/ST=State/L=City/O=Org/OU=RADIUS/CN=radius.org"
openssl x509 -req -in server.csr -CA ca.pem -CAkey ca.key \
-CAcreateserial -out server.pem -days 1095 -sha256
openssl ecparam -name prime256v1 -genkey -noout -out client.key
openssl req -new -key client.key -out client.csr \
-subj "/C=DE/ST=State/L=City/O=Org/OU=Users/CN=radiustest"
openssl x509 -req -in client.csr -CA ca.pem -CAkey ca.key \
-CAcreateserial -out client.pem -days 1095 -sha256
Nutzerdaten, VLAN-Zuweisungen und Firewall-Regeln werden in mods-config/files/authorize definiert.
# EAP-TTLS-PAP (SHA256 password)
radiustest SHA2-Password := 469fa782...
Tunnel-Type := VLAN,
Tunnel-Medium-Type := IEEE-802,
Tunnel-Private-Group-Id := 10
# EAP-TLS (CN matching)
radiustest TLS-Client-Cert-Common-Name := "radiustest@EXAMPLE.CORP"
Tunnel-Type := VLAN,
Tunnel-Medium-Type := IEEE-802,
Tunnel-Private-Group-Id := 10
# MAB
d481d7b536ce Auth-Type := Accept
Tunnel-Type := VLAN,
Tunnel-Medium-Type := IEEE-802,
Tunnel-Private-Group-Id := 10
# dictionary
ATTRIBUTE NAS-Filter-Rule 92 string
# authorize file
radiustest Cleartext-Password := "#radius1!"
Tunnel-Type := VLAN,
Tunnel-Medium-Type := IEEE-802,
Tunnel-Private-Group-Id := 10,
NAS-Filter-Rule := "permit in tcp from any to any 23",
NAS-Filter-Rule += "permit in ip from any to 10.10.10.1/24",
NAS-Filter-Rule += "deny in ip from any to any"
# dictionary
ATTRIBUTE Pica8-IP-Downloadable-ACL-Name 3 string
ATTRIBUTE Pica8-IP-Downloadable-ACL-Rule 2 string
radiustest Cleartext-Password := "#radius1!"
Tunnel-Type := VLAN,
Tunnel-Medium-Type := IEEE-802,
Tunnel-Private-Group-Id := 10,
Pica8-IP-Downloadable-ACL-Name := "DENY_ICMP",
Pica8-IP-Downloadable-ACL-Rule := "sequence 10 from protocol icmp ... then action discard",
Pica8-IP-Downloadable-ACL-Rule += "sequence 20 then action forward"
Um VLAN und Nutzerrollen über Active Directory zuzuweisen, wird in policy.d ein Policy-Block eingerichtet und in der jeweiligen post-auth Sektion von default und inner-tunnel angegeben. Die Zuweisung erfolgt dynamisch anhand der Organization Unit (OU), in der ein Nutzer zugeordnet ist.
Beispiel DN:
CN=radiustest,OU=VLAN100,OU=Users,DC=example,DC=org
vlan_from_ou {
if (&control:LDAP-UserDN) {
update control { Tmp-String-0 := "%{control:LDAP-UserDN}" }
}
else {
ok
return
}
if (&control:Tmp-String-0 =~ /OU=VLAN\s*([0-9]+)/i) {
update control {
Tmp-Integer-0 := "%{1}"
}
}
if (&control:Tmp-Integer-0) {
update reply {
Tunnel-Type := VLAN
Tunnel-Medium-Type := IEEE-802
Tunnel-Private-Group-Id := "%{control:Tmp-Integer-0}"
}
update control {
Tmp-Integer-0 := 0
Tmp-String-0 := ""
}
}
}
Referenzierung in default und inner-tunnel:
post-auth {
vlan_from_ou
}
aaa authentication port-access dot1x authenticator enable
aaa authentication port-access mac-auth enable
radius-server host [HOST_IP]
radius-server key [SHARED SECRET]
interface [INTERFACE]
vlan access [VLAN-ID]
aaa authentication port-access auth-mode device-mode
aaa authentication port-access auth-precedence dot1x mac-auth
aaa authentication port-access dot1x authenticator enable
set protocols dot1x aaa radius authentication server-ip [IP] port [PORT]
set protocols dot1x aaa radius authentication server-ip [IP] shared-key [KEY]
set protocols dot1x interface ge-1/1/1 auth-mode 802.1x
set protocols dot1x interface ge-1/1/1 auth-mode mac-radius
set protocols dot1x interface ge-1/1/1 host-mode single
Bei Access-Reject werden VLAN-Attribute manchmal nicht zurückgesetzt. Dies verhindert man durch explizites Löschen in der post-auth Sektion.
post-auth {
if (reject) {
update reply {
Tunnel-Type !* ANY
Tunnel-Medium-Type !* ANY
Tunnel-Private-Group-Id !* ANY
}
}
}
freeradius -X