From 9162e491626b88f1be22eb44bbfa3df0fd439de8 Mon Sep 17 00:00:00 2001 From: Scott Ullrich <sullrich@pfsense.org> Date: Thu, 17 Feb 2005 15:18:47 +0000 Subject: Add Colins FreeRADIUS package --- packages/freeradius.xml | 66 +++++++++++++++++++++++++++++++++++++++ packages/freeradiusclients.xml | 71 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 packages/freeradius.xml create mode 100644 packages/freeradiusclients.xml diff --git a/packages/freeradius.xml b/packages/freeradius.xml new file mode 100644 index 00000000..68d6eb38 --- /dev/null +++ b/packages/freeradius.xml @@ -0,0 +1,66 @@ +<packagegui> + <name>freeradius</name> + <menu> + <name>RADIUS Users</name> + <tooltiptext>Add, edit, and delete RADIUS users.</tooltiptext> + <section>Services</section> + <configfile>freeradius.xml</configfile> + </menu> + <menu> + <name>RADIUS Clients</name> + <tooltiptext>Add, edit, and delete RADIUS clients.</tooltiptext> + <section>Services</section> + <configfile>freeradiusclients.xml</configfile> + </menu> + <additional_files_needed> + <item>http://www.pfsense.com/packages/config/freeradiusclients.xml</item> + </additional_files_needed> + <configpath>installedpackages->package->$packagename->configuration->settings</configpath> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Username</fielddescr> + <fieldname>username</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + </columnitem> + </adddeleteeditpagefields> + <fields> + <field> + <fielddescr>Username</fielddescr> + <fieldname>username</fieldname> + <description>Enter the username here</description> + <type>input</type> + </field> + <field> + <fielddescr>Password</fielddescr> + <fieldname>password</fieldname> + <description>Enter the password here</description> + <type>password</type> + </field> + <field> + <fielddescr>Username Description</fielddescr> + <fieldname>description</fieldname> + <description>Enter the description of the user here</description> + <type>input</type> + </field> + </fields> + <custom_php_command_before_form> + 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); + } + sync_package(); + </custom_php_command_before_form> + <custom_add_php_command> + sync_package(); + </custom_add_php_command> +</packagegui> \ No newline at end of file diff --git a/packages/freeradiusclients.xml b/packages/freeradiusclients.xml new file mode 100644 index 00000000..61fbe5bc --- /dev/null +++ b/packages/freeradiusclients.xml @@ -0,0 +1,71 @@ +<packagegui> + <name>freeradiusclients</name> + <menu> + <name>RADIUS Clients</name> + <tooltiptext>Add, edit, and delete RADIUS clients.</tooltiptext> + <section>Services</section> + <configfile>freeradiusclients.xml</configfile> + </menu> + <configpath>installedpackages->package->$packagename->configuration->settings</configpath> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Client</fielddescr> + <fieldname>client</fieldname> + </columnitem> + <columnitem> + <fielddescr>Shortname</fielddescr> + <fieldname>shortname</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + </columnitem> + </adddeleteeditpagefields> + <fields> + <field> + <fielddescr>Client</fielddescr> + <fieldname>client</fieldname> + <description>Enter the client's IP address here</description> + <type>input</type> + </field> + <field> + <fielddescr>Shortname</fielddescr> + <fieldname>shortname</fieldname> + <description>Enter the client's shortname here</description> + <type>input</type> + </field> + <fielddescr>Shared Secret</fielddescr> + <fieldname>sharedsecret</fieldname> + <description>Enter the client's shared secret here</description> + <type>password</type> + <field> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + <description>Enter the description of the user here</description> + <type>input</type> + </field> + </fields> + <custom_php_install_command> + global $config; + system("rm /usr/local/etc/raddb/clients*"); + $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); + </custom_php_install_command> + <custom_php_command_before_form> + function sync_package() { + global $config; + $fout = fopen("/usr/local/etc/raddb/clients.conf","w"); + if($config['installedpackages']['freeradius']['config'] != "") { + foreach($config['installedpackages']['freeradius']['config'] as $rowhelper) { + fwrite($fout, "client " . $rowhelper['client'] . "{\n" . "secret = " . $rowhelper['sharedsecret'] . "\nshortname = " . $rowhelper['shortname'] . "\n}\n\n"); + } + } + fclose($fout); + } + sync_package(); + </custom_php_command_before_form> + <custom_add_php_command> + sync_package(); + </custom_add_php_command> +</packagegui> \ No newline at end of file -- cgit v1.2.3