freeradius
1.0.1
FreeRADIUS: Users
FreeRADIUS
freeradius.sh
radiusd
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
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
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);
write_rcfile(array(
"file" => "freeradius.sh",
"start" => "/usr/local/sbin/radiusd -X -d /usr/local/etc/raddb &",
"stop" => "/usr/bin/killall radiusd"
)
);
$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);
start_service("freeradius");
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();
restart_service("freeradius");
}
sync_package_freeradius();
sync_package_freeradius();