aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freeradius.xml
diff options
context:
space:
mode:
Diffstat (limited to 'packages/freeradius.xml')
-rw-r--r--packages/freeradius.xml105
1 files changed, 35 insertions, 70 deletions
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 @@
+<?xml version="1.0" encoding="utf-8"?>
<packagegui>
- <name>freeradius</name>
- <version>1.0.1</version>
- <title>FreeRADIUS: Users</title>
+ <include_file>freeradius.inc</include_file>
+
+ <!-- Installation -->
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/freeradiusclients.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/freeradiussettings.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/freeradius.inc</item>
+ </additional_files_needed>
+ <custom_php_install_command>
+ freeradius_install_command();
+ </custom_php_install_command>
<menu>
<name>FreeRADIUS</name>
<tooltiptext>Modify FreeRADIUS users, clients, and settings.</tooltiptext>
<section>Services</section>
- <configfile>freeradius.xml</configfile>
+ <url>/pkg.php?xml=freeradius.xml</url>
</menu>
<service>
<name>FreeRADIUS</name>
- <rcfile>freeradius.sh</rcfile>
+ <description>The FreeRADIUS daemon.</description>
+ <rcfile>radiusd.sh</rcfile>
<executable>radiusd</executable>
</service>
+
+ <!-- Interface -->
+ <name>freeradius</name>
+ <title>FreeRADIUS: Users</title>
<tabs>
<tab>
<text>Users</text>
@@ -28,16 +46,6 @@
<url>/pkg_edit.php?xml=freeradiussettings.xml&amp;id=0</url>
</tab>
</tabs>
- <additional_files_needed>
- <item>http://www.pfsense.com/packages/config/freeradiusclients.xml</item>
- </additional_files_needed>
- <additional_files_needed>
- <item>http://www.pfsense.com/packages/config/freeradiussettings.xml</item>
- </additional_files_needed>
- <additional_files_needed>
- <item>http://www.pfsense.com/packages/config/freeradiusconfig.tgz</item>
- </additional_files_needed>
- <configpath>installedpackages->package->$packagename->configuration->settings</configpath>
<adddeleteeditpagefields>
<columnitem>
<fielddescr>Username</fielddescr>
@@ -50,73 +58,30 @@
</adddeleteeditpagefields>
<fields>
<field>
- <fielddescr>Username</fielddescr>
<fieldname>username</fieldname>
- <description>Enter the username here</description>
+ <fielddescr>Username</fielddescr>
+ <description>Enter the username.</description>
+ <required/>
<type>input</type>
</field>
<field>
- <fielddescr>Password</fielddescr>
<fieldname>password</fieldname>
- <description>Enter the password here</description>
+ <fielddescr>Password</fielddescr>
+ <description>Enter the password for this username.</description>
+ <required/>
<type>password</type>
</field>
<field>
- <fielddescr>Username Description</fielddescr>
<fieldname>description</fieldname>
- <description>Enter the description of the user here</description>
+ <fielddescr>Description</fielddescr>
+ <description>You may enter a description here for your reference (not parsed).</description>
<type>input</type>
</field>
</fields>
- <custom_php_install_command>
- 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 &amp;",
- "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");
- </custom_php_install_command>
- <custom_php_global_functions>
- 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");
- }
- </custom_php_global_functions>
+ <custom_delete_php_command>
+ freeradius_users_resync();
+ </custom_delete_php_command>
<custom_php_resync_config_command>
- sync_package_freeradius();
+ freeradius_users_resync();
</custom_php_resync_config_command>
- <custom_add_php_command>
- sync_package_freeradius();
- </custom_add_php_command>
</packagegui>