freeradius
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
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);
mwexec("rm /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 -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()
{
global $config;
$fout = fopen("/usr/local/etc/raddb/users","w");
if($config['installedpackages']['freeradius']['config'] != "") {
foreach($config['installedpackages']['freeradius']['config'] as $rowhelper) {
fwrite($fout, $rowhelper['username'] . " User-Password == \"" . $rowhelper['password'] . "\"\n");
}
}
fclose($fout);
mwexec("/usr/bin/killall radiusd");
mwexec("/usr/local/etc/rc.d/radiusd.sh");
}
sync_package();