From cb9137cf600b7f57bd9028b185c5a3fd0e765316 Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 15 Jan 2002 14:45:21 +0000 Subject: [PATCH] Add the dialup_admin web interface. Hope everything works fine --- AUTHORS | 14 + Changelog | 130 +++++++ FAQ | 28 ++ README | 85 +++++ TODO | 12 + bin/clean_radacct | 26 ++ bin/log_badlogins | 87 +++++ bin/showmodem | 89 +++++ bin/snmpfinger | 16 + conf/admin.conf | 99 ++++++ conf/auth.request | 1 + conf/config.php3 | 14 + conf/default.vals | 16 + conf/extra.ldap-attrmap | 3 + conf/sql.attrmap | 39 +++ conf/sql.attrs | 27 ++ conf/user_edit.attrs | 33 ++ htdocs/about.html | 52 +++ htdocs/accounting.php3 | 268 +++++++++++++++ htdocs/badusers.php3 | 150 ++++++++ htdocs/buttons.html | 73 ++++ htdocs/content.html | 9 + htdocs/help/dialup_access_help.html | 36 ++ htdocs/help/framed_compression_help.html | 38 +++ htdocs/help/framed_ip_address_help.html | 40 +++ htdocs/help/help.php3 | 44 +++ htdocs/help/lock_message_help.html | 36 ++ htdocs/help/login_time_help.html | 49 +++ htdocs/help/port_limit_help.html | 35 ++ htdocs/help/simultaneous_use_help.html | 35 ++ htdocs/images/bg.gif | Bin 0 -> 501 bytes htdocs/images/black.gif | Bin 0 -> 49 bytes htdocs/images/greenlines1.gif | Bin 0 -> 68 bytes htdocs/images/logo2.gif | Bin 0 -> 2409 bytes htdocs/images/pixel.gif | Bin 0 -> 43 bytes htdocs/images/title2.gif | Bin 0 -> 6870 bytes htdocs/index.html | 17 + htdocs/password.php3 | 22 ++ htdocs/stats.php3 | 158 +++++++++ htdocs/style.css | 32 ++ htdocs/user_accounting.php3 | 185 ++++++++++ htdocs/user_admin.php3 | 225 ++++++++++++ htdocs/user_delete.php3 | 76 +++++ htdocs/user_edit.php3 | 134 ++++++++ htdocs/user_finger.php3 | 152 +++++++++ htdocs/user_new.php3 | 145 ++++++++ htdocs/user_state.php3 | 55 +++ htdocs/user_test.php3 | 184 ++++++++++ html/stats.html.php3 | 270 +++++++++++++++ html/user_admin.html.php3 | 413 +++++++++++++++++++++++ html/user_toolbar.html.php3 | 18 + lib/acctshow.php3 | 13 + lib/add_badusers.php3 | 25 ++ lib/attrshow.php3 | 11 + lib/crypt/clear.php3 | 6 + lib/crypt/crypt.php3 | 12 + lib/crypt/md5.php3 | 6 + lib/defaults.php3 | 11 + lib/functions.php3 | 100 ++++++ lib/lang/default/utf8.php3 | 11 + lib/lang/el/utf8.php3 | 49 +++ lib/ldap/attrmap.php3 | 21 ++ lib/ldap/change_attrs.php3 | 67 ++++ lib/ldap/change_passwd.php3 | 20 ++ lib/ldap/create_user.php3 | 58 ++++ lib/ldap/defaults.php3 | 41 +++ lib/ldap/delete_user.php3 | 14 + lib/ldap/functions.php3 | 27 ++ lib/ldap/password_check.php3 | 23 ++ lib/ldap/personattrs.php3 | 11 + lib/ldap/user_info.php3 | 48 +++ lib/sql/attrmap.php3 | 11 + lib/sql/change_attrs.php3 | 57 ++++ lib/sql/change_passwd.php3 | 41 +++ lib/sql/create_user.php3 | 63 ++++ lib/sql/delete_user.php3 | 33 ++ lib/sql/drivers/mysql/functions.php3 | 58 ++++ lib/sql/drivers/pg/functions.php3 | 87 +++++ lib/sql/functions.php3 | 33 ++ lib/sql/password_check.php3 | 35 ++ lib/sql/user_info.php3 | 62 ++++ sql/badusers.sql | 10 + sql/userinfo.sql | 14 + 83 files changed, 4748 insertions(+) create mode 100644 AUTHORS create mode 100644 Changelog create mode 100644 FAQ create mode 100644 README create mode 100644 TODO create mode 100755 bin/clean_radacct create mode 100755 bin/log_badlogins create mode 100755 bin/showmodem create mode 100755 bin/snmpfinger create mode 100644 conf/admin.conf create mode 100644 conf/auth.request create mode 100644 conf/config.php3 create mode 100644 conf/default.vals create mode 100644 conf/extra.ldap-attrmap create mode 100644 conf/sql.attrmap create mode 100644 conf/sql.attrs create mode 100644 conf/user_edit.attrs create mode 100644 htdocs/about.html create mode 100644 htdocs/accounting.php3 create mode 100644 htdocs/badusers.php3 create mode 100644 htdocs/buttons.html create mode 100644 htdocs/content.html create mode 100644 htdocs/help/dialup_access_help.html create mode 100644 htdocs/help/framed_compression_help.html create mode 100644 htdocs/help/framed_ip_address_help.html create mode 100644 htdocs/help/help.php3 create mode 100644 htdocs/help/lock_message_help.html create mode 100644 htdocs/help/login_time_help.html create mode 100644 htdocs/help/port_limit_help.html create mode 100644 htdocs/help/simultaneous_use_help.html create mode 100644 htdocs/images/bg.gif create mode 100644 htdocs/images/black.gif create mode 100644 htdocs/images/greenlines1.gif create mode 100644 htdocs/images/logo2.gif create mode 100644 htdocs/images/pixel.gif create mode 100644 htdocs/images/title2.gif create mode 100644 htdocs/index.html create mode 100644 htdocs/password.php3 create mode 100644 htdocs/stats.php3 create mode 100644 htdocs/style.css create mode 100644 htdocs/user_accounting.php3 create mode 100644 htdocs/user_admin.php3 create mode 100644 htdocs/user_delete.php3 create mode 100644 htdocs/user_edit.php3 create mode 100644 htdocs/user_finger.php3 create mode 100644 htdocs/user_new.php3 create mode 100644 htdocs/user_state.php3 create mode 100644 htdocs/user_test.php3 create mode 100644 html/stats.html.php3 create mode 100644 html/user_admin.html.php3 create mode 100644 html/user_toolbar.html.php3 create mode 100644 lib/acctshow.php3 create mode 100644 lib/add_badusers.php3 create mode 100644 lib/attrshow.php3 create mode 100644 lib/crypt/clear.php3 create mode 100644 lib/crypt/crypt.php3 create mode 100644 lib/crypt/md5.php3 create mode 100644 lib/defaults.php3 create mode 100644 lib/functions.php3 create mode 100644 lib/lang/default/utf8.php3 create mode 100644 lib/lang/el/utf8.php3 create mode 100644 lib/ldap/attrmap.php3 create mode 100644 lib/ldap/change_attrs.php3 create mode 100644 lib/ldap/change_passwd.php3 create mode 100644 lib/ldap/create_user.php3 create mode 100644 lib/ldap/defaults.php3 create mode 100644 lib/ldap/delete_user.php3 create mode 100644 lib/ldap/functions.php3 create mode 100644 lib/ldap/password_check.php3 create mode 100644 lib/ldap/personattrs.php3 create mode 100644 lib/ldap/user_info.php3 create mode 100644 lib/sql/attrmap.php3 create mode 100644 lib/sql/change_attrs.php3 create mode 100644 lib/sql/change_passwd.php3 create mode 100644 lib/sql/create_user.php3 create mode 100644 lib/sql/delete_user.php3 create mode 100644 lib/sql/drivers/mysql/functions.php3 create mode 100644 lib/sql/drivers/pg/functions.php3 create mode 100644 lib/sql/functions.php3 create mode 100644 lib/sql/password_check.php3 create mode 100644 lib/sql/user_info.php3 create mode 100644 sql/badusers.sql create mode 100644 sql/userinfo.sql diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..1b087e4 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,14 @@ +Kostas Kalevras: kkalev@noc.ntua.gr +Main developper + +Vasilis Pappas: vpappas@noc.ntua.gr +parts of user_edit and user_admin + +Thanasis Duitsis: aduitsis@noc.ntua.gr +Part of accounting report generator + +Panagiotis Christias: christia@noc.ntua.gr +HTML pages layout designer + +Dragan Milivojevic: galileo@MICROSKY.NET +A number of bug reports and a lot of crash testing diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..11de3f0 --- /dev/null +++ b/Changelog @@ -0,0 +1,130 @@ +Ver 1.28: +* Make user_delete.php3 print something when a user is deleted +* Cache nas hostname lookups in user_accounting +Ver 1.27: +* Allow for variable expansion in the configuration file. Something like: + general_base_dir: /usr/local/dialup_admin + general_default_file: %{general_base_dir}/conf/default.vals +* Small changes in the README file +* A few corrections in the sql drivers +* Enlarged the textboxes in the user_edit page +* Created a folder help +* Added a help page for: + o Login-Time + o Simultaneous-Use + o Dialup-Access + o Framed-Compression + o Port-Limit + o Lock Message + o Framed-IP-Address +Ver 1.26: +* A few bugfixes for the general sql code (typo mistakes mostly) +Ver 1.25: +* Deleted a mysql_close from lib/mysql/create_user since we now have persistent sql connections +* Removed the select_db() from accounting.php3 since it is not needed +* A lot of html changes in accounting.php3 +* Changed the sql code to be modular. Now under lib we don't have a mysql directory but a sql directory + with a directory drivers which contains the database specific functions. As a result all calls to mysql* + functions where changed to call da_sql* functions. Right now mysql should work and postgresql *may* work + It is not tested though. Hopefully things will come back to being stable in a few days. +* Added sql_port and sql_type configuration file directives +Ver 1.20: +* Fixed a bug in lib/ldap/change_attrs. When we modify an attribute do an ldap_mod_del($mod) and then a + ldap_mod_add($add_r) +* In accounting.php3 show the attribute description instead of the attribute name. +Ver 1.19: +* In lib/ldap/check_password.php3 don't do a user search but use the already available user DN +* Remove the language support from the get_user_info() functions. They are only used in the user_finger page +* In user_state show weekly usage for the week starting from sunday 00:00, not for the last 7 days +* Show upload/download when connected or for the last time the user connected +* Fixed a few minor problems with the help and about pages +Ver 1.18: +* Fixed a small problem with total upload,download numbers in user_admin +* Fixed a major problem in the accounting report generator when adding an attribute check. Now it + should be all OK. +* Fixed a small bug in lib/mysql/functions.php3. Bug found be galileo@microsky.net +Ver 1.17: +* Fixed a few more problems in the mysql code +* Updated README +* the help page now prints the README file. It also has a common layout with the other pages +* Changed the about page to have a common look with the other pages. +Ver 1.16: +* Fixed a few typing mistakes in mysql.attrmap +* If the corresponding attribute name (in ldap or mysql) is 'none' then do not + edit/add it. Based on a bug report by galileo@microsky.net +* Fixed a few errors in lib/attrshow.php3 +Ver 1.15: +* Added user test page. It will use radclient to send a radius access-request + to the radius server and check the response. This page is also used to check + that the radius server is working fine. Added user_test.php3 and a few config + file parameters. +* Support for multi valued attributes. +* Changed cleartext encryption name from none to clear +* Renamed the general_sql_row_limit configuration directive to sql_row_limit +Ver 1.12: +* Added an FAQ +* Small changes in html code +* Small changes in the README file +* Fixed a small problem in delete_user from ldap +* Removed the Base64 encode since it was causing problems +Ver 1.11: +* Changed all ldap_bind() to use the ldap bind DN and password. Should have been + the default behaviour +* Do a Base64 encode in ldap/change_password.php3 before sending the password to + the ldap server +* Added support for module messages in log_badlogins and user_accounting +* Updated documentation +Ver 1.10: +* Added support for users in mysql database. All bugs are welcome. To activate + just use mysql as library_type +* Added support for salt in crypt.php3 +* Added userinfo table to keep information for users (Name,Phone etc). Added two + corresponding values in admin.conf +* Added mysql.attrmap for mysql support +* Added TODO +* Added persistent connections for mysql (mysql_pconnect()) +Ver 1.00: +* Added password change facility in user_edit. Support for multiple + password encryption methods +* Added user deletion page user_delete.php3 with corresponding ldap lib code +* Moved the second user_info.php3 include in user_edit to the correct location. Also + used isset instead of == '' +* Moved the action toolbar (show,edit,accounting...) into a separate html file +* Added the nas model in user_finger.php3 +Ver 0.99.8: +* Added the caller id in the finger facility +* Changed the start date in the badusers file to 0000 +* Added the out of quota message in user_admin +* fixed a few problems with the html code in user_admin.php3 +* calculate account status in user_admin for the last week only +* Change font color to red if used time > corresponding limit (weekly or daily) +* Added the user_stats.php3. It can be used by outside pages to get a quick + overview of the status of the user. It will return the following fields + separated by new lines: + account_status(active or inactive),lock message,weekly limit,daily limit, + weekly used,weekly connections,daily used,daily connections +* fixed a bug in the subscription analysis in user_admin.php3 +* calculate weekly used from sunday 00:00:00 when the counters reset +* added clean_radacct which will clean radacct entries which have been open + for more than a day. It will not do any harm even if it is incorrect since + when rlm_sql runs if the update operation fails then it will fall back to + insert (see sql.conf) +* added log_badlogins. It will continuously read the radius.log file and log + to the radacct table all login incorrect and multiple logins with a + corresponding acctterminatecause. user_accounting.php3 is already prepared + for this (it will show those entries in red) +* fix a small bug with null values in change_vals.php3 of the ldap lib +Ver 0.99: +* Added the badusers table +* Added the default and regular profile from ldap for user_edit +* Added the snmpfinger in the finger facility so that it will not + relly on the sql database. +* Added the new user facility +* Added support for the Lock Message facility +* Various bug fixes and enhancements + +Ver 0.31: +* Added the @ sign in the {mysql,ldap}_{open,close} functions so that + they don't show error messages +* Changed double quotes with single quotes where applicable for performance + reasons diff --git a/FAQ b/FAQ new file mode 100644 index 0000000..842c71a --- /dev/null +++ b/FAQ @@ -0,0 +1,28 @@ +> I was wondering if there is any more documentation about howto setup this +> software other than what comes in the README? + +No, there isn't. It's easier for me to write code than to document it :-) +Anyway, I always try to make better documentation. +There's also this FAQ :-) + +> +> What tables do I need to create in the MySQL database? + +It depends. +If you are using ldap for user authentication/information then you only need +to create the freeradius sql tables (in order to create the radacct table, +the other tables will just sit around doing nothing) which can be created from a +sql script in the freeradius distribution. If you are runing mysql it is in +src/modules/rlm_sql/drivers/rlm_sql_mysql/db_mysql.sql + +If you are using mysql for user authentication/information then you will again +need to create the freeradius sql tables and if you want you could also create +the userinfo table to store user information (name,telephone etc) + +You could also create the badusers table if you want the functionality it provides. + +sql scripts to create the badusers and userinfo tables can be found in the +directory sql (of dialup_admin distribution). + +-- +kkalev diff --git a/README b/README new file mode 100644 index 0000000..5f104c4 --- /dev/null +++ b/README @@ -0,0 +1,85 @@ +dialup_admin is a web based administration interface for the freeradius radius server. +It is modular and right now it assumes that user information is stored in an ldap server +or an sql database and accounting in an sql server. + +There are also a few more things included: + +* sql/badusers.sql: It will create a table named badusers which can be used to hold the + history for badusers (date,action) +* sql/userinfo.sql: It will create a table named userinfo which contains personal information + for users stored in the sql database. This can be used if a sql database is used to store user profiles + (not ldap). +* bin/log_badlogins: It will constantly check the radiusd.log file and add all login-incorrect, + invalid-user, outside of allowed login time and multiple-login cases to the radacct table with + acctstarttime=acctstoptime, acctsessiontime=0 and acctterminatecause containing the reason. + If the failing module sent back a module message then it will also appear in the terminate cause. +* bin/clean_radacct: It will delete all entries in the radacct table with a starttime > 1 day and + stoptime = 0. It will not do an harm even if it deletes valid entries since radiusd will fall + back to insert if update fails. + +The structure of the tree is: + +conf:: Contains various configuration files. +conf::admin.conf=> + The main configuration file. The directives used should be easily + understood +conf::config.php3=> + Just a helper php4 for reading the admin.conf file. Just make sure that it + opens the correct admin.conf file +conf::default.vals=> + Contains the default values for check and reply items. If you also use the users + file except for the ldap/sql databases fill in the default values you have inserted + for the users.Else comment them out. +conf::sql.attrs=> + Contains inmformation about the sql attributes. This is used by the accounting + report generator (accounting.php3). +conf::user_edit.attrs=> + Contains the attributes that user_edit.php3 will show. Just uncomment those + which you want to be displayed. +conf::extra.ldap-attrmap=> + Contains a few items not included in ldap.attrmap which are used only by dialup_admin + Things like User-Password and Dialup-Lock-Msg. Use none for attributes that are not known + by the radius or ldap server. +conf::sql.attrmap=> + Contains the Attribute map for the sql database. Use none for attributes that are not known by + the radius server. +conf::auth.request=> + Contains value pairs sent in the test packets which are sent from the test user/server pages. + +htdocs:: Contains the basic php files +htdocs::index.html=> + The main index file. Just contains the frames tags +htdocs::content.html=> + Change this file to include the greeting of your choise +htdocs::buttons.html=> + The buttons html page +htdocs::style.css=> + CSS style file. Change it to match your preferences +htdocs:: user_state.php3 => + It can be used by outside pages to get a quick + overview of the status of a user. It will return the following fields + separated by new lines: + account_status(active or inactive),lock message,weekly limit,daily limit, + weekly used,weekly connections,daily used,daily connections + +html:: Contains the html code for a few pages +html::user_admin.html.php3 => + html code for the user_admin page +html::stats.html.php3 => + html code for the stats page +html::user_toolbar.html.php3 => + the user toolbar (show,edit,accounting...) which appears in almost all pages + +lib:: Contains the library items +lib::ldap=> + The ldap files +lib::lang=> + Allow for multiple languages to be supported +lib::crypt=> + Allow for multiple encryption schemes (for user passwords) +lib::sql=> + Contains the sql library files. There is also a directory drivers + which contains functions for various sql databases (mysql and + postgresql for the time being). + +The rest: The rest are the php4 files. Normally, you should not need to change anything in them. diff --git a/TODO b/TODO new file mode 100644 index 0000000..90e6b00 --- /dev/null +++ b/TODO @@ -0,0 +1,12 @@ +* Minimize database (ldap,mysql) connections. +* Clean up html code to make it smaller +* More messages +* Skins +* Other languages in html +* Multilanguage support for ldap attributes +* Add language attributes in user_new.php3 +* Finger facility. Should find a way to make it work with all nases. That will + mean that it should be made modular and fall back to simple queries to the + sql db if it cannot get user info from the nas server +* Check out dbx library. It seems very promising for database independent code. + We 'll see where it goes. diff --git a/bin/clean_radacct b/bin/clean_radacct new file mode 100755 index 0000000..e3652f1 --- /dev/null +++ b/bin/clean_radacct @@ -0,0 +1,26 @@ +#!/usr/bin/perl +use DBI; +use POSIX; + +$conf=shift||'/usr/local/dialup_admin/conf/admin.conf'; + +open CONF, "<$conf" + or die "Could not open configuration file\n"; +while(){ + chomp; + ($key,$val)=(split /:\s*/,$_); + $sql_server = $val if ($key eq 'sql_server'); + $sql_username = $val if ($key eq 'sql_username'); + $sql_password = $val if ($key eq 'sql_password'); + $sql_database = $val if ($key eq 'sql_database'); + $sql_accounting_table = $val if ($key eq 'sql_accounting_table'); +} +close CONF; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; +$date = POSIX::strftime("%Y-%m-%d %T",$sec,$min,$hour,($mday - 1),$mon,$year,$wday,$yday,$isdst); +print "$date\n"; + +$dbh = DBI->connect("DBI:mysql:$sql_database:$sql_server","$sql_username","$sql_password"); +$dbh->do("DELETE FROM $sql_accounting_table WHERE AcctStopTime = '0' AND AcctStartTime < '$date';"); +$dbh->disconnect(); diff --git a/bin/log_badlogins b/bin/log_badlogins new file mode 100755 index 0000000..ed6808e --- /dev/null +++ b/bin/log_badlogins @@ -0,0 +1,87 @@ +#!/usr/bin/perl +use DBI; + +use Date::Manip qw(ParseDate UnixDate); +$|=1; + +$file=shift||'none'; +$conf=shift||'/usr/local/dialup_admin/conf/admin.conf'; + +open CONF, "<$conf" + or die "Could not open configuration file\n"; +while(){ + chomp; + ($key,$val)=(split /:\s*/,$_); + $sql_server = $val if ($key eq 'sql_server'); + $sql_username = $val if ($key eq 'sql_username'); + $sql_password = $val if ($key eq 'sql_password'); + $sql_database = $val if ($key eq 'sql_database'); + $sql_accounting_table = $val if ($key eq 'sql_accounting_table'); +} +close CONF; + +$dbh = DBI->connect("DBI:mysql:$sql_database:$sql_server","$sql_username","$sql_password") + or die "Could not connect to SQL database: $DBI::errtstr\n"; +open LOG, "<$file" + or die "Could not open file $file\n"; +seek LOG, 0, 2; +for(;;){ + while(){ + $do=0; + chomp; + if ($_ ne ''){ + $user = $nas = $port = $caller = '-'; + if (/Login incorrect/){ + if (/Login incorrect \((.+?)\):/){ + $cause = 'Login-Incorrect ($1)'; + }else{ + $cause='Login-Incorrect'; + } + $do=1; + } + elsif (/Invalid user/){ + if (/Invalid user \((.+?)\):/){ + $cause = 'Invalid-User ($1)'; + }else{ + $cause='Invalid-User'; + } + $do=1; + } + elsif (/Multiple logins/){ + $cause='Multiple-Logins'; + $do=1; + } + elsif (/(Outside allowed timespan \(.+?\)):/){ + $cause = '$1'; + $do=1; + } + if ($do){ + $date = (split / : /,$_)[0]; + $date2 = ParseDate($date); + if ($date2){ + ($year,$mon,$mday,$hour,$min,$sec)=UnixDate($date2,'%Y','%m','%d','%H','%M','%S'); + } + $time = "$year-$mon-$mday $hour:$min:$sec"; + if (/\[(\w+?)\]\s+\(from (.+?)\)/){ + $user = $1; + ($nas,$port,$caller) = (split /\s+/,$2)[1,3,5]; + } + $caller='' if (!defined($caller)); + $user =~s/[^\w]//g; + $nas =~s/[^\w]//g; + if ($nas !~ /\.noc\.ntua\.gr$/){ + $nas .= '.noc.ntua.gr'; + } + $port =~s/[^\d]//g; + $caller =~s/[^\d]//g; + $addr = gethostbyname $nas; + ($a,$b,$c,$d)=unpack('C4',$addr); + $addr = "$a.$b.$c.$d"; +$dbh->do("INSERT INTO $sql_accounting_table (UserName,NASIPAddress,NASPortId,AcctStartTime,AcctStopTime,AcctSessionTime,AcctInputOctets,AcctOutputOctets,CallingStationId,AcctTerminateCause) VALUES ('$user','$addr','$port','$time','$time','0','0','0','$caller','$cause');"); + } + } + } + sleep 2; + seek LOG,0,1; +} +$dbh->disconnect(); diff --git a/bin/showmodem b/bin/showmodem new file mode 100755 index 0000000..e7a4f8f --- /dev/null +++ b/bin/showmodem @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +$snmpget="/usr/local/bin/snmpget"; +$snmpwalk="/usr/local/bin/snmpwalk"; +$nas=shift; +$user=shift; +$com=shift || "public"; +$type=shift|| "xml"; + +@ModulationScheme = ( + "error", + "unknown", + "bell103a", + "bell212a", + "v21", + "v22", + "v22bis", + "v32", + "v32bis", + "vfc", + "v34", + "v17", + "v29", + "v33", + "k56flex", + "v23", + "v32terbo", + "v34plus", + "v90", + "v27ter", +); + +@Protocol = ( + "error", + "normal", + "direct", + "reliableMNP", + "reliableLAPM", + "syncMode", + "asyncMode", + "ara10", + "ara20", + "unknown", +); + +$modem=`$snmpwalk $nas $com enterprises.9.2.9.2.1.18 | grep $user`; +if($modem=~/enterprises\.9\.2\.9\.2\.1\.18\.(\d+) =/){ + $modem=$1; + $slot=(1+int($modem/120)); + $port=$modem%120-1; + $modem="$slot.$port"; + + + $duration=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.9.$modem` or die "No MIB\n"; + $duration=~/\) (.*)\./; + $duration=$1; + + $modulation=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.12.$modem` or die "No MIB\n"; + $modulation=~/ \= (\d+)/; + $modulation=$ModulationScheme[$1]; + + $protocol=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.13.$modem` or die "No MIB\n"; + $protocol=~/ \= (\d+)/; + $protocol=$Protocol[$1]; + + $txrate=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.14.$modem` or die "No MIB\n"; + $txrate=~/Gauge32\: (\d+)/; + $txrate=$1; + + $rxrate=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.15.$modem` or die "No MIB\n"; + $rxrate=~/Gauge32\: (\d+)/; + $rxrate=$1; + + $rxsignal=`$snmpget $nas $com enterprises.9.9.47.1.3.1.1.17.$modem` or die "No MIB\n"; + $rxsignal=~/ \= (.*)\n/; + $rxsignal=$1; + + if($type eq "xml"){ + print"$modulation$protocol$txrate$rxrate$rxsignal\n"; + + }else{ + print "Duration>\t$duration\n"; + print "Modulation>\t$modulation\n"; + print "Protocol>\t$protocol\n"; + print "TxRate>\t\t$txrate\n"; + print "RxRate>\t\t$rxrate\n"; + print "RxSignal>\t$rxsignal dbm\n"; + } +} diff --git a/bin/snmpfinger b/bin/snmpfinger new file mode 100755 index 0000000..b9dda8b --- /dev/null +++ b/bin/snmpfinger @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +$SNMPWALK="/usr/bin/snmpwalk"; + +$walk =`$SNMPWALK $ARGV[0] public .iso.org.dod.internet.private.enterprises.9.2.9.2.1.18`; +$walk.=`$SNMPWALK $ARGV[0] public .iso.org.dod.internet.private.enterprises.9.9.27.1.1.3.1.7`; + +while($walk=~/\"(\w+?)\"/g){ + $user=lc($1); + if($out) { + $out=$out.",'$user'"; + }else{ + $out="'$user'"; + } +} +print "$out\n"; diff --git a/conf/admin.conf b/conf/admin.conf new file mode 100644 index 0000000..a20566c --- /dev/null +++ b/conf/admin.conf @@ -0,0 +1,99 @@ +# +# it can be el (greek) or default +# +general_prefered_lang: el +general_prefered_lang_name: Greek +# +general_base_dir: /usr/local/dialup_admin +general_radiusd_base_dir: /usr/local/radiusd +general_domain: company.com +# +general_ldap_attrmap: %{general_radiusd_base_dir}/etc/raddb/ldap.attrmap +general_sql_attrmap: %{general_base_dir}/conf/sql.attrmap +general_extra_ldap_attrmap: %{general_base_dir}/conf/extra.ldap-attrmap +# +# it can be either ldap or sql +# +general_lib_type: ldap +general_user_edit_attrs_file: %{general_base_dir}/conf/user_edit.attrs +general_sql_attrs_file: %{general_base_dir}/conf/sql.attrs +general_default_file: %{general_base_dir}/conf/default.vals +general_snmpfinger_bin: %{general_base_dir}/bin/snmpfinger +general_radclient_bin: %{general_radiusd_base_dir}/bin/radclient +# +# this information is used from the server check page +# +general_test_account_login: test +general_test_account_password: testpass +# +# These are used as default values for the user test page +# +general_radius_server: localhost +general_radius_server_port: 1812 +# +# sorry, single valued for now. Should become something like +# password[server-name]: xxxxx +# +general_radius_server_secret: XXXXXX +general_auth_request_file: %{general_base_dir}/conf/auth.request +# +# can be one of crypt,md5,clear +# +general_encryption_method: crypt + +nas1_name: nas1.%{general_domain} +nas1_model: Cisco 2511 access server +nas1_ip: 147.122.122.121 +nas1_port_num: 16 +nas1_community: public +nas2_name: nas2.%{general_domain} +nas2_model: Cisco 2511 access server +nas2_ip: 147.122.122.123 +nas2_port_num: 16 +nas2_community: public +nas3_name: nas3.%{general_domain} +nas3_model: Cisco 5300 access server +nas3_ip: 147.122.122.124 +nas3_port_num: 210 +nas3_community: public + +ldap_server: ldap.%{general_domain} +ldap_base: dc=company,dc=com +ldap_binddn: cn=Directory Manager +ldap_bindpw: XXXXXXX +ldap_default_new_entry_suffix: ou=dialup,ou=guests,%{ldap_base} +ldap_default_dn: uid=default-dialup,%{ldap_base} +ldap_regular_profile_attr: dialupregularprofile + +# +# can be one of mysql,pg where: +# mysq: MySQL database (port 3306) +# pg: PostgreSQL database (port 5432) +# +sql_type: mysql +sql_server: localhost +sql_port: 3306 +sql_username: dialup_admin +sql_password: XXXXXX +sql_database: radius +sql_accounting_table: radacct +sql_badusers_table: badusers +sql_check_table: radcheck +sql_reply_table: radreply +sql_user_info_table: userinfo +# +# true or false +# +sql_use_user_info_table: true +sql_password_attribute: Crypt-Password +sql_date_format: Y-m-d +sql_full_date_format: Y-m-d H:i:s +# +# Used in the accounting report generator so that we +# don't return too many results +# +sql_row_limit: 40 + +counter_default_daily: 14400 +counter_default_weekly: 72000 +counter_default_monthly: none diff --git a/conf/auth.request b/conf/auth.request new file mode 100644 index 0000000..a90c5d7 --- /dev/null +++ b/conf/auth.request @@ -0,0 +1 @@ +Service-Type = Framed-User diff --git a/conf/config.php3 b/conf/config.php3 new file mode 100644 index 0000000..565eb28 --- /dev/null +++ b/conf/config.php3 @@ -0,0 +1,14 @@ + diff --git a/conf/default.vals b/conf/default.vals new file mode 100644 index 0000000..021e41d --- /dev/null +++ b/conf/default.vals @@ -0,0 +1,16 @@ +# +# Uncomment these lines if you add default values in the users file +# +#Simultaneous-Use: 1 +#Framed-IP-Address: 255.255.255.254 +#Framed-IP-Netmask: 255.255.255.255 +#Framed-MTU: 1500 +#Framed-Protocol: PPP +#Framed-Compression: Van-Jacobson-TCP-IP +#Session-Timeout: 14400 +#Idle-Timeout: 600 +#Port-Limit: 1 +#Max-Weekly-Session: 72000 +#Max-Daily-Session: 14400 +#Login-Time: +#Auth-Type: LDAP diff --git a/conf/extra.ldap-attrmap b/conf/extra.ldap-attrmap new file mode 100644 index 0000000..9edec2a --- /dev/null +++ b/conf/extra.ldap-attrmap @@ -0,0 +1,3 @@ +checkItem Dialup-Lock-Msg radiuslockmsg +checkItem User-Password userpassword +replyItem Reply-Item radiusReplyItem diff --git a/conf/sql.attrmap b/conf/sql.attrmap new file mode 100644 index 0000000..138bc20 --- /dev/null +++ b/conf/sql.attrmap @@ -0,0 +1,39 @@ +checkItem Auth-Type Auth-Type +checkItem Simultaneous-Use Simultaneous-Use +checkItem Called-Station-Id Called-Station-Id +checkItem Calling-Station-Id Calling-Station-Id +checkItem Dialup-Access none +checkItem Max-Daily-Session none +checkItem Max-Weekly-Session none +checkItem Login-Time Login-Time + +replyItem Service-Type Service-Type +replyItem Framed-Protocol Framed-Protocol +replyItem Framed-IP-Address Framed-IP-Address +replyItem Framed-IP-Netmask Framed-IP-Netmask +replyItem Framed-Route Framed-Route +replyItem Framed-Routing Framed-Routing +replyItem Filter-Id Filter-Id +replyItem Framed-MTU Framed-MTU +replyItem Framed-Compression Framed-Compression +replyItem Login-IP-Host Login-IP-Host +replyItem Login-Service Login-Service +replyItem Login-TCP-Port Login-TCP-Port +replyItem Callback-Number Callback-Number +replyItem Callback-Id Callback-Id +replyItem Framed-IPX-Network Framed-IPX-Network +replyItem Class Class +replyItem Session-Timeout Session-Timeout +replyItem Idle-Timeout Idle-Timeout +replyItem Termination-Action Termination-Action +replyItem Login-LAT-Service Login-LAT-Service +replyItem Login-LAT-Node Login-LAT-Node +replyItem Login-LAT-Group Login-LAT-Group +replyItem Framed-AppleTalk-Link Framed-AppleTalk-Link +replyItem Framed-AppleTalk-Network Framed-AppleTalk-Network +replyItem Framed-AppleTalk-Zone Framed-AppleTalk-Zone +replyItem Port-Limit Port-Limit +replyItem Login-LAT-Port Login-LAT-Port +replyitem Reply-Message Reply-Message +replyItem Dialup-Lock-Msg Reply-Message +replyItem User-Password Password diff --git a/conf/sql.attrs b/conf/sql.attrs new file mode 100644 index 0000000..797baf2 --- /dev/null +++ b/conf/sql.attrs @@ -0,0 +1,27 @@ +# +# Mysql attributes Description Show Use function +# +RadAcctId Accounting Id no +AcctSessionId Session Id no +AcctUniqueId Unique Id no +UserName User Name yes +Realm Realm no +NASIPAddress NAS IP Address yes +NASPortId NAS Port yes +NASPortType NAS Port Type no +AcctStartTime Login Time yes +AcctStopTime Logout Time yes +AcctSessionTime Session Time yes time2str +AcctAuthentic AcctAuthentic no +ConnectInfo_start Start Connect Info no +ConnectInfo_stop Stop Connect Info no +AcctInputOctets Upload yes bytes2str +AcctOutputOctets Download yes bytes2str +CalledStationId CalledStationId no +CallingStationId Caller Id no +AcctTerminateCause Terminate Cause no +ServiceType Service Type no +FramedProtocol Protocol no +FramedIPAddress Client IP Address yes +AcctStartDelay Accounting Start Delay no time2str +AcctStopDelay Accounting Stop Delay no time2str diff --git a/conf/user_edit.attrs b/conf/user_edit.attrs new file mode 100644 index 0000000..f83d651 --- /dev/null +++ b/conf/user_edit.attrs @@ -0,0 +1,33 @@ +#Auth-Type Auth Type +#Simultaneous-Use Simultaneous Use +Framed-Protocol Protocol +Framed-IP-Address IP Address +Framed-IP-Netmask IP Netmask +#Framed-Route Route +#Framed-Routing +#Filter-Id +Framed-MTU MTU +Framed-Compression Compression Used +#Login-IP-Host +#Login-Service +#Login-TCP-Port +#Callback-Number +#Callback-Id +#Framed-IPX-Network +#Class +Session-Timeout Session Timeout +Idle-Timeout Idle Timeout +#Termination-Action +#Login-LAT-Service +#Login-LAT-Node +#Login-LAT-Group +#Framed-AppleTalk-Link +#Framed-AppleTalk-Network +#Framed-AppleTalk-Zone +Port-Limit Port Limit +#Login-LAT-Port +#Dialup-Access Dialup Access (use FALSE to lock) +Dialup-Lock-Msg Lock Message +#Max-Daily-Session Daily Limit (secs) +#Max-Weekly-Session Weekly Limit (secs) +#Login-Time User Login Period (UUCP Format) diff --git a/htdocs/about.html b/htdocs/about.html new file mode 100644 index 0000000..8e4201e --- /dev/null +++ b/htdocs/about.html @@ -0,0 +1,52 @@ + + +About page + + + +
+ + + + +
+
+
+ + + + + +
+ + +
dialup_admin About Page 
+
+ + +
+
+
+
+A web based administration interface for the freeradius radius server
+written in PHP4
+

+Copyright (C) 2001,2002 Kostas Kalevras +


+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version
+2 of the License, or (at your option) any later version.
+
+
+Authors:
Kostas Kalevras (kkalev at noc.ntua.gr)
+Basilis Pappas (vpappas at noc.ntua.gr)
+Panagiotis Christias (christia at noc.ntua.gr)
+Thanasis Duitsis (aduitsis at noc.ntua.gr)
+
+
+
+
+ + diff --git a/htdocs/accounting.php3 b/htdocs/accounting.php3 new file mode 100644 index 0000000..db8873a --- /dev/null +++ b/htdocs/accounting.php3 @@ -0,0 +1,268 @@ + + +Accounting Report Generator + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$operators=array( '<', '>', '=', '>=', '<=' ); + +$link = @da_sql_pconnect ($config) or die('cannot connect to sql databse'); +$fields = @da_sql_list_fields($config[sql_accounting_table],$link,$config); +$no_fields = @da_sql_num_fields($fields,$config); + +for($i=0;$i<$no_fields;$i++){ + $key = @da_sql_field_name($fields,$i,$config); + $val = $sql_attrs[$key][desc]; + $show = $sql_attrs[$key][show]; + $selected[$key] = ($show == 'yes') ? 'selected' : ''; + $items[$key] = "$val"; +} +asort($items); + +class Qi { + var $name; + var $item; + var $_item; + var $operator; + var $type; + var $typestr; + var $value; + function Qi($name,$item,$operator) { + $this->name=$name; + $this->item=$item; + $this->operator=$operator; + } + + function show() { global $operators; + global $items; + $nam = $this->item; + echo << + $items[$nam] + + + + + +EOM; + } + + function get($designator) { global ${"item_of_$designator"}; + global ${"value_of_$designator"}; + global ${"operator_of_$designator"}; + if(${"item_of_$designator"}){ + $this->value= ${"value_of_$designator"}; + $this->operator=${"operator_of_$designator"}; + $this->item=${"item_of_$designator"}; + } + } + function query(){ + global $operators; + global $items; + return $items[$this->item]." $this->operator '$this->value'"; + } +} + +?> + + + +Accounting Report Generator + + + + + + + + + + +
+Show the following attributes:
+ +EOM; + +foreach($items as $key => $val) + if ($val == 'UserName') + echo <<$val +EOM; + else + echo <<$val +EOM; + +echo << +
+
+ + + + +EOM; + +$number=1; +$offset=0; +while (${"item_of_w$number"}) { + if(${"delete_w$number"}==1) {$offset=1;$number++;} + else { + $designator=$number-$offset; + ${"w$designator"} = new Qi("w$designator","",""); + ${"w$designator"}->get("w$number"); + ${"w$designator"}->show(); + $number++; + } + } +if($add==1) { + ${"w$number"} = new Qi("w$number","$item_name","$operators[0]"); + ${"w$number"}->show(); + } +echo << + + + + +
+Selection criteria: +
+
+ +
+
+ + + +EOM; + +} + +if ($queryflag == 1){ +$i = 1; +while (${"item_of_w$i"}){ + $where .= ($i == 1) ? ' WHERE ' . ${"item_of_w$i"} . ${"operator_of_w$i"} . "'" . ${"value_of_w$i"} . "'" : + ' AND ' . ${"item_of_w$i"} . ${"operator_of_w$i"} . "'" . ${"value_of_w$i"} . "'" ; + $i++; +} + +$order = ($order_by != '') ? "$order_by" : 'UserName'; + +foreach ($show_attrs as $val) + $query_view .= $val . ','; +$query_view = ereg_replace(',$','',$query_view); +$query="SELECT $query_view FROM $config[sql_accounting_table] $where ORDER BY $order LIMIT $config[sql_row_limit]"; + +echo << + + + + +
+ + + + + +
+ + +
+ Accounting Report Generator  +
+
+ + +
+

+ + + +EOM; +foreach($show_attrs as $val){ + $desc = $sql_attrs[$val][desc]; + echo "\n"; +} +echo "\n"; + + $search = @da_sql_query($link,$config,"$query"); + if ($search){ + while( $row = @da_sql_fetch_array($search,$config) ){ + $num++; + echo "\n"; + foreach($show_attrs as $val){ + $info = $row[$val]; + if ($info == '') + $info = '-'; + $info = $sql_attrs[$val][func]($info); + if ($val == 'UserName') + $info = "$info"; + echo <<$info +EOM; + } + echo "\n"; + } + } +echo << + +
$desc
+

+ + +EOM; +} +?> diff --git a/htdocs/badusers.php3 b/htdocs/badusers.php3 new file mode 100644 index 0000000..b1060d2 --- /dev/null +++ b/htdocs/badusers.php3 @@ -0,0 +1,150 @@ + +Unauthorized Service Usage History for $login + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$now = time(); +$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400); +$prev_str = ($prev_str != '') ? "$prev_str" : "0000-00-00 00:00:00"; +$num = 0; +$pagesize = ($pagesize) ? $pagesize : 10; +$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize"; +$selected[$pagesize] = 'selected'; +$login = ($login != '') ? $login : 'anyone'; +$usercheck = ($login == 'anyone') ? "LIKE '%'" : "= '$login'"; + +echo << +Unauthorized Service Usage History for $login + + + +
+ + + + +
+EOM; + +if ($login != 'anyone'){ + echo << +EOM; + +include("../html/user_toolbar.html.php3"); + +print << +EOM; +} + +echo <<
+ + + + + +
+ + +
+ Unauthorized Service Usage History for $login  +
+
+ + +
+$prev_str up to $now_str +EOM; +?> + +

+ + + + + += '$prev_str' ORDER BY Date ASC $limit;"); + if ($search){ + while( $row = @da_sql_fetch_array($search,$config) ){ + $num++; + $user = "$row[UserName]"; + $date = "$row[Date]"; + $reason = "$row[Reason]"; + if ($reason == '') + $reason = '-'; + echo << + + + + + +EOM; + } + } +} +echo << + +
#userdatereason
$num$user$date$reason
+
+
+
+ + + + + + + + + + +EOM; +?> + + +
+ + the from date matches any login after the 00:00 that day, + and the to date any login before the 23:59 that day. + the default values shown are the current week. +
userfrom dateto datepagesize
+ +
+

+ + diff --git a/htdocs/buttons.html b/htdocs/buttons.html new file mode 100644 index 0000000..a6555f5 --- /dev/null +++ b/htdocs/buttons.html @@ -0,0 +1,73 @@ + + + + + + +
+ + + + +
+ +
+ + +
+Main Menu +
+
+ + + +
+ + + + + + + + + + + + + +
+
+
+
+ diff --git a/htdocs/content.html b/htdocs/content.html new file mode 100644 index 0000000..d8fa823 --- /dev/null +++ b/htdocs/content.html @@ -0,0 +1,9 @@ + + +
+

+A web based administration interface for the freeradius radius server +

+
+ + diff --git a/htdocs/help/dialup_access_help.html b/htdocs/help/dialup_access_help.html new file mode 100644 index 0000000..164b542 --- /dev/null +++ b/htdocs/help/dialup_access_help.html @@ -0,0 +1,36 @@ + + +Dialup Access Help Page + + + +
+ + + + + +
+ + +
Dialup Access Help Page 
+
+ + + + +
+
+
+
+  If the Dialup-Access attribute is specified, the ldap module
+  checks for its existance in user object. If it exists and is
+  set to FALSE, user is denied remote access. Otherwise, the user
+  is allowed remote access.
+
+
+Close Window +
+
+ + diff --git a/htdocs/help/framed_compression_help.html b/htdocs/help/framed_compression_help.html new file mode 100644 index 0000000..07dc7c3 --- /dev/null +++ b/htdocs/help/framed_compression_help.html @@ -0,0 +1,38 @@ + + +Framed Compression Help Page + + + +
+ + + + + +
+ + +
Framed Compression Help Page 
+
+ + + + +
+
+
+
+  Framed-Compression indicates a compression protocol to be used for the link.
+  Possible values are:
+
+ None
+ Van-Jacobson-TCP-IP
+ IPX-Header-Compression
+ Stac-LZS
+
+Close Window +
+
+ + diff --git a/htdocs/help/framed_ip_address_help.html b/htdocs/help/framed_ip_address_help.html new file mode 100644 index 0000000..6002cf4 --- /dev/null +++ b/htdocs/help/framed_ip_address_help.html @@ -0,0 +1,40 @@ + + +Framed-IP-Address Help Page + + + +
+ + + + + +
+ + +
Framed-IP-Address Help Page 
+
+ + + + +
+
+
+
+  Framed-IP-Address can be used to specify the IP address that
+  a dialup user will use. There are two special values:
+
+255.255.255.255: Assign the user requested IP
+255.255.255.254: Assign an IP from the NAS IP pool
+
+  All other values will be assigned as they are to the user dialup
+  interface
+
+
+Close Window +
+
+ + diff --git a/htdocs/help/help.php3 b/htdocs/help/help.php3 new file mode 100644 index 0000000..54cca94 --- /dev/null +++ b/htdocs/help/help.php3 @@ -0,0 +1,44 @@ + + +Help page + + + +
+ + + + +
+ +
+ +
+ + + + + +
+ + +
dialup_admin help page 
+
+ + +
+
+
+
+For now we just include the README file
+ + + +
+
+
+
+ + diff --git a/htdocs/help/lock_message_help.html b/htdocs/help/lock_message_help.html new file mode 100644 index 0000000..21a163b --- /dev/null +++ b/htdocs/help/lock_message_help.html @@ -0,0 +1,36 @@ + + +Lock Message Help Page + + + +
+ + + + + +
+ + +
Lock Message Help Page 
+
+ + + + +
+
+
+
+  The Lock Message will be included as a Reply-Item in all radius server responses for
+  the user. It will also appear in the Usefull User Description in the user admin page.
+  It is intended to be used as a hint to the user and to the administrator for the reason
+  of the user lock out.
+
+
+Close Window +
+
+ + diff --git a/htdocs/help/login_time_help.html b/htdocs/help/login_time_help.html new file mode 100644 index 0000000..42ed56f --- /dev/null +++ b/htdocs/help/login_time_help.html @@ -0,0 +1,49 @@ + + +Login-Time Help Page + + + +
+ + + + + +
+ + +
Login-Time Help Page 
+
+ + + + +
+
+
+
+  Login-Time defines the time span a user may login to the system. The
+  format of a so-called time string is like the format used by UUCP.
+  A time string may be a list of simple time strings separated by "|" or ",".
+
+  Each simple time string must begin with a day definition. That can be just
+  one day, multiple days, or a range of days separated by a hyphen. A
+  day is Mo, Tu, We, Th, Fr, Sa or Su, or Wk for Mo-Fr. "Any" or "Al"
+  means all days.
+
+  After that a range of hours follows in hhmm-hhmm format.
+
+  For example, "Wk2305-0855,Sa,Su2305-1655".
+
+  Radiusd calculates the number of seconds left in the time span, and
+  sets the Session-Timeout to that number of seconds. So if someones
+  Login-Time is "Al0800-1800" and he logs in at 17:30, Session-Timeout
+  is set to 1800 seconds so that he is kicked off at 18:00.
+
+
+Close Window +
+
+ + diff --git a/htdocs/help/port_limit_help.html b/htdocs/help/port_limit_help.html new file mode 100644 index 0000000..6ae3281 --- /dev/null +++ b/htdocs/help/port_limit_help.html @@ -0,0 +1,35 @@ + + +Port Limit Help Page + + + +
+ + + + + +
+ + +
Port Limit Help Page 
+
+ + + + +
+
+
+
+  Port-Limit is intended for use in conjuction with Multilink PPP or similar uses.
+  It defines the maximum number of channels the user is allowed to open during
+  a multilink dialup session.
+
+
+Close Window +
+
+ + diff --git a/htdocs/help/simultaneous_use_help.html b/htdocs/help/simultaneous_use_help.html new file mode 100644 index 0000000..6ce5f71 --- /dev/null +++ b/htdocs/help/simultaneous_use_help.html @@ -0,0 +1,35 @@ + + +Simultaneous Use Help Page + + + +
+ + + + + +
+ + +
Simultaneous Use Help Page 
+
+ + + + +
+
+
+
+  This attribute defines the maximum number of concurrent logins
+  for a user. It is independent from the number of ports the user
+  is allowed to open in a multilink session.
+
+
+Close Window +
+
+ + diff --git a/htdocs/images/bg.gif b/htdocs/images/bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..3a45d0f3479a581eb0c61753f35b70037409b22a GIT binary patch literal 501 zcmZ?wbhEHbjA4jpxcZ;rz<~o#@2q-$f5WTCJKsFr|L(<+k8jR>dVAsX`)gl6-unLK z(a-O%&+N`UyC?7b{-SgH3NIWexp1KL>aqGO$Lg*fZ@hl0?Z)Z$TW5RjU7B|P^7Q*x zWu;q5|AQxP zDqOSAzt~cBR?Y0h(`_|=>u>L7wD@`M{qO%pJXO^Vt!?cc-crp4oqhci%2+jedM8ew zF*BN*e`?jN1q&B>h|OzWykg~a$z?sO)^DhnSvz&(w(U8aw`|?9cVEn!-ShSzIqENZ zXzj7nXPi0mPo6q^d7r%6#obqKZ4|k2^7ey8jOzC;K72lr?ZVS%FW$9s3B7sq{%g&N z&!4~j&fygP$?*7t^pDntt_BWHtt(B9EQi{e#Jy6Olvs~+3#wy|cW+wfzf z%EAeMctRu+H!W42^1>-bN9S!xNJCiS=3J`iQC5Fg=fi)^AWNN8+1-x2@znh F1^{zq_A~$h literal 0 HcmV?d00001 diff --git a/htdocs/images/black.gif b/htdocs/images/black.gif new file mode 100644 index 0000000000000000000000000000000000000000..639e5f219fb6af7d3924db565b2384e718198e31 GIT binary patch literal 49 zcmZ?wbhEHbWMp7unE0RJ|Ns9C3=9Vj8~~DvKUo+V7?>DzfNY>Fh|T1~$Y2csQJxA@ literal 0 HcmV?d00001 diff --git a/htdocs/images/greenlines1.gif b/htdocs/images/greenlines1.gif new file mode 100644 index 0000000000000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gcolor=yellow> + <p><font color="darkblue"><h1>this page can only be seen by a frames capable browser. sorry...</h1></font> + </p></body> + + diff --git a/htdocs/password.php3 b/htdocs/password.php3 new file mode 100644 index 0000000..04cac5b --- /dev/null +++ b/htdocs/password.php3 @@ -0,0 +1,22 @@ +
+> + +
+ + + + +
+ + +
+ Check Password  +
+
+ +
+ + +
Password
+
+
diff --git a/htdocs/stats.php3 b/htdocs/stats.php3 new file mode 100644 index 0000000..4130a34 --- /dev/null +++ b/htdocs/stats.php3 @@ -0,0 +1,158 @@ + + +account analysis + + + +
+ +Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + + +$date = strftime('%A, %e %B %Y, %T %Z'); +$now = time(); +if ($before == '') + $before = date($config[sql_date_format], $now + 86400); +$after = ($after != '') ? "$after" : date($config[sql_date_format], $now - 604800 ); + +$after_time = date2time($after); +$before_time = date2time($before); +$days[0] = $after; +$counter = $after_time + 86400; +$i = 1; +while($counter < $before_time){ + $days[$i++] = date($config[sql_date_format],$counter); + $counter += 86400; +} +$days[$i] = $before; +$num_days = $i; + +$column1 = ($column1 != '') ? "$column1" : 'sessions'; +$column2 = ($column2 != '') ? "$column2" : 'usage'; +$column3 = ($column3 != '') ? "$column3" : 'download'; +$column[1] = "$column1"; +$column[2] = "$column2"; +$column[3] = "$column3"; +$selected1["$column1"] = 'selected'; +$selected2["$column2"] = 'selected'; +$selected3["$column3"] = 'selected'; + +$message['sessions'] = 'sessions'; +$message['usage'] = 'total usage time'; +$message['upload'] = 'uploads'; +$message['download'] = 'downloads'; +$sql_val['usage'] = 'AcctSessionTime'; +$sql_val['upload'] = 'AcctInputOctets'; +$sql_val['download'] = 'AcctOutputOctets'; +$fun['sessions'] = nothing; +$fun['usage'] = time2strclock; +$fun['upload'] = bytes2str; +$fun['download'] = bytes2str; +$sql_val['user'] = ($login == '') ? "WHERE UserName LIKE '%'" : "WHERE UserName = '$login'"; +for ($j = 1; $j <= 3; $j++){ + $tmp = "{$sql_val[$column[$j]]}"; + $res[$j] = ($tmp == "") ? 'COUNT(RadAcctId)' : "sum($tmp)"; +} +$i = 1; +$servers[all] = 'all'; +while(1){ + $nas = 'nas' . $i; + $ip = $nas . '_ip'; + $name = $nas . '_name'; + if ($config[$ip] == '') + break; + $name = $config[$name]; + $servers[$name] = $config[$ip]; + $i++; +} +if ($server != 'all') + $s = "AND NASIPAddress = '$server'"; + +$link = @da_sql_pconnect($config); +if ($link){ + for ($i = $num_days;$i > -1; $i--){ + $day = "$days[$i]"; + $search = @da_sql_query($link,$config, + "SELECT $res[1],$res[2],$res[3] FROM $config[sql_accounting_table] + $sql_val[user] AND AcctStopTime LIKE '$day%' $s;"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $data[$day][1] = $row["$res[1]"]; + $data[sum][1] += $row["$res[1]"]; + $num[1] = ($data[$day][1]) ? $num[1] + 1 : $num[1]; + $data[$day][2] = $row["$res[2]"]; + $data[sum][2] += $row["$res[2]"]; + $num[2] = ($data[$day][2]) ? $num[2] + 1 : $num[2]; + $data[$day][3] = $row["$res[3]"]; + $data[sum][3] += $row["$res[3]"]; + $num[3] = ($data[$day][3]) ? $num[3] + 1 : $num[3]; + } + } +} + +$num[1] = ($num[1]) ? $num[1] : 1; +$num[2] = ($num[2]) ? $num[2] : 1; +$num[3] = ($num[3]) ? $num[3] : 1; + +$data['avg'][1] = ceil($data['sum'][1] / $num[1]); +$data['avg'][2] = ceil($data['sum'][2] / $num[2]); +$data['avg'][3] = ceil($data['sum'][3] / $num[3]); + +$data['avg'][1] = $fun[$column[1]]($data['avg'][1]); +$data['avg'][2] = $fun[$column[2]]($data['avg'][2]); +$data['avg'][3] = $fun[$column[3]]($data['avg'][3]); + +$data['sum'][1] = $fun[$column[1]]($data['sum'][1]); +$data['sum'][2] = $fun[$column[2]]($data['sum'][2]); +$data['sum'][3] = $fun[$column[3]]($data['sum'][3]); + +for ($i = 0; $i <= $num_days; $i++){ + $day = "$days[$i]"; + $max[1] = ($max[1] > $data[$day][1] ) ? $max[1] : $data[$day][1]; + $max[2] = ($max[2] > $data[$day][2] ) ? $max[2] : $data[$day][2]; + $max[3] = ($max[3] > $data[$day][3] ) ? $max[3] : $data[$day][3]; + +} +for ($i = 0; $i <= $num_days; $i++){ + $day = "$days[$i]"; + for ($j = 1; $j <= 3; $j++){ + $tmp = $data[$day][$j]; + if (!$max[$j]) + $p = $w = $c = 0; + else{ + $p = floor(100 * ($tmp / $max[$j])); + $w = floor(70 * ($tmp / $max[$j])); + $c = hexdec('f0e9e2') - (258 * $p); + $c = dechex($c); + } + if (!$w) + $w++; + $perc[$day][$j] = $p . "%"; + $width[$day][$j] = $w; + $color[$day][$j] = $c; + } + + $data[$day][1] = $fun[$column[1]]($data[$day][1]); + $data[$day][2] = $fun[$column[2]]($data[$day][2]); + $data[$day][3] = $fun[$column[3]]($data[$day][3]); +} + +$data[max][1] = $fun[$column[1]]($max[1]); +$data[max][2] = $fun[$column[2]]($max[2]); +$data[max][3] = $fun[$column[3]]($max[3]); + +require('../html/stats.html.php3'); +?> diff --git a/htdocs/style.css b/htdocs/style.css new file mode 100644 index 0000000..09c0faf --- /dev/null +++ b/htdocs/style.css @@ -0,0 +1,32 @@ +td {font-family:verdana,sans-serif;text-decoration:none;font-size:11px} +th {font-family:verdana,sans-serif;text-decoration:none;font-size:11px} +A {FONT-FAMILY: verdana,sans-serif; FONT-SIZE: 11px; TEXT-DECORATION: none} +H1 {FONT-FAMILY: lucida,sans-serif; FONT-SIZE: 24px; TEXT-DECORATION: none} +INPUT{ + BACKGROUND-COLOR: #FFFFFF; + BORDER-BOTTOM: #3333CC 1px solid; + BORDER-LEFT: #3333CC 1px solid; + BORDER-RIGHT: #3333CC 1px solid; + BORDER-TOP: #3333CC 1px solid; + COLOR: #000000; + FONT-FAMILY: Verdana +} +INPUT.button{ + BACKGROUND-COLOR: #999999; + BORDER-BOTTOM: #3333CC 1px solid; + BORDER-LEFT: #3333CC 1px solid; + BORDER-RIGHT: #3333CC 1px solid; + BORDER-TOP: #3333CC 1px solid; + COLOR: #000000; + FONT-FAMILY: Verdana +} +body +{ + scrollbar-track-color:#b0bd90; + scrollbar-arrow-color:#000000; + scrollbar-face-color:#d0ddb0; + scrollbar-shadow-color:#909d70; + scrollbar-highlight-color:#fffff0; + scrollbar-3dlight-color:#000000; + scrollbar-darkshadow-color:#000000; +} diff --git a/htdocs/user_accounting.php3 b/htdocs/user_accounting.php3 new file mode 100644 index 0000000..e6048f3 --- /dev/null +++ b/htdocs/user_accounting.php3 @@ -0,0 +1,185 @@ + +subscription analysis for $login ($cn) + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$now = time(); +$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400); +$prev_str = ($prev_str != '') ? "$prev_str" : date($config[sql_date_format], $now - 604800 ); +$num = 0; +$pagesize = ($pagesize) ? $pagesize : 10; +$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize"; +$selected[$pagesize] = 'selected'; + +echo << +subscription analysis for $login ($cn) + + + +
+ + + + +
+ +EOM; + +include("../html/user_toolbar.html.php3"); + +print << +
+
+ + + + +
+ + +
+ Subscription Analysis for $login  +
+
+ + +
+$prev_str up to $now_str +EOM; +?> + +

+ + + + + + += '$prev_str' ORDER BY AcctStartTime ASC $limit;"); + if ($search){ + while( $row = @da_sql_fetch_array($search,$config) ){ + $tr_color='white'; + $num++; + $acct_type = "$row[FramedProtocol]/$row[NASPortType]"; + $acct_logedin = $row[AcctStartTime]; + $acct_sessiontime = $row[AcctSessionTime]; + $acct_sessiontime_sum += $acct_sessiontime; + $acct_sessiontime = time2str($acct_sessiontime); + $acct_ip = $row[FramedIPAddress]; + if ($acct_ip == '') + $acct_ip = '-'; + $acct_upload = $row[AcctInputOctets]; + $acct_upload_sum += $acct_upload; + $acct_upload = bytes2str($acct_upload); + $acct_download = $row[AcctOutputOctets]; + $acct_download_sum += $acct_download; + $acct_download = bytes2str($acct_download); + $acct_server = $da_name_cache[$row[NASIPAddress]]; + if (!isset($acct_server)){ + $acct_server = gethostbyaddr($row[NASIPAddress]); + $da_name_cache[$row[NASIPAddress]] = $acct_server; + } + $acct_server = "$acct_server:$row[NASPortId]"; + $acct_terminate_cause = "$row[AcctTerminateCause]"; + if ($acct_terminate_cause == '') + $acct_terminate_cause = '-'; + if (ereg('Login-Incorrect',$acct_terminate_cause) || + ereg('Multiple-Logins', $acct_terminate_cause) || ereg('Invalid-User',$acct_terminate_cause)) + $tr_color='#ffe8e0'; + $acct_callerid = "$row[CallingStationId]"; + if ($acct_callerid == '') + $acct_callerid = '-'; + echo << + + + + + + + + + + + +EOM; + } + $acct_sessiontime_sum = time2str($acct_sessiontime_sum); + $acct_upload_sum = bytes2str($acct_upload_sum); + $acct_download_sum = bytes2str($acct_download_sum); + } +} +echo << + + + + + + + + + +
#typelogged insession timeip addressuploaddownloadserverterminate causecallerid
$num$acct_type$acct_logedin$acct_sessiontime$acct_ip$acct_upload$acct_download$acct_server$acct_terminate_cause$acct_callerid
Page Total$acct_sessiontime_sum $acct_upload_sum$acct_download_sum   
+

+
+
+ + + + + + + + + + + +EOM; +?> + + +
+ + the from date matches any login after the 00:00 that day, + and the to date any login before the 23:59 that day. + the default values shown are the current week. +
userfrom dateto datepagesize
+ +
+
+ + diff --git a/htdocs/user_admin.php3 b/htdocs/user_admin.php3 new file mode 100644 index 0000000..e84b641 --- /dev/null +++ b/htdocs/user_admin.php3 @@ -0,0 +1,225 @@ + + +user information page + + + +
+
+User Name   + +  does not exist
+ + + +EOM; + exit(); + } +} + +if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3")) + include_once("../lib/sql/drivers/$config[sql_type]/functions.php3"); +else{ + echo <<user information page + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$weekly_limit = ($item_vals['Max-Weekly-Session'][0] != '') ? $item_vals['Max-Weekly-Session'][0] : $default_vals['Max-Weekly-Session']; +$weekly_limit = ($weekly_limit) ? $weekly_limit : $config[counter_default_weekly]; +$daily_limit = ($item_vals['Max-Daily-Session'][0] != '') ? $item_vals['Max-Daily-Session'][0] : $default_vals['Max-Daily-Session']; +$daily_limit = ($daily_limit) ? $daily_limit : $config[counter_default_daily]; +$session_limit = ($item_vals['Session-Timeout'][0] != '') ? $item_vals['Session-Timeout'][0] : $default_vals['Session-Timeout']; +$session_limit = ($session_limit) ? $session_limit : 'none'; + +$now = time(); +$week = $now - 604800; +$now_str = date("$config[sql_date_format]",$now + 86400); +$week_str = date("$config[sql_date_format]",$week); +$day = date('w'); +$week_start = date($config[sql_date_format],$now - ($day)*86400); +$today = $day; +$now_tmp = $now; +for ($i = $day; $i >-1; $i--){ + $days[$i] = date($config[sql_date_format],$now_tmp); + $now_tmp -= 86400; +} +$day++; +//$now -= ($day * 86400); +$now -= 604800; +$now += 86400; +for ($i = $day; $i <= 6; $i++){ + $days[$i] = date($config[sql_date_format],$now); +// $now -= 86400; + $now += 86400; +} + +$daily_used = $weekly_used = $monthly_used = $lastlog_session_time = '-'; +$extra_msg = ''; +$used = array('-','-','-','-','-','-','-'); + +$link = @da_sql_pconnect($config); +if ($link){ + $search = @da_sql_query($link,$config, + "SELECT sum(AcctSessionTime),sum(AcctInputOctets),sum(AcctOutputOctets), + avg(AcctSessionTime),avg(AcctInputOctets),avg(AcctOutputOctets),COUNT(*) FROM + $config[sql_accounting_table] WHERE UserName = '$login' + AND AcctStopTime >= '$week_str' AND AcctStopTime <= '$now_str';"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $tot_time = time2str($row['sum(AcctSessionTime)']); + $tot_input = bytes2str($row['sum(AcctInputOctets)']); + $tot_output = bytes2str($row['sum(AcctOutputOctets)']); + $avg_time = time2str($row['avg(AcctSessionTime)']); + $avg_input = bytes2str($row['avg(AcctInputOctets)']); + $avg_output = bytes2str($row['avg(AcctOutputOctets)']); + $tot_conns = $row['COUNT(*)']; + } + for($i = 0; $i <=6; $i++){ + if ($days[$i] == '') + continue; + $search = @da_sql_query($link,$config, + "SELECT sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE + UserName = '$login' AND AcctStopTime LIKE '$days[$i]%';"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $used[$i] = $row['sum(AcctSessionTime)']; + if ($used[$i] > $daily_limit) + $used[$i] = "" . time2str($used[$i]) . ""; + else + $used[$i] = time2str($used[$i]); + if ($today == $i){ + $daily_used = $row['sum(AcctSessionTime)']; + $remaining = $daily_limit - $daily_used; + if ($remaining <=0) + $remaining = 0; + $log_color = ($remaining) ? 'green' : 'red'; + if (!$remaining) + $extra_msg = '(Out of daily quota)'; + $daily_used = time2str($daily_used); + if (!$remaining) + $daily_used = "$daily_used"; + } + } + } + $search = @da_sql_query($link,$config, + "SELECT sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE + UserName = '$login' AND AcctStopTime >= '$week_start' AND + AcctStopTime <= '$now_str';"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $weekly_used = $row['sum(AcctSessionTime)']; + $tmp = $weekly_limit - $weekly_used; + if ($tmp <=0){ + $tmp = 0; + $extra_msg .= '(Out of weekly quota)'; + } + if ($remaining > $tmp) + $remaining = $tmp; + $log_color = ($remaining) ? 'green' : 'red'; + $weekly_used = time2str($weekly_used); + if (!$tmp) + $weekly_used = "$weekly_used"; + } + $search = @da_sql_query($link,$config, + "SELECT * FROM $config[sql_accounting_table] + WHERE UserName = '$login' AND AcctStopTime = '0' + ORDER BY AcctStartTime DESC LIMIT 1;"); + if ($search){ + if (@da_sql_num_rows($search,$config)){ + $logged_now = 1; + $row = @da_sql_fetch_array($search,$config); + $lastlog_time = $row['AcctStartTime']; + $lastlog_server_ip = $row['NASIPAddress']; + $lastlog_server_port = $row['NASPortId']; + $lastlog_session_time = date2timediv($lastlog_time); + $remaining = $daily_limit - $lastlog_session_time; + if ($remaining < 0) + $remaining = 0; + $log_color = ($remaining) ? 'green' : 'red'; + $lastlog_session_time_jvs = 1000 * $lastlog_session_time; + $lastlog_session_time = time2strclock($lastlog_session_time); + $lastlog_client_ip = $row['FramedIPAddress']; + $lastlog_server_name = gethostbyaddr($lastlog_server_ip); + $lastlog_client_name = gethostbyaddr($lastlog_client_ip); + $lastlog_input = $row['AcctInputOctets']; + if ($lastlog_input) + $lastlog_input = bytes2str($lastlog_input); + else + $lastlog_input = 'not available'; + $lastlog_output = $row['AcctOutputOctets']; + if ($lastlog_output) + $lastlog_input = bytes2str($lastlog_output); + else + $lastlog_output = 'not available'; + } + } + if (! $logged_now){ + $search = @da_sql_query($link,$config, + "SELECT * FROM $config[sql_accounting_table] + WHERE UserName = '$login' AND AcctSessionTime != '0' + ORDER BY AcctStopTime DESC LIMIT 1;"); + if ($search){ + if (@da_sql_num_rows($search,$config)){ + $row = @da_sql_fetch_array($search,$config); + $lastlog_time = $row['AcctStartTime']; + $lastlog_server_ip = $row['NASIPAddress']; + $lastlog_server_port = $row['NASPortId']; + $lastlog_session_time = time2str($row['AcctSessionTime']); + $lastlog_client_ip = $row['FramedIPAddress']; + $lastlog_server_name = gethostbyaddr($lastlog_server_ip); + $lastlog_client_name = gethostbyaddr($lastlog_client_ip); + $lastlog_input = $row['AcctInputOctets']; + $lastlog_input = bytes2str($lastlog_input); + $lastlog_output = $row['AcctOutputOctets']; + $lastlog_output = bytes2str($lastlog_output); + } + else + $not_known = 1; + } + } +} + +$monthly_limit = time2str($monthly_limit); +$weekly_limit = time2str($weekly_limit); +$daily_limit = time2str($daily_limit); +$session_limit = time2str($session_limit); +$remaining = time2str($remaining); + +if ($item_vals['Dialup-Access'][0] == 'FALSE') + $msg =<< The user account is locked +EON; +else + $msg =<< $remaining $extra_msg +EON; +$lock_msg = $item_vals['Dialup-Lock-Msg'][0]; +if ($lock_msg != '') + $descr =<<$lock_msg +EON; +else + $descr = '-'; + +require('../html/user_admin.html.php3'); diff --git a/htdocs/user_delete.php3 b/htdocs/user_delete.php3 new file mode 100644 index 0000000..b41bf27 --- /dev/null +++ b/htdocs/user_delete.php3 @@ -0,0 +1,76 @@ + + +delete user $login ($cn) + + + +
+ + + + +
+ + +EOM; + +include("../html/user_toolbar.html.php3"); + +print << + +
+
+ + + + +
+ + +
+ User $login Deletion  +
+
+ + +
+EOM; + +if ($delete_user == 1){ + if (is_file("../lib/$config[general_lib_type]/delete_user.php3")) + include("../lib/$config[general_lib_type]/delete_user.php3"); + echo <<
+
+ + +EOM; + exit(); +} +?> + + > + + + + + +
+Are you sure you want to delete user ? +
+
+ + +
+
+ + diff --git a/htdocs/user_edit.php3 b/htdocs/user_edit.php3 new file mode 100644 index 0000000..c53d79f --- /dev/null +++ b/htdocs/user_edit.php3 @@ -0,0 +1,134 @@ + + +subscription configuration for $login ($cn) + + + +
+ + + + +
+ + +EOM; + +include("../html/user_toolbar.html.php3"); + +print << + +
+
+ + + + +
+ + +
+ User Preferences for $login ($cn)  +
+
+ + +
+EOM; + +if ($change == 1){ + if (is_file("../lib/$config[general_lib_type]/change_attrs.php3")) + include("../lib/$config[general_lib_type]/change_attrs.php3"); + if ($passwd != '' && is_file("../lib/$config[general_lib_type]/change_passwd.php3")) + include("../lib/$config[general_lib_type]/change_passwd.php3"); + if (is_file("../lib/$config[general_lib_type]/user_info.php3")) + include("../lib/$config[general_lib_type]/user_info.php3"); +} +else if ($badusers == 1){ + if (is_file("../lib/add_badusers.php3")) + include("../lib/add_badusers.php3"); +} + +?> +
+ > + + + + + + + + + $desc){ + $name = $attrmap["$key"]; + if ($name == 'none') + continue; + unset($vals); + if (count($item_vals["$key"])){ + for($i=0;$i<$item_vals["$key"][count];$i++) + $vals[] = $item_vals["$key"][$i]; + } + else + $vals[] = $default_vals["$key"]; + if ($add && $name == $add_attr) + array_push($vals, $default_vals["$key"]); + + $i = 0; + foreach($vals as $val){ + $name1 = $name . $i; + $i++; + print << + + + +EOM; + } + } +?> + + + + +
+User Password (changes only) + + +
+$desc + + +
+Add Attribute + + +
+
+ +

+ +
+
+
+ + diff --git a/htdocs/user_finger.php3 b/htdocs/user_finger.php3 new file mode 100644 index 0000000..a66c222 --- /dev/null +++ b/htdocs/user_finger.php3 @@ -0,0 +1,152 @@ + + + +User Finger Facility + + + + + +
+Could not include SQL library functions. Aborting + + +EOM; + exit(); +} + +$date = strftime('%A, %e %B %Y, %T %Z'); + +$link = @da_sql_pconnect($config); +$link2 = connect2db($config); +if ($link){ + $h = 21; + while(1){ + $i++; + $num = 0; + $nas = 'nas' . $i; + $name = $nas . '_name'; + $model = $nas . '_model'; + $community = $nas . '_community'; + $ip = $nas . '_ip'; + $portnum = $nas . '_port_num'; + + if ($config[$name] == ''){ + $i--; + break; + } + $name_data = $config[$ip]; + $community_data = $config[$community]; + $server_name[$i] = $config[$name]; + $server_model[$i] = $config[$model]; + $users=exec("$config[general_snmpfinger_bin] $name_data $community_data"); + if (strlen($users)) + $extra = "AND UserName IN ($users)"; + else + $extra = ""; + $search = @da_sql_query($link,$config, + "SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId + FROM $config[sql_accounting_table] WHERE + AcctStopTime = '0' AND NASIPAddress = '$name_data' $extra + GROUP BY UserName ORDER BY AcctStartTime;"); + if ($search){ + while($row = @da_sql_fetch_array($search,$config)){ + $num++; + $h += 21; + $user = $row['UserName']; + $finger_info[$i][$num]['ip'] = $row['FramedIPAddress']; + if ($finger_info[$i][$num]['ip'] == '') + $finger_info[$i][$num]['ip'] = '-'; + $session_time = $row['AcctStartTime']; + $session_time = date2timediv($session_time); + $finger_info[$i][$num]['session_time'] = time2strclock($session_time); + $finger_info[$i][$num]['user'] = $user; + $finger_info[$i][$num]['callerid'] = $row['CallingStationId']; + if ($finger_info[$i][$num]['callerid'] == '') + $finger_info[$i][$num]['callerid'] = '-'; + if ($user_info["$user"] == ''){ + $user_info["$user"] = get_user_info($link2,$user,$config); + if ($user_info["$user"] == '' || $user_info["$user"] == ' ') + $user_info["$user"] = 'Unknown User'; + } + } + $height[$i] = $h; + } + $server_loggedin[$i] = $num; + $server_rem[$i] = ($config[$portnum]) ? ($config[$portnum] - $num) : 'unknown'; + } +} +?> + + +
+ + + + +
+
+ + + + + +
+ + +
+ Online Users  +
+
+ + +
+$date +EOM; + for($j = 1; $j <= $i; $j++){ + echo << + + + +
$server_name[$j]
$server_model[$j]
$server_loggedin[$j] users connected$server_rem[$j] free lines
+
+ + + + +EOM; + for( $k = 1; $k <= $server_loggedin[$j]; $k++){ + $user = $finger_info[$j][$k][user]; + $time = $finger_info[$j][$k][session_time]; + $ip = $finger_info[$j][$k][ip]; + $cid = $finger_info[$j][$k][callerid]; + $inf = $user_info[$user]; + echo << + + +EOM; + } + + echo << + +EOM; +} +?> + +
#userip addresscaller idnameduration
$k$user$ip$cid$inf$time
+
+

+ diff --git a/htdocs/user_new.php3 b/htdocs/user_new.php3 new file mode 100644 index 0000000..0837a68 --- /dev/null +++ b/htdocs/user_new.php3 @@ -0,0 +1,145 @@ + + + + +New user creation page + + + +

+ + + + +
+ +
+ + + + + +
+ + +
+ User Preferences for new user  +
+
+ + +
+ +The username $login already exists in the user database +EOM; + } + else{ + if (is_file("../lib/$config[general_lib_type]/create_user.php3")) + include("../lib/$config[general_lib_type]/create_user.php3"); + } +} +?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +EOM; + foreach($show_attrs as $key => $desc){ + $name = $attrmap["$key"]; + if ($name == 'none') + continue; + $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"]; + print << + + + +EOM; + } +?> +
+ Username + + +
+ Password + + +
+ Name (First Name Surname) + + +
+ Mail + + +
+ Departement + + +
+ Home Phone + + +
+ Work Phone + + +
+ Mobile Phone + + +
+$desc + + +
+
+ +

+ +
+
+
+ + diff --git a/htdocs/user_state.php3 b/htdocs/user_state.php3 new file mode 100644 index 0000000..e9a31d9 --- /dev/null +++ b/htdocs/user_state.php3 @@ -0,0 +1,55 @@ + 'TRUE','Dialup-Lock-Msg' => '-', + 'Max-Weekly-Session' => 0,'Max-Daily-Session' => 0); +foreach($vars as $key => $val){ + $val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"]; + $vars["$key"]=$val; +} +$vars['Dialup-Access'] = ($vars['Dialup-Access'] == 'FALSE') ? 'inactive' : 'active'; +$vars['Max-Daily-Session'] = time2strclock($vars['Max-Daily-Session']); +$vars['Max-Weekly-Session'] = time2strclock($vars['Max-Weekly-Session']); + +$now = time(); +$week = $now - date('w') * 86400; +$now_str = date("$config[sql_date_format]",$now + 86400); +$week_str = date("$config[sql_date_format]",$week); +$today = date("$config[sql_date_format]",$now); + +$link = @da_sql_pconnect($config); +if ($link){ + $search = @da_sql_query($link,$config, + "SELECT COUNT(*), sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE + UserName = '$login' AND AcctStopTime >= '$week_str' AND + AcctStopTime <= '$now_str';"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $weekly_used = time2strclock($row['sum(AcctSessionTime)']); + $weekly_conns = $row['COUNT(*)']; + } + $search = @da_sql_query($link,$config, + "SELECT COUNT(*),sum(AcctSessionTime) FROM $config[sql_accounting_table] WHERE + UserName = '$login' AND AcctStopTime LIKE '$today%';"); + if ($search){ + $row = @da_sql_fetch_array($search,$config); + $daily_used = time2strclock($row['sum(AcctSessionTime)']); + $daily_conns = $row['COUNT(*)']; + } +} + + +foreach($vars as $val){ + echo "$val\n"; +} +echo "$weekly_used\n$weekly_conns\n$daily_used\n$daily_conns"; +?> diff --git a/htdocs/user_test.php3 b/htdocs/user_test.php3 new file mode 100644 index 0000000..e28bb68 --- /dev/null +++ b/htdocs/user_test.php3 @@ -0,0 +1,184 @@ + + +test user $login ($cn) + + + +
+ + + + +
+ + +EOM; + +if (!$test_login) + include("../html/user_toolbar.html.php3"); + +print << + +
+
+ + + + +
+ + +
+EOM; + +if ($test_login){ + print <<Radius Server Test Page  +EOM; +}else{ + print <<User $login Test Page  +EOM; +} +?> +
+
+ + +
+ +' . $tmp_file; + $fp = popen("$comm","w"); + if ($fp){ + foreach ($req as $val){ + fwrite($fp,$val); + } + if ($test_login){ + $test=1; + fwrite($fp, "User-Name = \"$config[general_test_account_login]\"\n"); + fwrite($fp, "Password = \"$config[general_test_account_password]\"\n"); + pclose($fp); + } + else{ + fwrite($fp, "User-Name = \"$login\"\n"); + if ($auth_proto == 'pap') + fwrite($fp, "Password = \"$passwd\"\n"); + else if ($auth_proto == 'chap') + fwrite($fp, "CHAP-Password = \"$passwd\"\n"); + pclose($fp); + } + $reply = file($tmp_file); + unlink($tmp_file); + if (ereg('code 2', $reply[0])) + $msg = "Authentication was successful"; + else if (ereg('code 3',$reply[0])) + $msg = "Authentication failed"; + else if (ereg('no response from server', $reply[0])) + $msg = "No response from server"; + else if (ereg('Connection refused',$reply[0])) + $msg = "Connection was refused"; + if ($test_login) + $msg .= " (test user $login)
\n"; + else + $msg .= "

\n"; + array_shift($reply); + if (count($reply)){ + $msg .= "
Server response:
\n"; + foreach ($reply as $val){ + $msg .= "$val
\n"; + } + } + if ($test_login){ + print << +
+
+ + +EOM; + exit(); + } + + } +} +?> +
+ > + + + + + + + + + + + + + + + + + + + +
+User Password + + +
+Radius Server + + +
+Radius Server Port + + +
+Authentication Protocol + + +
+
+ +
+ +$msg +EOM; +} +?> +
+
+ + diff --git a/html/stats.html.php3 b/html/stats.html.php3 new file mode 100644 index 0000000..ce1809e --- /dev/null +++ b/html/stats.html.php3 @@ -0,0 +1,270 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
from dateto dateuseron server 
+

+ + + + + +
+ + +   + statistics period:
+$after up to $before +EOM; +?> +
+

access statistics

+ + + + +
+
+ statistics for +all users +EOM; +else + echo <<$login +EOM; +?> +
+
+ + + + +

+
+
+ + + + + + + +
+
+ + + + +
+ + + + +
+
+
+
+ + + + + +
+ + +
+ Daily Analysis  +
+
+ + +
+

+ + + +$message[$column1] + + +EOM; +?> + + + + + + + + + + + + + +EOM; +} +?> +
date$message[$column2]$message[$column3]
$day{$data[$day][1]}{$perc[$day][1]} + + + + +
the $message[$column1] for $day is {$data[$day][1]}
+
{$data[$day][2]}{$perc[$day][2]} + + + + +
the $message[$column3] for $day is {$data[$day][2]}
+
{$data[$day][3]}{$perc[$day][3]} + + + + +
the $message[$column3] for $day is {$data[$day][3]}
+
+

+
+
+

+ + + + + +
+ + +
+ Daily Summary  +
+
+ +
+

+ + + +$message[$column1] + + +EOM; +?> + + + + + + + + + + + + + + + + + + + +EOM; +?> +
 $message[$column2]$message[$column3]
maximum{$data[max][1]}{$data[max][2]}{$data[max][3]}
average{$data[avg][1]}{$data[avg][2]}{$data[avg][3]}
sum{$data[sum][1]}{$data[sum][2]}{$data[sum][3]}
+

+
+ + +

+
+ + diff --git a/html/user_admin.html.php3 b/html/user_admin.html.php3 new file mode 100644 index 0000000..066ea22 --- /dev/null +++ b/html/user_admin.html.php3 @@ -0,0 +1,413 @@ +user information for $cn + + + +EOM; +if ($logged_now) + print << + + +EOM; + +print << + + + + +
+ +EOM; + +include("../html/user_toolbar.html.php3"); + +print << +
+
+ + +
+ + + +
+ + +
+ Connection Status for $login ($cn)  +
+
+ +
+ + +EOM; +if ($logged_now){ + print << + + + + + + + + +EOM; +}else if ($not_known) print << +EOM; +else print << + + + + + + + +EOM; + +print << + +
+ User is online since + + $lastlog_time +
+ Connection Duration + + +
+ User IP Address + + $lastlog_client_name ($lastlog_client_ip) +
+ NAS Server + + $lastlog_server_name ($lastlog_server_ip) +
+ NAS Port + + $lastlog_server_port +
+ Upload + + $lastlog_input +
+ Download + + $lastlog_output +
+ This user has never connected + - +
+ User is not online now
+
- +
+ Last Connection Time + + $lastlog_time +
+ IP Address + + $lastlog_client_name ($lastlog_client_ip) +
+ Online Time + + $lastlog_session_time +
+ NAS Server + + $lastlog_server_name ($lastlog_server_ip) +
+ NAS Port + + $lastlog_server_port +
+ Upload + + $lastlog_input +
+ Download + + $lastlog_output +
+ Allowed Session + + $msg +
+ Usefull User Description + + $descr +
+
+
+ +EOM; + +if (is_file("../lib/$config[general_lib_type]/password_check.php3")) + include("../lib/$config[general_lib_type]/password_check.php3"); + +echo << + + + + +
+ + +
+ Account Status For The Last 7 Days  +
+
+ +
+ + + + + + + + +
Connections + $tot_conns
Online time + $tot_time
Upload + $tot_input
Download + $tot_output
Average Time + $avg_time
Average Upload + $avg_input
Average Download + $avg_output
+
+
+
+ + + + +
+ + +
+ Subscription Analysis  +
+
+ +
+ + + + +
-monthlyweeklydailyper session
limit$monthly_limit$weekly_limit$daily_limit$session_limit
used$monthly_used$weekly_used$daily_used$lastlog_session_time
+ + + + + + + + + +
daydaily limitused
sunday$daily_limit$used[0]
monday$daily_limit$used[1]
tuesday$daily_limit$used[2]
wednesday$daily_limit$used[3]
thursday$daily_limit$used[4]
friday$daily_limit$used[5]
saturday$daily_limit$used[6]
+
+
+EOM; + +if ($user_info) print << + + + + + +
+ Personal Information +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ name + + $cn +
+ name ($config[general_prefered_lang_name]) + + $cn_lang +
+ departement + + $ou +
+ departement ($config[general_prefered_lang_name]) + + $ou_lang +
+ title + + $title +
+ title ($config[general_prefered_lang_name]) + + $title_lang +
+ address + + $homeaddress +
+ address ($config[general_prefered_lang_name]) + + $homeaddress_lang +
+ phone + + $telephonenumber +
+ home phone + + $homephone +
+ mobile + + $mobile +
+ fax + + $fax +
+ home page + + $url +
+ e-mail + + $mail +
+ e-mail alias + + $mailalt +
+
+ + +EOM; +?> + + + + + startcounter(); + +EOM; +?> + + + diff --git a/html/user_toolbar.html.php3 b/html/user_toolbar.html.php3 new file mode 100644 index 0000000..456a638 --- /dev/null +++ b/html/user_toolbar.html.php3 @@ -0,0 +1,18 @@ + + +SHOW + +EDIT + +ACCOUNTING + +BADUSERS + +DELETE + +TEST + +EOM; +?> diff --git a/lib/acctshow.php3 b/lib/acctshow.php3 new file mode 100644 index 0000000..3ba0d66 --- /dev/null +++ b/lib/acctshow.php3 @@ -0,0 +1,13 @@ + diff --git a/lib/add_badusers.php3 b/lib/add_badusers.php3 new file mode 100644 index 0000000..7ed0574 --- /dev/null +++ b/lib/add_badusers.php3 @@ -0,0 +1,25 @@ +Could not include SQL library
\n"; + exit(); +} + +$date=date($config[sql_full_date_format]); +$msg = $$attrmap['Dialup-Lock-Msg']; +if ($msg == '') + echo "Lock Message should not be empty
\n"; +else{ + $link = @da_sql_pconnect($config); + if ($link){ + $r = da_sql_query($link,$config, + "INSERT INTO $config[sql_badusers_table] (UserName,Date,Reason) + VALUES ('$login','$date','$msg');"); + if (!$r) + echo "SQL Error:" . da_sql_error($link) . "
\n"; + } + else + echo "SQL Error: Could not connect to sql server(" . da_sql_error($link) . ")
\n"; +} +?> diff --git a/lib/attrshow.php3 b/lib/attrshow.php3 new file mode 100644 index 0000000..8c26f14 --- /dev/null +++ b/lib/attrshow.php3 @@ -0,0 +1,11 @@ + diff --git a/lib/crypt/clear.php3 b/lib/crypt/clear.php3 new file mode 100644 index 0000000..a4771d1 --- /dev/null +++ b/lib/crypt/clear.php3 @@ -0,0 +1,6 @@ + diff --git a/lib/crypt/crypt.php3 b/lib/crypt/crypt.php3 new file mode 100644 index 0000000..037c418 --- /dev/null +++ b/lib/crypt/crypt.php3 @@ -0,0 +1,12 @@ + diff --git a/lib/crypt/md5.php3 b/lib/crypt/md5.php3 new file mode 100644 index 0000000..7d0c2cc --- /dev/null +++ b/lib/crypt/md5.php3 @@ -0,0 +1,6 @@ + diff --git a/lib/defaults.php3 b/lib/defaults.php3 new file mode 100644 index 0000000..1bdce8f --- /dev/null +++ b/lib/defaults.php3 @@ -0,0 +1,11 @@ + 524288) + $str = sprintf("%5.2f MBs", $bytes/1048576); + else + $str = sprintf("%5.2f KBs", $bytes/1024); + + return $str; +} + +function nothing($ret) +{ + return $ret; +} +?> diff --git a/lib/lang/default/utf8.php3 b/lib/lang/default/utf8.php3 new file mode 100644 index 0000000..aea4837 --- /dev/null +++ b/lib/lang/default/utf8.php3 @@ -0,0 +1,11 @@ + diff --git a/lib/lang/el/utf8.php3 b/lib/lang/el/utf8.php3 new file mode 100644 index 0000000..8048ea7 --- /dev/null +++ b/lib/lang/el/utf8.php3 @@ -0,0 +1,49 @@ +"~@", ""=>"~A", "‚"=>"~B", "ƒ"=>"~C", "„"=>"~D", "…"=>"~E", + "†"=>"~F", "‡"=>"~G", "ˆ"=>"~H", "‰"=>"~I", "Š"=>"~J", "‹"=>"~K", + "Œ"=>"~L", ""=>"~M", "Ž"=>"~N", ""=>"~O", ""=>"~P", "‘"=>"~Q", + "’"=>"~R", "“"=>"~S", "”"=>"~T", "•"=>"~U", "–"=>"~V", "—"=>"~W", + "ž"=>"~^", "Ÿ"=>"~_", " "=>"| ", "ʽ"=>"¡", "ʼ"=>"¢", "£"=>"£", + "�"=>"¤", "�"=>"¥", "¦"=>"¦", "§"=>"§", "¨"=>"¨", "©"=>"©", + "�"=>"ª", "«"=>"«", "¬"=>"¬", "­"=>"­", "�"=>"®", "―"=>"¯", + "°"=>"°", "±"=>"±", "²"=>"²", "³"=>"³", "΄"=>"´", "΅"=>"µ", + "Ά"=>"¶", "·"=>"·", "Έ"=>"¸", "Ή"=>"¹", "Ί"=>"º", "»"=>"»", + "Ό"=>"¼", "½"=>"½", "Ύ"=>"¾", "Ώ"=>"¿", "ΐ"=>"À", "Α"=>"Á", + "Β"=>"Â", "Γ"=>"Ã", "Δ"=>"Ä", "Ε"=>"Å", "Ζ"=>"Æ", "Η"=>"Ç", + "Θ"=>"È", "Ι"=>"É", "Κ"=>"Ê", "Λ"=>"Ë", "Μ"=>"Ì", "Ν"=>"Í", + "Ξ"=>"Î", "Ο"=>"Ï", "Π"=>"Ð", "Ρ"=>"Ñ", "�"=>"Ò", "Σ"=>"Ó", + "Τ"=>"Ô", "Î¥"=>"Õ", "Φ"=>"Ö", "Χ"=>"×", "Ψ"=>"Ø", "Ω"=>"Ù", + "Ϊ"=>"Ú", "Ϋ"=>"Û", "ά"=>"Ü", "έ"=>"Ý", "ή"=>"Þ", "ί"=>"ß", + "ΰ"=>"à", "α"=>"á", "β"=>"â", "γ"=>"ã", "δ"=>"ä", "ε"=>"å", + "ζ"=>"æ", "η"=>"ç", "θ"=>"è", "ι"=>"é", "κ"=>"ê", "λ"=>"ë", + "μ"=>"ì", "ν"=>"í", "ξ"=>"î", "ο"=>"ï", "π"=>"ð", "ρ"=>"ñ", + "ς"=>"ò", "σ"=>"ó", "τ"=>"ô", "υ"=>"õ", "φ"=>"ö", "χ"=>"÷", + "ψ"=>"ø", "ω"=>"ù", "ϊ"=>"ú", "ϋ"=>"û", "ό"=>"ü", "ύ"=>"ý", + "ώ"=>"þ", "˜"=>"~X", "™"=>"~Y", "š"=>"~Z", "›"=>"~[", ""=>"~]" + ); + + return $k; +} + +function decode_string($line,$k) +{ + $line = ereg_replace("&","&&",$line); + $line = ereg_replace("([,+0-9./() -])", "%\\1", $line); + $mline = chunk_split($line, 2, " "); + $chars = explode(" ", $mline); + foreach ($chars as $c){ + $val = $k["$c"]; + $c = ($val != "") ? "$val" : "$c"; + $new_line .= $c; + } + $new_line = ereg_replace("%%", " ", $new_line); + $new_line = ereg_replace("%([,+0-9./() -])", "\\1", $new_line); + $new_line = ereg_replace("%", " ",$new_line); + $new_line = ereg_replace("&&","&",$new_line); + + return $new_line; +} +?> diff --git a/lib/ldap/attrmap.php3 b/lib/ldap/attrmap.php3 new file mode 100644 index 0000000..f7a3199 --- /dev/null +++ b/lib/ldap/attrmap.php3 @@ -0,0 +1,21 @@ + diff --git a/lib/ldap/change_attrs.php3 b/lib/ldap/change_attrs.php3 new file mode 100644 index 0000000..7a0ea52 --- /dev/null +++ b/lib/ldap/change_attrs.php3 @@ -0,0 +1,67 @@ + $attr){ + if ($attrmap["$key"] == 'none') + continue; + $i = $j = 0; + $name = $attrmap["$key"] . $i; + + while (isset($$name)){ + $val = $$name; + $i++; + $name = $attrmap["$key"] . $i; +// +// if value is the same as the default and the corresponding attribute in ldap does not exist or +// the value is the same as that in ldap then continue +// + if ( ($val == $default_vals["$key"] && !isset($item_vals["$key"][$j])) || + $val == $item_vals["$key"][$j]) + continue; +// +// if value is null and ldap attribute does not exist then continue +// + if ($val == '' && !isset($item_vals["$key"][$j])) + continue; +// +// if values is the same as the default or if the value is null and the ldap attribute exists +// then delete them +// + if (($val == $default_vals["$key"] || $val == '') && + isset($item_vals["$key"][$j])) + $del[$attrmap["$key"]] = $item_vals["$key"][$j]; +// +// else modify the ldap attribute +// + else{ + if (isset($item_vals["$key"][$j])){ + $mod[$attrmap["$key"]] = $item_vals["$key"][$j]; + $add_r[$attrmap["$key"]] = $val; + } + else{ + $add_r[$attrmap["$key"]] = $val; + } + } + $j++; + } + } + if (isset($mod)){ + @ldap_mod_del($ds,$dn,$mod); + } + if (isset($add_r)){ + @ldap_mod_add($ds,$dn,$add_r); + } + if (isset($del)){ + @ldap_mod_del($ds,$dn,$del); + } + } + if (@ldap_error($ds) == 'Success') + echo "The changes were successfully commited to the directory
\n"; + else + echo "LDAP ERROR: " . ldap_error($ds) . "
\n"; + @ldap_close($ds); + } +?> diff --git a/lib/ldap/change_passwd.php3 b/lib/ldap/change_passwd.php3 new file mode 100644 index 0000000..b032cdd --- /dev/null +++ b/lib/ldap/change_passwd.php3 @@ -0,0 +1,20 @@ +LDAP ERROR: " . ldap_error($ds) . "
\n"; + } + else + echo "Could not open encryption library file.
\n"; + } + @ldap_close($ds); + } +?> diff --git a/lib/ldap/create_user.php3 b/lib/ldap/create_user.php3 new file mode 100644 index 0000000..d18f117 --- /dev/null +++ b/lib/ldap/create_user.php3 @@ -0,0 +1,58 @@ +Could not open encryption library file.Password will be clear text.
\n"; + $new_user_entry[$attrmap['User-Password']]="{clear}" . $passwd; + } + + print_r($new_user_entry); + + @ldap_add($ds,$dn,$new_user_entry); + + foreach($show_attrs as $key => $attr){ + if ($attrmap["$key"] == 'none') + continue; +// +// if value is the same as the default and the corresponding attribute in ldap does not exist or +// the value is the same as that in ldap then continue +// + if ( $$attrmap["$key"] == $default_vals["$key"]) + continue; + if ( $$attrmap["$key"] == '') + continue; + $mod[$attrmap["$key"]] = $$attrmap["$key"]; + + @ldap_mod_add($ds,$dn,$mod); + } + } + if (@ldap_error($ds) == 'Success') + echo "User was added in user database
\n"; + else + echo "LDAP ERROR: " . ldap_error($ds) . "
\n"; + @ldap_close($ds); + } +?> diff --git a/lib/ldap/defaults.php3 b/lib/ldap/defaults.php3 new file mode 100644 index 0000000..c5fb4a5 --- /dev/null +++ b/lib/ldap/defaults.php3 @@ -0,0 +1,41 @@ + $val){ + if ($info[0]["$val"][0] != '') + $default_vals["$key"] = $info[0]["$val"][0]; + } + } + } + if ($regular_profile_attr != ''){ + $get_attrs = array("$regular_profile_attr"); + $sr=@ldap_search($ds,"$config[ldap_base]","uid=" . $login,$get_attrs); + if ($info = @ldap_get_entries($ds,$sr)){ + $dn2 = $info[0][$regular_profile_attr][0]; + if ($dn2 != ''){ + $sr2=@ldap_search($ds,"$dn2",'objectclass=*'); + if ($info2 = @ldap_get_entries($ds,$sr2)){ + $dn3 = $info2[0]['dn']; + if ($dn3 != ''){ + foreach($attrmap as $key => $val){ + if ($info2[0]["$val"][0] != '') + $default_vals["$key"] = $info2[0]["$val"][0]; + } + } + } + } + } + } + @ldap_close($ds); + } +} + +?> diff --git a/lib/ldap/delete_user.php3 b/lib/ldap/delete_user.php3 new file mode 100644 index 0000000..1d8aab2 --- /dev/null +++ b/lib/ldap/delete_user.php3 @@ -0,0 +1,14 @@ +User Deleted successfully
\n"; + else + echo "LDAP ERROR: " . ldap_error($ds) . "
\n"; + @ldap_close($ds); + } +} +?> diff --git a/lib/ldap/functions.php3 b/lib/ldap/functions.php3 new file mode 100644 index 0000000..72805d8 --- /dev/null +++ b/lib/ldap/functions.php3 @@ -0,0 +1,27 @@ + diff --git a/lib/ldap/password_check.php3 b/lib/ldap/password_check.php3 new file mode 100644 index 0000000..41dcb9d --- /dev/null +++ b/lib/ldap/password_check.php3 @@ -0,0 +1,23 @@ +YES It is that'; + else + $msg = 'NO It is wrong'; + } + else + $msg = 'User DN is not available. Check your configuration'; + @ldap_close($ds); + } + else + $msg = 'Could not connect to LDAP server'; + echo "$msg\n"; +} +?> + diff --git a/lib/ldap/personattrs.php3 b/lib/ldap/personattrs.php3 new file mode 100644 index 0000000..9807d0d --- /dev/null +++ b/lib/ldap/personattrs.php3 @@ -0,0 +1,11 @@ + diff --git a/lib/ldap/user_info.php3 b/lib/ldap/user_info.php3 new file mode 100644 index 0000000..73242fd --- /dev/null +++ b/lib/ldap/user_info.php3 @@ -0,0 +1,48 @@ + $val){ + $item_vals["$key"] = $info[0]["$val"]; + } + } + @ldap_close($ds); +} +?> diff --git a/lib/sql/attrmap.php3 b/lib/sql/attrmap.php3 new file mode 100644 index 0000000..9524f7d --- /dev/null +++ b/lib/sql/attrmap.php3 @@ -0,0 +1,11 @@ +Could not include SQL library
\n"; + exit(); +} +$link = @da_sql_pconnect($config); +if ($link){ + foreach($show_attrs as $key => $desc){ + if ($attrmap["$key"] == 'none') + continue; + $i = $j = 0; + $name = $attrmap["$key"] . $i; + + while(isset($$name)){ + $val=$$name; + $i++; + $name = $attrmap["$key"] . $i; + + $sql_attr=$attrmap["$key"]; + if ($attr_type["$key"] == 'checkItem') + $table = $config[sql_check_table]; + else if ($attr_type["$key"] == 'replyItem') + $table = $config[sql_reply_table]; + // if value is the same as that in the sql database do nothing + if ($val == $item_vals["$key"][$j]) + continue; + // if value is null and corresponding value exists then delete + else if (($val == $default_vals["$key"] || $val == '') && isset($item_vals["$key"][$j])){ + $res = @da_sql_query($link,$config, + "DELETE FROM $table WHERE UserName = '$login' AND Attribute = '$sql_attr';"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Delete failed for attribute $key
\n"; + } + // if value is null then don't add it + else if ($val == '') + continue; + // if value differs from the sql value then update + else{ + if (isset($item_vals["$key"][$j])) + $res = @da_sql_query($link,$config, + "UPDATE $table SET Value = '$val' WHERE UserName = '$login' AND + Attribute = '$sql_attr';"); + else + $res = @da_sql_query($link,$config, + "INSERT INTO $table (UserName,Attribute,Value) + VALUES ('$login','$sql_attr','$val');"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Change failed for attribute $key
\n"; + } + $j++; + } + } +} +else + echo "Could not connect to database
\n"; diff --git a/lib/sql/change_passwd.php3 b/lib/sql/change_passwd.php3 new file mode 100644 index 0000000..77c5f9e --- /dev/null +++ b/lib/sql/change_passwd.php3 @@ -0,0 +1,41 @@ +Could not include SQL library
\n"; + exit(); +} +$link = @da_sql_pconnect($config); +if ($link){ + if (is_file("../lib/crypt/$config[general_encryption_method].php3")){ + include("../lib/crypt/$config[general_encryption_method].php3"); + $passwd = da_encrypt($passwd); + $res = @da_sql_query($link,$config, + "SELECT Value FROM $config[sql_check_table] WHERE UserName = '$login' + AND Attribute = '$config[sql_password_attribute]';"); + if ($res){ + $row = @da_sql_fetch_array($res,$config); + if ($row){ + $res = @da_sql_query($link,$config, + "UPDATE $config[sql_check_table] SET Value = '$passwd' WHERE + Attribute = '$config[sql_password_attribute]' AND UserName = '$login';"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Error while changing password
\n"; + } + else{ + $res = @da_sql_query($link,$config, + "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName) + VALUES ('$config[sql_password_attribute]','$passwd','$login');"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Error while changing password
\n"; + } + } + else + echo "Error while executing query
\n"; + } + else + echo "Could not open encryption library file
\n"; +} +else + echo "Could not connect to database
\n"; +?> diff --git a/lib/sql/create_user.php3 b/lib/sql/create_user.php3 new file mode 100644 index 0000000..5c580ac --- /dev/null +++ b/lib/sql/create_user.php3 @@ -0,0 +1,63 @@ +Could not include SQL library
\n"; + exit(); +} +$da_abort=0; +$link = @da_sql_pconnect($config); +if ($link){ + if (is_file("../lib/crypt/$config[general_encryption_method].php3")){ + include("../lib/crypt/$config[general_encryption_method].php3"); + $passwd = da_encrypt($passwd); + $res = @da_sql_query($link,$config, + "INSERT INTO $config[sql_check_table] (Attribute,Value,UserName) + VALUES ('$config[sql_password_attribute]','$passwd','$login');"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)){ + echo "Unable to add user $login. SQL error
\n"; + $da_abort=1; + } + if ($config[sql_use_user_info_table] == 'true' && !$da_abort){ + $res = @da_sql_query($link,$config, + "SELECT UserName FROM $config[sql_user_info_table] WHERE + UserName = '$login';"); + if ($res){ + if (!@da_sql_num_rows($res,$config)){ + $res = @da_sql_query($link,$config, + "INSERT INTO $config[sql_user_info_table] + (UserName,Name,Mail,Department,HomePhone,WorkPhone,Mobile) VALUES + ('$login','$cn','$mail','$ou','$telephonenumber','$homephone','$mobile');"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Could not add user information in user info table
\n"; + } + else + echo "User already exists in user info table.
\n"; + } + } + if (!$da_abort){ + foreach($show_attrs as $key => $attr){ + if ($attrmap["$key"] == 'none') + continue; + if ($attr_type[$key] == 'checkItem') + $table = "$config[sql_check_table]"; + else if ($attr_type[$key] == 'replyItem') + $table = "$config[sql_reply_table]"; + $val = $$attrmap["$key"]; + if ($val == '' || $val == $default_vals["$key"]) + continue; + $res = @da_sql_query($link,$config, + "INSERT INTO $table (Attribute,Value,UserName) + VALUES ('$attrmap[$key]','$val','$login');"); + if (!$res || !@da_sql_affected_rows($link,$res,$config)) + echo "Query failed for attribute $key
\n"; + } + } + echo "User created successfully
\n"; + } + else + echo "Could not open encryption library file
\n"; +} +else + echo "Could not connect to database
\n"; +?> diff --git a/lib/sql/delete_user.php3 b/lib/sql/delete_user.php3 new file mode 100644 index 0000000..dee7a02 --- /dev/null +++ b/lib/sql/delete_user.php3 @@ -0,0 +1,33 @@ +Could not include SQL library
\n"; + exit(); +} +$link = @da_sql_pconnect($config); +if ($link){ + $res = @da_sql_query($link,$config, + "DELETE FROM $config[sql_reply_table] WHERE UserName = '$login';"); + if ($res){ + $res = @da_sql_query($link,$config, + "DELETE FROM $config[sql_check_table] WHERE UserName = '$login';"); + if ($res){ + if ($config[sql_use_user_info_table] == 'true'){ + $res = @da_sql_query($config[sql_database], + "DELETE FROM $config[sql_user_info_table] WHERE UserName = '$login';"); + if ($res) + echo "User $login deleted successfully
\n"; + else + echo "Error deleting user $login from user info table
\n"; + } + } + else + echo "Error deleting user $login from check table
\n"; + } + else + echo "Error deleting user $login from reply table
\n"; +} +else + echo "Could not connect to database
\n"; +?> diff --git a/lib/sql/drivers/mysql/functions.php3 b/lib/sql/drivers/mysql/functions.php3 new file mode 100644 index 0000000..b0ff08f --- /dev/null +++ b/lib/sql/drivers/mysql/functions.php3 @@ -0,0 +1,58 @@ + diff --git a/lib/sql/drivers/pg/functions.php3 b/lib/sql/drivers/pg/functions.php3 new file mode 100644 index 0000000..ba88622 --- /dev/null +++ b/lib/sql/drivers/pg/functions.php3 @@ -0,0 +1,87 @@ + '0' and + attrelid = (select oid from pg_class where relname='$table');"); + if ($res){ + $row = @pg_fetch_row($res,0); + if ($row){ + if (!$row[0]) + return NULL; + $fields[num] = $row[0]; + } + } + $res = @pg_exec($link, + "select attname from pg_attribute where attnum > '0' and + attrelid = (select oid from pg_class where relname='$table');"); + if ($res) + $fields[res]=$res; + else + return NULL; + + return $fields; +} + +function da_sql_num_fields($fields,$config) +{ + if ($fields) + return $fields[num]; +} + +function da_sql_field_name($fields,$num,$config) +{ + if ($fields){ + $row = @pg_fetch_row($fields[res],$num); + if ($row) + return $row[0]; + } +} + +function da_sql_error($link,$config) +{ + return pg_errormessage($link); +} +?> diff --git a/lib/sql/functions.php3 b/lib/sql/functions.php3 new file mode 100644 index 0000000..11f8cec --- /dev/null +++ b/lib/sql/functions.php3 @@ -0,0 +1,33 @@ +Could not include SQL library
\n"; + exit(); +} + +function connect2db($config) +{ + $link=@da_sql_pconnect($config); + + return $link; +} + +function get_user_info($link,$user,$config) +{ + if ($link && $config[sql_use_user_info_table] == 'true'){ + $res=@da_sql_query($link,$config, + "SELECT Name FROM $config[sql_user_info_table] WHERE UserName = '$user';"); + if ($res){ + $row = @da_sql_fetch_array($res,$config); + if ($row) + return $row[Name]; + } + } +} + +function closedb($link,$config) +{ + return 1; +} +?> diff --git a/lib/sql/password_check.php3 b/lib/sql/password_check.php3 new file mode 100644 index 0000000..f584fff --- /dev/null +++ b/lib/sql/password_check.php3 @@ -0,0 +1,35 @@ +Could not include SQL library
\n"; + exit(); +} + +if ($action == 'checkpass'){ + $link = @da_sql_pconnect($config); + if ($link){ + $res = @da_sql_query($link,$config, + "SELECT Value FROM $config[sql_check_table] WHERE UserName = '$login' + AND Attribute = '$config[sql_password_attribute]';"); + if ($res){ + $row = @da_sql_fetch_array($res,$config); + if (is_file("../lib/crypt/$config[general_encryption_method].php3")){ + include("../lib/crypt/$config[general_encryption_method].php3"); + $enc_passwd = $row[Value]; + $salt=substr($enc_passwd,0,2); + $passwd = da_encrypt($passwd,$salt); + if ($passwd == $enc_passwd) + $msg = 'YES It is that'; + else + $msg = 'NO It is wrong'; + } + else + echo "Could not open encryption library file
\n"; + } + } + echo "$msg\n"; +} +?> + diff --git a/lib/sql/user_info.php3 b/lib/sql/user_info.php3 new file mode 100644 index 0000000..215f46c --- /dev/null +++ b/lib/sql/user_info.php3 @@ -0,0 +1,62 @@ +Could not include SQL library
\n"; + exit(); +} +$user_exists = 'no'; +$link = @da_sql_pconnect($config); +if ($link){ + $res = @da_sql_query($link,$config, + "SELECT Attribute,Value FROM $config[sql_check_table] WHERE UserName = '$login';"); + if ($res){ + if (@da_sql_num_rows($res,$config)) + $user_exists = 'yes'; + while(($row = @da_sql_fetch_array($res,$config))){ + $attr = $row[Attribute]; + $val = $row[Value]; + $tmp["$attr"][]="$val"; + $tmp["$attr"][count]++; + } + $res = @da_sql_query($link,$config, + "SELECT Attribute,Value FROM $config[sql_reply_table] WHERE UserName = '$login';"); + if ($res){ + while(($row = @da_sql_fetch_array($res,$config))){ + $attr = $row[Attribute]; + $val = $row[Value]; + $tmp["$attr"][] = "$val"; + $tmp["$attr"][count]++; + } + if ($config[sql_use_user_info_table] == 'true'){ + $res = @da_sql_query($link,$config, + "SELECT * FROM $config[sql_user_info_table] WHERE UserName = '$login';"); + if ($res){ + if (($row = @da_sql_fetch_array($res,$config))){ + $cn = ($row[Name]) ? $row[Name] : '-'; + $telephonenumber = ($row[WorkPhone]) ? $row[WorkPhone] : '-'; + $homephone = ($row[HomePhone]) ? $row[HomePhone] : '-'; + $ou = ($row[Depatment]) ? $row[Department] : '-'; + $mail = ($row[Mail]) ? $row[Mail] : '-'; + $mobile = ($row[Mobile]) ? $row[Mobile] : '-'; + } + } + } + } + else + echo "Database query failed partially
\n"; + foreach($attrmap as $key => $val){ + if (isset($tmp[$val])){ + $item_vals["$key"] = $tmp[$val]; + $item_vals["$key"][count] = $tmp[$val][count]; + } + } + + } + else + echo "Database query failed
\n"; +} +else + echo "Could not connect to database
\n"; +?> diff --git a/sql/badusers.sql b/sql/badusers.sql new file mode 100644 index 0000000..09aa8c0 --- /dev/null +++ b/sql/badusers.sql @@ -0,0 +1,10 @@ +# +# Table structure for table 'badusers' +# +CREATE TABLE badusers ( + id int(10) DEFAULT '0' NOT NULL auto_increment, + UserName varchar(30), + Date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, + Reason varchar(200), + PRIMARY KEY (id) +); diff --git a/sql/userinfo.sql b/sql/userinfo.sql new file mode 100644 index 0000000..243a4f5 --- /dev/null +++ b/sql/userinfo.sql @@ -0,0 +1,14 @@ +# +# Table structure for table 'userinfo' +# +CREATE TABLE userinfo ( + id int(10) DEFAULT '0' NOT NULL auto_increment, + UserName varchar(30), + Name varchar(200), + Mail varchar(200), + Department varchar(200), + WorkPhone varchar(200), + HomePhone varchar(200), + Mobile varchar(200), + PRIMARY KEY (id) +); -- 2.39.5