From: kkalev Date: Fri, 18 Jun 2004 13:01:56 +0000 (+0000) Subject: * Move the xlat function to a separate file in lib/xlat.php3 X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=83d5cb1204e8597ef5d125f2d5ac4e12b8b44410;p=freeradius-dialup-admin.git * Move the xlat function to a separate file in lib/xlat.php3 * Add a lib/sql/nas_list.php3 to also get the nas list from sql (naslist.conf still works) * add realms nasdb and nasadmin in username.mappings. nasadmin is used to signify if the user is allowed to use the nas_admin page. nasdb is used to shorten the nas list to only a few specific entries. That way administrator responsible for a few access servers will only be able to administer those access servers and not see the rest of the nas list. * Add username searching in the find page as suggested by joram agten * Don't use nas_list in nas_admin --- diff --git a/Changelog b/Changelog index bff65d5..32d2db1 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,12 @@ +Ver 1.72: +* Move the xlat function to a separate file in lib/xlat.php3 +* Add a lib/sql/nas_list.php3 to also get the nas list from sql (naslist.conf still works) +* add realms nasdb and nasadmin in username.mappings. nasadmin is used to signify if the + user is allowed to use the nas_admin page. nasdb is used to shorten the nas list to only + a few specific entries. That way administrator responsible for a few access servers will + only be able to administer those access servers and not see the rest of the nas list. +* Add username searching in the find page as suggested by joram agten +* Don't use nas_list in nas_admin Ver 1.70: * Add the /bin postgresql compatibility patch from Guy Fraser * Add ldap_userdn as a configuration directive. If set we use that for diff --git a/conf/admin.conf b/conf/admin.conf index 2062d0b..9ef0778 100644 --- a/conf/admin.conf +++ b/conf/admin.conf @@ -142,6 +142,12 @@ general_stats_use_totacct: no # in the badusers table # general_restrict_badusers_access: no +# +# If set to yes then we restrict access to the nas administration page only to those +# users which are allowed by their username mapping (nasadmin is set to yes) +# +general_restrict_nasadmin_access: yes + INCLUDE: %{general_base_dir}/conf/naslist.conf @@ -196,6 +202,8 @@ ldap_regular_profile_attr: dialupregularprofile # %U: username provided though http authentication # %mu: mappings for userdb # %ma: mappings for accounting +# %mn: mappings for nasdb +# %mN: mappings for nas administration # # One use of this would be to restrict access to only the user's belonging to # a specific administrator like this: diff --git a/conf/config.php3 b/conf/config.php3 index 412d884..9b10af4 100644 --- a/conf/config.php3 +++ b/conf/config.php3 @@ -80,8 +80,18 @@ if (!isset($mappings) && $config[general_username_mappings_file] != ''){ if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val)) continue; list($key,$realm,$v)=split(":[[:space:]]*",$val,2); - if ($realm == 'accounting' || $realm == 'userdb') + if ($realm == 'accounting' || $realm == 'userdb' || $realm == 'nasdb' || $realm == 'nasadmin') $mappings["$key"][$realm] = $v; + if ($realm == 'nasdb'){ + $NAS_ARR = array(); + $NAS_ARR = split(',',$v); + foreach ($nas_list as $key => $nas){ + foreach ($NAS_ARR as $nas_check){ + if ($nas_check == $nas[name]) + unset($nas_list[$key]); + } + } + } } if ($config[general_use_session] == 'yes') session_register('mappings'); diff --git a/conf/username.mappings b/conf/username.mappings index e7d7b12..3180365 100644 --- a/conf/username.mappings +++ b/conf/username.mappings @@ -2,7 +2,20 @@ # Format: # Username:realm:query # -# where realm is accounting or userdb +# where realm is: +# accounting: for the map to be used when querying the accounting db +# userdb: for the map to be used when querying the user db +# nasdb: To only map specific NASes to the username (separated by ,) +# nasadmin: To allow the user to use the nas_admin page (yes or no) # library-admin:accounting:AND nasipaddress = '123.123.123.123' library-admin:userdb:AND Admin = 'library-admin' +library-admin:nasdb:nas.lib.company.com +library-admin:nasadmin:no +# +lab-admin:accounting:AND nasipaddress = '123.123.124.123' +lab-admin:userdb:AND Admin = 'lab-admin' +lab-admin:nasdb:nas.lab.company.com +lab-admin:nasadmin:no +# +admin:nasadmin:yes diff --git a/doc/TODO b/doc/TODO index 315d454..2d71d3f 100644 --- a/doc/TODO +++ b/doc/TODO @@ -17,3 +17,4 @@ * Parse the radius dictionary files so that we can show a pull down menu of possible values for various attributes. * Check the sql user code for sql injections +* Also be able to keep username mappings in sql. Create and administration page diff --git a/htdocs/accounting.php3 b/htdocs/accounting.php3 index 1d42015..db57b45 100644 --- a/htdocs/accounting.php3 +++ b/htdocs/accounting.php3 @@ -227,7 +227,7 @@ foreach ($accounting_show_attrs as $val) $query_view = ereg_replace(',$','',$query_view); $sql_extra_query = ''; if ($config[sql_accounting_extra_query] != '') - $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config); + $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); $query="SELECT $query_view FROM $config[sql_accounting_table] $where $sql_extra_query ORDER BY $order LIMIT $maxresults;"; echo << diff --git a/htdocs/failed_logins.php3 b/htdocs/failed_logins.php3 index 23b77c4..475d84e 100644 --- a/htdocs/failed_logins.php3 +++ b/htdocs/failed_logins.php3 @@ -1,6 +1,7 @@ " . $acct_attrs['fl'][8] . "\n"; if ($acct_attrs['fl'][9] != '') echo "" . $acct_attrs['fl'][9] . "\n"; $sql_extra_query = ''; if ($config[sql_accounting_extra_query] != '') - $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config); + $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); ?> @@ -200,6 +201,8 @@ EOM; +