freeradius
1.0.1
FreeRADIUS: Users
Users
/pkg.php?xml=freeradius.xml
Clients
/pkg.php?xml=freeradiusclients.xml
Settings
/pkg_edit.php?xml=freeradiussettings.xml&id=0
- http://www.pfsense.com/packages/config/freeradiusclients.xml
- http://www.pfsense.com/packages/config/freeradiussettings.xml
- http://www.pfsense.com/packages/config/freeradiusconfig.tgz
installedpackages->package->$packagename->configuration->settings
Username
username
Description
description
Upload bandwidth
uploadbw
Kbit/s
Download bandwidth
downloadbw
Kbit/s
Username
username
Enter the username here
input
Password
password
Enter the password here
password
Username Description
description
Enter the description of the user here
input
Enable bandwidth restriction
bwrestriction
If this option is set, the captive portal will restrict this user to the bandwidth defined below.
checkbox
Upload bandwidth
uploadbw
Enter the desired upload bandwidth cap for this user in Kbit/s.
input
Download bandwidth
downloadbw
Enter the desired download bandwidth cap for this user in Kbit/s.
input
global $config;
$fout = fopen("/usr/local/etc/raddb/clients.conf","w");
fwrite($fout, "client 127.0.0.1" . "{\n" . "secret = pfsense\n" . "shortname = localhost\n}\n\n");
fclose($fout);
unlink_if_exists(/usr/local/etc/rc.d/radiusd*);
$fout = fopen("/usr/local/etc/rc.d/radiusd.sh","w");
fwrite($fout,"#!/bin/sh\n\n/usr/local/sbin/radiusd -X -d /usr/local/etc/raddb &\n");
fclose($fout);
$fout = fopen("/usr/local/etc/radiusd.conf.dynamic","w");
fwrite($fout, "{\nipaddr = 127.0.0.1\nport = 0\ntype = auth\n}\n\n");
fclose($fout);
mwexec("chmod a+x /usr/local/etc/rc.d/radiusd.sh");
mwexec("/usr/local/etc/rc.d/radiusd.sh");
function sync_package_freeradius() {
conf_mount_rw();
config_lock();
global $config;
$fout = fopen("/usr/local/etc/raddb/users","w");
fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n");
if($config['installedpackages']['freeradius']['config'] != "") {
foreach($config['installedpackages']['freeradius']['config'] as $rowhelper) {
fwrite($fout, $rowhelper['username'] . "\tUser-Password == \"" . $rowhelper['password'] . "\"\n");
if ($rowhelper['bwrestriction'] == "on") {
if (($rowhelper['uploadbw'] != "") and ($rowhelper['downloadbw'] != "")) {
fwrite($fout, "\tNomadix-Bw-Up = " . $rowhelper['uploadbw'] . ",\n");
fwrite($fout, "\tNomadix-Bw-Down = " . $rowhelper['downloadbw'] . "\n\n");
} elseif ($rowhelper['uploadbw'] != "") {
fwrite($fout, "\tNomadix-Bw-Up = " . $rowhelper['uploadbw'] . "\n\n");
} elseif ($rowhelper['downloadbw'] != "") {
fwrite($fout, "\tNomadix-Bw-Down = " . $rowhelper['downloadbw'] . "\n\n");
}
}
}
}
fclose($fout);
conf_mount_ro();
config_unlock();
mwexec("/usr/bin/killall -HUP radiusd");
}
sync_package_freeradius();
sync_package_freeradius();