🎃

FreeRADIUSとdaloRADIUS

2023/03/02に公開

目的

UbuntuにRADIUSサーバを構築し、他者がGUIで管理できるようにdaloRADIUSを使う。

FreeRADIUSは、RADIUSを実現させるOSSです。
https://freeradius.org/

daloRADIUSは、RADIUSサーバのユーザやアカウンティングのGUI管理を行うソフトウェアです。
https://www.daloradius.com/

SSH通す

sudo apt update
sudo apt install openssh-server

FreeRADIUS

apt-get install freeradius freeradius-mysql mysql-server mysql-client

https://wiki.freeradius.org/guide/Getting-Started

radtest testing password 127.0.0.1 0 testing123
Sent Access-Request Id 38 from 0.0.0.0:35300 to 127.0.0.1:1812 length 77
	User-Name = "testing"
	User-Password = "password"
	NAS-IP-Address = 127.0.1.1
	NAS-Port = 0
	Message-Authenticator = 0x00
	Cleartext-Password = "password"
Received Access-Accept Id 38 from 127.0.0.1:1812 to 127.0.0.1:35300 length 20
Ready to process requests
(0) Received Access-Request Id 38 from 127.0.0.1:35300 to 127.0.0.1:1812 length 77
(0)   User-Name = "testing"
(0)   User-Password = "password"
(0)   NAS-IP-Address = 127.0.1.1
(0)   NAS-Port = 0
(0)   Message-Authenticator = 0x62f13b162efda65c662468b8f77c2959
(0) # Executing section authorize from file /etc/freeradius/3.0/sites-enabled/default
(0)   authorize {
(0)     policy filter_username {
(0)       if (&User-Name) {
(0)       if (&User-Name)  -> TRUE
(0)       if (&User-Name)  {
(0)         if (&User-Name =~ / /) {
(0)         if (&User-Name =~ / /)  -> FALSE
(0)         if (&User-Name =~ /@[^@]*@/ ) {
(0)         if (&User-Name =~ /@[^@]*@/ )  -> FALSE
(0)         if (&User-Name =~ /\.\./ ) {
(0)         if (&User-Name =~ /\.\./ )  -> FALSE
(0)         if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/))  {
(0)         if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/))   -> FALSE
(0)         if (&User-Name =~ /\.$/)  {
(0)         if (&User-Name =~ /\.$/)   -> FALSE
(0)         if (&User-Name =~ /@\./)  {
(0)         if (&User-Name =~ /@\./)   -> FALSE
(0)       } # if (&User-Name)  = notfound
(0)     } # policy filter_username = notfound
(0)     [preprocess] = ok
(0)     [chap] = noop
(0)     [mschap] = noop
(0)     [digest] = noop
(0) suffix: Checking for suffix after "@"
(0) suffix: No '@' in User-Name = "testing", looking up realm NULL
(0) suffix: No such realm "NULL"
(0)     [suffix] = noop
(0) eap: No EAP-Message, not doing EAP
(0)     [eap] = noop
(0) files: users: Matched entry testing at line 1
(0)     [files] = ok
(0)     [expiration] = noop
(0)     [logintime] = noop
(0)     [pap] = updated
(0)   } # authorize = updated
(0) Found Auth-Type = PAP
(0) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(0)   Auth-Type PAP {
(0) pap: Login attempt with password
(0) pap: Comparing with "known good" Cleartext-Password
(0) pap: User authenticated successfully
(0)     [pap] = ok
(0)   } # Auth-Type PAP = ok
(0) # Executing section post-auth from file /etc/freeradius/3.0/sites-enabled/default
(0)   post-auth {
(0)     if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name)) {
(0)     if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name))  -> FALSE
(0)     update {
(0)       No attributes updated for RHS &session-state:
(0)     } # update = noop
(0)     [exec] = noop
(0)     policy remove_reply_message_if_eap {
(0)       if (&reply:EAP-Message && &reply:Reply-Message) {
(0)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(0)       else {
(0)         [noop] = noop
(0)       } # else = noop
(0)     } # policy remove_reply_message_if_eap = noop
(0)     if (EAP-Key-Name && &reply:EAP-Session-Id) {
(0)     if (EAP-Key-Name && &reply:EAP-Session-Id)  -> FALSE
(0)   } # post-auth = noop
(0) Sent Access-Accept Id 38 from 127.0.0.1:1812 to 127.0.0.1:35300 length 20
(0) Finished request
Waking up in 4.9 seconds.
(0) Cleaning up request packet ID 38 with timestamp +22 due to cleanup_delay was reached

testがきちんと動いたのを確認

sql

mysql_secure_installation
mysql -u root -p
CREATE DATABASE radius;
CREATE USER 'radius'@'localhost' IDENTIFIED by 'xxxxxxxpassword';
GRANT ALL PRIVILEGES ON radius.* TO 'radius'@'localhost';
FLUSH PRIVILEGES;
quit;
mysql -u root -p radius < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql
vi /etc/freeradius/3.0/mods-enabled/sql

いい感じに設定を変更します。

daloradius

https://techexpert.tips/ja/freeradius-ja/ubuntu-linuxでのmysql統合とfreeradiusのインストール/

apt-get install apache2 php libapache2-mod-php php-mysql unzip
apt-get install php-pear php-db php-mail php-gd php-common php-mail-mime
mkdir /downloads/daloradius -p
cd /downloads/daloradius
wget https://github.com/lirantal/daloradius/archive/master.zip
unzip master.zip
mv daloradius-master /var/www/html/daloradius

DaloRadiusにアクセスする
"http://x.x.x.x/daloradius"
ログイン画面で、デフォルトのユーザ名とデフォルトのパスワードを使用する。
・デフォルトのユーザ名:administrator
・デフォルトパスワード:radius

Discussion