diff options
author | Martin Fuchs <mfuchs@pfsense.org> | 2007-12-21 12:08:44 +0000 |
---|---|---|
committer | Martin Fuchs <mfuchs@pfsense.org> | 2007-12-21 12:08:44 +0000 |
commit | dd11a3d783e1ca18ac1e4296930541897a6b4160 (patch) | |
tree | 93f3d850aa277f61a44014abbed8e9d52e5836ca | |
parent | 53772847dd7973f2f1337df9d33fb1954234b818 (diff) | |
download | pfsense-packages-dd11a3d783e1ca18ac1e4296930541897a6b4160.tar.gz pfsense-packages-dd11a3d783e1ca18ac1e4296930541897a6b4160.tar.bz2 pfsense-packages-dd11a3d783e1ca18ac1e4296930541897a6b4160.zip |
freeradius-patches from forum-user 'cybrsrfr' comitted
-rw-r--r-- | packages/freeradius.inc | 84 | ||||
-rw-r--r-- | packages/freeradius.xml | 77 |
2 files changed, 153 insertions, 8 deletions
diff --git a/packages/freeradius.inc b/packages/freeradius.inc index 29736eca..3b173edf 100644 --- a/packages/freeradius.inc +++ b/packages/freeradius.inc @@ -251,6 +251,36 @@ modules { allowed-servicetype = Framed-User cache-size = 5000 } + + counter weekly { + filename = \${raddbdir}/db.weekly + key = User-Name + count-attribute = Acct-Session-Time + reset = weekly + counter-name = Weekly-Session-Time + check-name = Max-Weekly-Session + cache-size = 5000 + } + + counter monthly { + filename = \${raddbdir}/db.monthly + key = User-Name + count-attribute = Acct-Session-Time + reset = monthly + counter-name = Monthly-Session-Time + check-name = Max-Monthly-Session + cache-size = 5000 + } + + counter forever { + filename = \${raddbdir}/db.forever + key = User-Name + count-attribute = Acct-Session-Time + reset = never + counter-name = Forever-Session-Time + check-name = Max-Forever-Session + cache-size = 5000 + } always fail { rcode = fail @@ -298,7 +328,10 @@ modules { instantiate { exec expr - #daily + daily + weekly + monthly + forever } authorize { @@ -316,7 +349,10 @@ authorize { #sql #etc_smbpasswd #ldap - #daily + daily + weekly + monthly + forever #checkval } @@ -350,7 +386,10 @@ preacct { accounting { detail - #daily + daily + weekly + monthly + forever unix radutmp #sradutmp @@ -398,8 +437,43 @@ function freeradius_users_resync() { $conf = ''; $users = $config['installedpackages']['freeradius']['config']; if (is_array($users)) { - foreach ($users as $user) - $conf .= "{$user['username']}\tUser-Password == \"{$user['password']}\"\n"; + foreach ($users as $user) { + $username = $user['username']; + $password = $user['password']; + $multiconnet = $user['multiconnet']; + $ip = $user['ip']; + $x=$user['expiration']; + $sessiontime=$user['sessiontime']; + $onlinetime=$user['onlinetime']; + $atrib=''; + $head="$username User-Password == ".'"'.$password.'" '; + if ($multiconnect <> '') + { + $head .=", Simultaneous-Use += $multiconnet"; + } + if ($x <> '') + { + $head .=", Expiration := ".'"'.$x.'"'; + } + if ($ip <> '') + { + $atrib .="\r\n\tFramed-IP-Address = $ip,"; + } + if ($sessiontime <> '') + { + $atrib .="\r\n\tSession-Timeout := $sessiontime,"; + } + if ($onlinetime <> '') + { + $head .=", Login-Time := ". '"' . $onlinetime .'"'; + } + + $conf .= <<<EOD +$head + $atrib + +EOD; + } } $filename = RADDB . '/users'; file_put_contents($filename, $conf); diff --git a/packages/freeradius.xml b/packages/freeradius.xml index bfb755b8..514ebfba 100644 --- a/packages/freeradius.xml +++ b/packages/freeradius.xml @@ -84,8 +84,24 @@ <fieldname>username</fieldname> </columnitem> <columnitem> - <fielddescr>Description</fielddescr> - <fieldname>description</fieldname> + <fielddescr>IP address</fielddescr> + <fieldname>ip</fieldname> + </columnitem> + <columnitem> + <fielddescr>Multiple Connection</fielddescr> + <fieldname>multiconnet</fieldname> + </columnitem> + <columnitem> + <fielddescr>Expiration</fielddescr> + <fieldname>expiration</fieldname> + </columnitem> + <columnitem> + <fielddescr>Session time</fielddescr> + <fieldname>sessiontime</fieldname> + </columnitem> + <columnitem> + <fielddescr>Online time</fielddescr> + <fieldname>onlinetime</fieldname> </columnitem> </adddeleteeditpagefields> <additional_files_needed> @@ -119,8 +135,63 @@ <required/> </field> <field> - <fielddescr>Description</fielddescr> + <fieldname>ip</fieldname> + <fielddescr>Ip address</fielddescr> + <description>If you want this user to be assigned a specific IP address from radius, enter the IP +address here. Continuous IP address is available with "+" suffix(example:192.168.1.5+. It may help for assigning the +different IP address to multiple simultaneous connections). IMPORTANT, you MUST ener an IP address here if you checked +"RADIUS issued IP's" on vpn pptp or vpn pppoe configuration.</description> + <type>input</type> + </field> + <field> + <fieldname>multiconnet</fieldname> + <fielddescr>Number of Multiple connection</fielddescr> + <description>The available number of multiple simultaneous connections with this username.</description> + <required/> + <type>input</type> + </field> + <field> + <fieldname>expiration</fieldname> + <fielddescr>Expiration</fielddescr> + <description>You may enter the date that this account will stop working here.use Mmm dd yyyy example: 01 Jan 2007 will be Jan 01 2007</description> + <type>input</type> + </field> + <field> + <fieldname>sessiontime</fieldname> + <fielddescr>Session time</fielddescr> + <description>Time this user has until relogin in seconds</description> + <type>input</type> + </field> + <field> + <fieldname>onlinetime</fieldname> + <fielddescr>Online time</fielddescr> + <description>A time string may be a list of simple time strings separated with vertical bars `|' or commas `,'. + +Each simple time string must begin either with a day-of-week abbreviation (one of `Su', `Mo', `Tu', `We', `Th', `Fr', `Sa'), or `Wk' for any day from Monday to Friday inclusive, or `Any' or `Al' for any day. + +Following the day may be a range of hours separated with a hyphen, using 24-hour time. The range of hours may cross 0; for example `2300-0700' means any time except 7 AM to 11 PM. If no time is given, calls may be made at any time on the specified day(s). + +The time string may also be the single word `Never', which does not match any time. + +Here are a few sample time strings with an explanation of what they mean. + +`Wk2305-0855,Sa,Su2305-1655' + + This means weekdays before 8:55 AM or after 11:05 PM, any time Saturday, or Sunday before 4:55 PM or after 11:05 PM. These are approximately the times during which night rates apply to phone calls in the U.S.A. Note that this time string uses, for example, `2305' rather than `2300'; this will ensure a cheap rate even if the computer clock is running up to five minutes ahead of the real time. + +`Wk0905-2255,Su1705-2255' + + This means weekdays from 9:05 AM to 10:55 PM, or Sunday from 5:05 PM to 10:55 PM. This is approximately the opposite of the previous example. + +`Any' + + This means any day. Since no time is specified, it means any time on any day. </description> + + <type>input</type> + </field> + <field> <fieldname>description</fieldname> + <fielddescr>Description</fielddescr> <description>You may enter a description here for your reference (not parsed).</description> <type>input</type> </field> |