DaloRADIUSauf Debian, Apache2, MariaDB, Freeradius
DaloRADIUS ist eine web-grafische Oberfläche für die Verwaltung des Freeradius Servers. Alle benötigte Daten befinden sich, bzw. werden in der MySQL Datenbank auf dem Freeradius geschrieben. Nach der Installation und Konfiguration können wir alle Angaben per WEB-Interface durchführen. Eingaben per Shell sind nicht mehr notwendig.
Die benötigte Dienste
- im Netz sollte schon ein DHCP- und DNS-Dienst vorhanden sein.
- WEB-Dienst wie z.B. Apache2 muss man installieren,
- Datenbank MySQL bzw. MariaDB muss vorhanden sein,
- Freeradius wird installiert,
- daloRadius wird zur Verfügung gestellt und entsprechend konfiguriert.
Serverdaten
Betriebssystem: Debian 11
Servername: dalofree1
IP-Adresse: 172.16.0.8
Netmask: 255.255.252.0
Gateway: 172.16.0.1
DNS: 172.16.0.10 (ist schon im Netz vorhanden)
DNS-Suffix: schule.wlan

root@dalofree1:~# apt -y install php-{gd,common,mail,mail-mime,mysql,pear,mbstring,xml,curl}

root@dalofree1:~# apt policy mariadb-server
root@dalofree1:~# systemctl status mariadb
root@dalofree1:~# mysql_secure_installation
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password: secret+-
Re-enter new password: secret+-
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n]
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

Wir logen uns in die MariaDB als root ein. Es wird das MariaDB root-Passwort verwendet. Alle benötigte Daten werden angelegt und danach veralssen wir MariaDB.
MariaDB [(none)]> CREATE DATABASE dalofreedb;
MariaDB [(none)]> GRANT ALL ON dalofreedb.* TO dalofreeuser@localhost IDENTIFIED BY "dalosecret";
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

root@dalofree1:~# systemctl enable freeradius.service

Kurz gesagt, es werden Tabellen in unserer dalofreedb angelegt.

MariaDB [(none)]> use dalofreedb;
MariaDB [dalofreedb]> show tables;
MariaDB [dalofreedb]> exit;
| Tables_in_dalofreedb |
+----------------------+
| nas |
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radpostauth |
| radreply |
| radusergroup |
+----------------------+

Zuerst erstellen wir einen Link, damit das SQL-Modul aktiv wird und danach bearbeiten wir.
root@dalofree1:~# nano /etc/freeradius/3.0/mods-enabled/sql
...
dialect = "mysql"
driver = "rlm_sql_mysql"
...
server = "localhost"
port = 3306
login = "dalofreeuser"
password = "dalosecret"
...
radius_db = "dalofreedb"
}
....
read_clients = yes
client_table = "nas"

root@dalofree1:~# chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/sql

# If any of the files below are set, TLS encryption is enabled
# tls {
# ca_file = "/etc/ssl/certs/my_ca.crt"
# ca_path = "/etc/ssl/certs/"
# certificate_file = "/etc/ssl/certs/private/client.crt"
# private_key_file = "/etc/ssl/certs/private/client.key"
# cipher = "DHE-RSA-AES256-SHA:AES128-SHA"
#
# tls_required = yes
# tls_check_cert = no
# tls_check_cert_cn = no
# }

root@dalofree1:/# systemctl status freeradius.service

root@dalofree1:~# wget https://github.com/lirantal/daloradius/archive/master.zip
root@dalofree1:~# unzip master.zip
root@dalofree1:~# mv daloradius-master /var/www/html/daloradius

root@dalofree1:~# pear install MDB2

SQL-Anweisung.
root@dalofree1:~# mysql -u root -p radiusdb < contrib/db/fr2-mysql-daloradius-and-freeradius.sql
root@dalofree1:~# mysql -u root -p radiusdb < contrib/db/mysql-daloradius.sql

root@dalofree1:~# chown -R www-data:www-data /var/www/html/daloradius
root@dalofree1:~# cd /var/www/html/daloradius/library/
root@dalofree1:~# mv daloradius.conf.php.sample daloradius.conf.php
root@dalofree1:~# chmod 664 /var/www/html/daloradius/library/daloradius.conf.php

$configValues['CONFIG_DB_ENGINE'] = 'mysqli';
$configValues['CONFIG_DB_HOST'] = 'localhost';
$configValues['CONFIG_DB_PORT'] = '3306';
$configValues['CONFIG_DB_USER'] = 'dalofreeuser';
$configValues['CONFIG_DB_PASS'] = 'dalosecret';
$configValues['CONFIG_DB_NAME'] = 'dalofreedb';

http://<IP-Adresse>/daloradius/login.php. In unserem Fall wäre das http://172.16.0.8/daloradius/login.php
Die Standard Logindaten sind Benutzer: administrator und Passwort: radius









Wir haben jetzt einen Freeradius-Server aufgesetzt, der MySQL bzw. MariaDB Datenbank nutzt und die Verwaltung realisieren wir mit der grafischen WEB-Oberfläche.
Wir können noch einiger Sachen verfeinern, z.B.
- Wenn wir mehrerer daloRADIUS-Server nutzen, können wir z.B. in Apache virtuelle Server setzen.
- Wir können eigene Zertifikate erstellen und diese einsetzen. In so einem Fall sollten wir zuerst die Zertifikate für die Konfiguration des Freeradius-Servers erstellen (lesen Sie z.B. diesen Artikel)
Danach muss man noch die Datei /etc/freeradius/3.0/mods-enabled/eap bearbeiten, anpassen.
Es handel sich um die folgende Einträge
private_key_file =
certificate_file =
ca_file=
private_key_password = whatever
# private_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
private_key_file = /etc/freeradius/3.0/certs/server.key
...
# certificate_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
certificate_file = /etc/freeradius/3.0/certs/server.pem
...
# ca_file = /etc/ssl/certs/ca-certificates.crt
ca_file = /etc/freeradius/3.0/certs/ca.pem
Nach dem Neustart des Freradius-Servers sollte alles bestens funktionieren.