aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freeradius.xml
diff options
context:
space:
mode:
authorFernando Lemos <fernandotcl@pfsense.org>2006-06-02 13:41:17 +0000
committerFernando Lemos <fernandotcl@pfsense.org>2006-06-02 13:41:17 +0000
commitc868bc5be8c9f7cc8b7ca91bbd36990a931d9875 (patch)
tree5bd31ed5427b8547222e5cfe496239c49a0aecac /packages/freeradius.xml
parent341ff9436ee8b6eb2c89365d3b05a00408eb0eb3 (diff)
downloadpfsense-packages-c868bc5be8c9f7cc8b7ca91bbd36990a931d9875.tar.gz
pfsense-packages-c868bc5be8c9f7cc8b7ca91bbd36990a931d9875.tar.bz2
pfsense-packages-c868bc5be8c9f7cc8b7ca91bbd36990a931d9875.zip
A working version of the FreeRADIUS package (this one writes the configuration to the right files ;)).
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>