From c868bc5be8c9f7cc8b7ca91bbd36990a931d9875 Mon Sep 17 00:00:00 2001 From: Fernando Lemos Date: Fri, 2 Jun 2006 13:41:17 +0000 Subject: A working version of the FreeRADIUS package (this one writes the configuration to the right files ;)). --- packages/freeradius.inc | 438 ++++++++++++++++++++++++++++++++++++++++ packages/freeradius.xml | 105 ++++------ packages/freeradiusclients.xml | 48 ++--- packages/freeradiussettings.xml | 46 ++--- 4 files changed, 503 insertions(+), 134 deletions(-) create mode 100644 packages/freeradius.inc (limited to 'packages') diff --git a/packages/freeradius.inc b/packages/freeradius.inc new file mode 100644 index 00000000..cdc7a422 --- /dev/null +++ b/packages/freeradius.inc @@ -0,0 +1,438 @@ + diff --git a/packages/freeradius.xml b/packages/freeradius.xml index 279ff469..0f4af220 100644 --- a/packages/freeradius.xml +++ b/packages/freeradius.xml @@ -1,18 +1,36 @@ + - freeradius - 1.0.1 - FreeRADIUS: Users + freeradius.inc + + + + http://www.pfsense.org/packages/config/freeradiusclients.xml + + + http://www.pfsense.org/packages/config/freeradiussettings.xml + + + http://www.pfsense.org/packages/config/freeradius.inc + + + freeradius_install_command(); + FreeRADIUS Modify FreeRADIUS users, clients, and settings.
Services
- freeradius.xml + /pkg.php?xml=freeradius.xml
FreeRADIUS - freeradius.sh + The FreeRADIUS daemon. + radiusd.sh radiusd + + + freeradius + FreeRADIUS: Users Users @@ -28,16 +46,6 @@ /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 @@ -50,73 +58,30 @@ - Username username - Enter the username here + Username + Enter the username. + input - Password password - Enter the password here + Password + Enter the password for this username. + password - Username Description description - Enter the description of the user here + Description + You may enter a description here for your reference (not parsed). 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); - chmod("/usr/local/etc/raddb/users", 0600); - conf_mount_ro(); - config_unlock(); - restart_service("freeradius"); - } - + + freeradius_users_resync(); + - sync_package_freeradius(); + freeradius_users_resync(); - - sync_package_freeradius(); -
diff --git a/packages/freeradiusclients.xml b/packages/freeradiusclients.xml index c24d01eb..d3dc95ec 100644 --- a/packages/freeradiusclients.xml +++ b/packages/freeradiusclients.xml @@ -1,6 +1,8 @@ + freeradiusclients FreeRADIUS: Clients + freeradius.inc Users @@ -16,7 +18,6 @@ /pkg_edit.php?xml=freeradiussettings.xml&id=0 - installedpackages->package->$packagename->configuration->settings Client @@ -33,52 +34,37 @@ - Client client - Enter the client's IP address here + Client + Enter the client's IP address. input + - Shortname shortname - Enter the client's shortname here + Shortname + Enter the client's shortname. input + - Shared Secret sharedsecret + Shared Secret Enter the client's shared secret here password + - Description description + Description Enter the description of the user here input - - function sync_package_freeradius_clients() { - conf_mount_rw(); - config_lock(); - global $config; - $fout = fopen("/usr/local/etc/raddb/clients.conf","w"); - fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); - fwrite($fout, "client 127.0.0.1" . "{\n" . "secret = pfsense\n" . "shortname = localhost\n}\n\n"); - if($config['installedpackages']['freeradiusclients']['config'] != "") { - foreach($config['installedpackages']['freeradiusclients']['config'] as $rowhelper) { - fwrite($fout, "client " . $rowhelper['client'] . "{\n" . "secret = " . $rowhelper['sharedsecret'] . "\nshortname = " . $rowhelper['shortname'] . "\n}\n\n"); - } - } - fclose($fout); - conf_mount_ro(); - config_unlock(); - restart_service("freeradius"); - } - sync_package_freeradius_clients(); - - - sync_package_freeradius_clients(); - + + freeradius_clients_resync(); + + + freeradius_clients_resync(); + - diff --git a/packages/freeradiussettings.xml b/packages/freeradiussettings.xml index 7db3402d..91c1cd63 100644 --- a/packages/freeradiussettings.xml +++ b/packages/freeradiussettings.xml @@ -1,6 +1,8 @@ + freeradiussettings FreeRADIUS: Settings + freeradius.inc pkg_edit.php?xml=freeradiussettings.xml&id=0 @@ -17,47 +19,25 @@ - installedpackages->package->$packagename->configuration->settings - Listening Interface(s) interface - Enter the desired listening interface here + Listening Interface(s) + Enter the desired listening interface here. interfaces_selection + - Port port - Enter the desired port here (default 1812) + Port + Enter the port the RADIUS server will listen on. Leave blank to default to the system default, i.e., 1892. input - - function sync_package_freeradius_settings() { - conf_mount_rw(); - config_lock(); - global $config; - $fout = fopen("/usr/local/etc/raddb/radiusd.conf.dynamic","w"); - fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); - $int = convert_friendly_interface_to_real_interface_name($config['installedpackages']['freeradiussettings']['config']['0']['interface']); - $int_ip = find_interface_ip($int); - $port = $config['installedpackages']['freeradiussettings']['config'][0]['port']; - fwrite($fout, "{\nipaddr = " . $int_ip); - if($port != "") { - fwrite($fout, "port = " . $port . "\n"); - } else { - fwrite($fout, "port = 0\n"); - } - fwrite($fout, "type = auth\n}\n\n"); - fwrite($fout, "{\nipaddr = 127.0.0.1\nport = 0\ntype = auth\n}\n\n"); - fclose($fout); - conf_mount_ro(); - config_unlock(); - restart_service("freeradius"); - } - - - sync_package_freeradius_settings(); - + + freeradius_settings_resync(); + + + freeradius_settings_resync(); + - -- cgit v1.2.3