Итак, я установил сервер freeradius 3.0 на Debian 9, следуя официальной документации. Вот и Вот. У меня есть файл authorized_mac с адресами моих устройств и в файле /etc/freeradius/3.0/mods-enabled/files
Я указал, в каком файле находятся мои MAC-адреса:
files authorized_macs {
# The default key attribute to use for matches. The content
# of this attribute is used to match the "name" of the
# entry.
key = "%{Calling-Station-ID}"
usersfile = ${confdir}/authorized_macs
# If you want to use the old Cistron 'users' file
# with FreeRADIUS, you should change the next line
# to 'compat = cistron'. You can the copy your 'users'
# file from Cistron.
#compat = no
}
Моя точка доступа Wi-Fi отправляет MAC-адреса на сервер RADIUS в формате 1A: 2B: 3C: 4D: 5E: 6F, но чтобы быть уверенным, что проблема не оттуда, мой authorized_macs
файл выглядит так:
1A:2B:3C:4D:5E:6F
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
1a:2b:3c:4d:5e:6f
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
1A2B3C4D5E6F
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
1a2b3c4d5e6f
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
1A-2B-3C-4D-5E-6F
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
1a-2b-3c-4d-5e-6f
Reply-Message = "Device with MAC Address %{Calling-Station-Id} authorized for network access"
Поэтому, когда я запускаю сервер freeradius в режиме отладки (freeradius -X
) и попробуйте подключиться к SSID с моим устройством, возникает ошибка:
[...] -- line 777
(0) pap: WARNING: No "known good" password found for the user. Not setting Auth-Type
(0) pap: WARNING: Authentication will fail unless a "known good" password is available
(0) [pap] = noop
(0) } # authorize = ok
(0) ERROR: No Auth-Type found: rejecting the user via Post-Auth-Type = Reject
(0) Failed to authenticate the user
(0) Using Post-Auth-Type Reject
[...] -- line 783
Полные логи доступны здесь. Для информации: 10.42.0.7 - мой сервер freeradius, а 10.42.0.22 - моя точка доступа Wi-Fi. SSID называется "testtt".
TL; DR: Конфигурация верна согласно официальной документации. Точка доступа Wi-Fi и freeradius хорошо соединены друг с другом, но сервер radius, похоже, не знает адреса, даже если они были даны ...
РЕДАКТИРОВАТЬ
Вот конец файла /etc/freeradius/3.0/sites-enabled/default
:
server {
authorize {
preprocess
# If cleaning up the Calling-Station-Id...
rewrite_calling_station_id
# Now check against the authorized_macs file
authorized_macs
if (!ok) {
# No match was found, so reject
reject
}
else {
# The MAC address was found, so update Auth-Type
# to accept this auth.
update control {
Auth-Type := Accept
}
}
}
}
Задача решена.
Фрагмент кода, который я показал в моем EDIT, не следует добавлять в конец файла. Фактически, раздел «авторизация» уже существует, и только его нужно добавить после него (строка 281):
rewrite_calling_station_id
# Now check against the authorized_macs file
authorized_macs
if (!ok) {
# No match was found, so reject
reject
}
else {
# The MAC address was found, so update Auth-Type
# to accept this auth.
update control {
Auth-Type := Accept
}
}