"LMS" (LAN Management System) is a package of applications in PHP, Perl and C for managing LANs with MySQL, PostgreSQL or SQLite databases support. The main goal is to get the best service of customers at high provider's level. The main features in LMS are:
database of customers (name, surname, address, phone numbers, commentary and other),
database of computers (IP, MAC),
easy-ridden financial system and funds of network,
financial balances and invoices
sending e-mail warnings to users,
automatic billing,
generating of (almost) any kind of config file (i.e. ipchains/iptables based firewall script, dhcp daemon configuration, zone file for bind, static arp entries, oident, htb and more...)
visualization of internet link usage stats,
request tracker system (Helpdesk),
timetable (organizer).
All stuff was invented for administration of ASK NetX and there is still developed and tested.
LMS will not replace your administrator's skills. If you can't make so simple activity like installation or configuration, probably you'll cannot adjust LMS for your system. So, you must have knowledge about administration of UNIX systems.
PHP Code:
Lukasz 'Baseciq' Mozer |
Michal 'DziQs' Zapalski |
Radoslaw 'Warden' Antoniuk |
Krzysztof 'hunter' Drewicz |
Marcin 'Lexx' Krol |
Aleksander 'A.L.E.C' Machniak |
C Code:
Aleksander 'A.L.E.C' Machniak |
Marcin 'Lexx' Krol |
Perl Code:
Lukasz 'Baseciq' Mozer |
Michal 'DziQs' Zapalski |
Maciej 'agaran' Pijanka |
Krzysztof 'hunter' Drewicz |
Design:
Lukasz 'Baseciq' Mozer |
HTML, JavaScript, CSS:
Lukasz 'Baseciq' Mozer |
Pawel 'Bob_R' Czerski |
Pawel 'sickone' Kisiela |
Images:
Piotr 'Pierzak' M. |
Grzegorz 'byko' Cichowski |
Kuba 'kflis' Flis |
Lukasz 'Baseciq' Mozer |
Jakub 'Jimmac' Steiner |
MySQL Support:
Kuba 'shasta' Jankowski |
Radoslaw 'Warden' Antoniuk |
Przemysław Babinski |
PostgreSQL & SQLite Support:
Aleksander 'A.L.E.C' Machniak |
WWW Page & Documentation:
Aleksander 'A.L.E.C' Machniak |
Kuba 'shasta' Jankowski |
Grzegorz 'JaBBaS' Dziegielewski |
Lukasz 'Baseciq' Mozer |
Marcin 'Lexx' Krol |
Betatesting:
Grzegorz 'byko' Cichowski |
Radoslaw 'Warden' Antoniuk |
Tomasz 'dzwonek' Dzwonkowski |
Sebastian 'Victus' Frasunkiewicz |
Kuba 'kflis' Flis |
Krystian 'UFOczek' Kochanowski |
Grzegorz 'JaBBaS' Dziegielewski |
Andrzej 'chsh' Gradziel |
LMS uses elements of other software: phpMyAdmin, phpsysinfo, NewsPortal, overLIB, Multipart Mime Email Generator Library, ezpdf, Tigra Calendar, Piotr Kleban's polish procedures of number-to-words conversion and code examples from PHP manual.
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 you option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Text of License is here.
Preferably via a mailing list, which you can subscribe sending empty e-mail with subject "subscribe lms-en" on address ecartis@lists.rulez.pl, e-mails are sent on address lms-en@lists.rulez.pl.
In order to effectively report bugs or new ideas, best is to subscribe mailing list where somebody from authors or users will have a chance to answer on questions that are worrying you. Also, available is BTS, where can be bugs advertised (needed registration). Reports from BTS going also to mailing list so best to subscribe, report bug on BTS, send link on list and wait for events evolution. Address of BTS is http://bts.rulez.pl.
Allways, newest version of LMS can be downloaded from CVS repository CVS with help of www interface here, or classic (anonymous access, empty password):
cvs -d :pserver:cvs@cvs.rulez.pl:/home/cvsroot login cvs -d :pserver:cvs@cvs.rulez.pl:/home/cvsroot co lms cvs -d :pserver:cvs@cvs.rulez.pl:/home/cvsroot logout
Informations about changes, which was made in all versions of LMS are included in file ChangeLog.
LMS consist a few modules, body of LMS is LMS-UI (user interface). It is in integrity written in PHP and for work require database (in fact every module require database). Exactly in LMS-UI we perform all actions, the rest of modules is only for automate work of LMS.
LMS is also set of PERL scripts, and exactly these scripts requires to have that language interpreter. If you will want use these scripts, you must have PERL. Among others, scripts allow on monthly counting of subscription fees, or sending of admonitions. It is also LMS-MGC, witch is script too, but so much universal that can generate practically any config file and restart service on your server.
At the end it is also A.L.E.C's LMS Daemon, written in C language, which is assigned (in fact his plugins) for configuration files generation and services restarting. It can be used as replacement or addition of perl scripts. It responds for what has been changed in LMS-UI was made also in real.
Because LMS-UI is written in PHP, necessary is WWW server with interpreter of that language. Perefered server is Apache (www.apache.org).
Interpreter should be in version 4.2.x or higher, but on 4.1.x also works fine (but because developers uses 4.2.3 or higher, can't guarante correct work with older versions. PHP can be downloaded from page www.php.net.
LMS will not work correctly with MySQL versions older than 3.23.xx
LMS also works with PostgreSQL in version 7.3.x or higher.
Cooperation with SQLite database is possible too, but we are tested only version 2.8.11.
LMS-UI require Smarty library(http://smarty.php.net) in version 2.5.0 or higher (don't use 2.6.4 version).
If for LMS-UI will suffice above stuff, for working LMS-MGC and the rest of scripts you will need also Perl and modules for him:
perl and his basic modules (POSIX, GetOpt::Long);
Net::SMTP;
Config::IniFiles;
DBI;
DBD-mysql (if you will use mysql);
DBD-pg (if you will use postgres);
DBD-SQLite (if you will use SQLite);
If you'll runA.L.E.C's LMS Daemon is needed working C compiler, because daemon is providing only in the form of source code.
LMS in the form of tar.gz archive can be downloaded from project home page (www.lms.rulez.pl), afterd that should be extracted and placed in chosen directory (i.e. /var/www/lms ) available for server www:
$ cd /var/www $ wget http://lms.rulez.pl/download/stable/lms-x.x.x.tar.gz $ tar zxf lms-x.x.x.tar.gz
Two kind of LMS packets are available - including Smarty library (lms-x.x.x+libs.tar.gz) and without that library. If you haven't got package with libraries, you must get and placed them in directory lib.
$ cd /var/www/lms/lib $ wget http://smarty.php.net/distributions/Smarty-2.6.0.tar.gz $ tar zxf Smarty-2.6.0.tar.gz $ mv Smarty-2.6.0/libs Smarty
![]() | Placement of all directories can be set in section [directories] in file lms.ini. |
Files with configuration (sample/lms.ini and sample/lms-mgc.ini) place in directory /etc/lms.
Exec scripts from directory bin is preferably to move to directory /usr/sbin.
![]() | Server www must have reading rights on file lms.ini and writing rights on directory backup. It makes potential drop of system security level. |
That very popular database is available with majority of Linux distributions. If however you must install it independently, begin from sources downloading from www.mysql.com.
After extracting, go to directory with MySQL and type sequence of commands:
$ ./configure --prefix=/usr/local/mysql $ make $ make install $ /usr/local/mysql/bin/mysql_install_db $ chown mysql -R /usr/local/mysql/var $ /usr/local/mysql/bin/safe_mysqld & $ /usr/local/mysql/bin/mysqladmin -u root password nowe_hasło
It is necesserily if you run LMS at the FIRST time. If you are upgrading LMS from older version, appropriate notes what to do with database stands in ChangeLog file. So, go to directory, in which you've got LMS and run mysql's shell:
mysql -u[here enter user with full access rights to database] -p Enter password:[just enter password:)] mysql> create database lms; mysql> grant usage on lms.* to lms@localhost; mysql> grant select,insert,update,delete,create,alter on lms.* to lms@localhost identified by 'haslo'; mysql> flush privileges; mysql> use lms; mysql> source doc/lms.mysql;
Because MySQL is default database for LMS, configuration is limited for setting in section [database] of file /etc/lms/lms.ini password and user's name:
user = lms password = your_password
After that, if LMS can establish connection to database server, it is possible get to the system without problems. If in database is no such administrator account, only thing what you'll see be form of administrator addition. When you enter correct admin personal details, LMS will move you to login page, where at once you can use newly created account.
Let's stop here, add some stuff to cron, for peace of mind:
12 4 3,10,17,21,28 * * /usr/bin/mysqldump -u lms --password=your-super-secret-password \ --add-drop-table --add-locks lms > backups/lms-auto-"$(date +%s)".sql
That will create at 4:12 morning, every 3, 10, 17, 21 and 28 day of month automagic mysql database backup.
LMS is tested on PostgreSQL 7.3.4 and higher, but because special properties of that base are not used, there will be no problem with later versions. If you have not instaled PostgreSQL server, best solution will be selfhand compilation from sources available on www.postgresql.org.
That is a short version of installation procedure, more info can be find in postgres documentation. After download and extraction go to main directory and run following commands:
$ ./configure --enable-locale $ gmake $ su $ gmake install $ adduser postgres $ mkdir /usr/local/pgsql/data $ chown postgres /usr/local/pgsql/data $ su - postgres $ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data $ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
While server is running you can enter finto creation of database with name 'lms', which owner will be user with login 'lms'.
$ /usr/local/pgsql/bin/createuser -d -A -P lms $ /usr/local/pgsql/bin/createdb -E LATIN2 -U lms lms $ /usr/local/pgsql/bin/psql -d lms -U lms -f /lms/doc/lms.pgsql
For LMS default database server is MySQL, so in section [database] of file /etc/lms/lms.ini you must set following options:
type = postgres user = lms password = password_entered_while_user_lms_account_creation
![]() | Password's demand depends on configuration of postgres users autentication in /usr/local/pgsql/data/pg_hba.conf. By default password is not required. |
After that, if LMS connects to database, you can without problems enter to the system. If in database will be not administrator's account, only thing what you'll see will be form of administrator's account addition. When you enter correct data LMS will move you to login page, when you can use newly created account.
This one-file database is commend for speed. Authors define that it is 2-3 times faster than MySQL. Furthermore, with properly configuration it's possible to load whole database in to the RAM menory, during this the efficiency highly increases. Below is short description of installation. Sources can be downloaded from: www.sqlite.org.
Here You can see how to install the SQLite libraries and adding this service to PHP database (in PHP 5.0 ver. have SQLite built in). After unpacking sources go to SQLite directory and type in Commands step by step (for example):
$ ./configure $ make $ make install $ ldconfig $ pear download http://pecl.php.net/get/SQLite-1.0.2.tgz $ pear install SQLite-1.0.2.tgzNext in php.ini set:
extension=sqlite.soThere is option to compile-in SQLite into PHP : --with-sqlite.
It's necessarily when You running LMS FIRST TIME! Go to Yours LMS directory and run SQlite shell:
$ sqlite -init doc/lms.sqlite /usr/local/lms/lms.db sqlite> .exit $ chown 99.98 /usr/local/lms/lms
One of the SQLite limits is no authenticity of users, that's why configuration request only setting type and path to the database file. In section [database] pliku /etc/lms/lms.ini set:
type = sqlite database = /usr/local/lms/lms.db
Now we can get in to the system. But if in Database is no user account, we will see add user account form.
Main configuration file of LMS is lms.ini, which must be placed in directory /etc/lms or in root directory of LMS. It contains configuration options of LMS-UI and all script with exception of LMS-MGC.
![]() | Remember to remove semicolons from begining of line with seted parameter. |
type
Database type. Actually in 100% supported is 'mysql', but for the time being isn't seen problems with 'postgres' and 'sqlite'. Default: mysql
Example: type = mysql
host
Host where database is installed. Most often, localhost, but can here set anything (IP, domain, path to socket in format 'localhost:/path/to/socket'). Default: localhost
Example: host = localhost
user
Name of database user account. In many cases (if you've go by documentation) that will be 'lms'. When you'll want to use privileged account, probably you'll enter 'root' (MySQL on most of *nixes), 'mysql' (on PLD) or 'postgres' (PostgreSQL). Default: mysql
Example: user = lms
password
Database password. Default: empty.
Example: password = password
database
Name of database (for SQLite path to database file). Default: lms.
Example: database = lms
server_encoding
Database encoding. Use if your database encoding is not unicode. Postgres is taking up conversion by himself, but in case of mysql for conversion is used php/iconv in LMS db-drivers. Default: unicode.
Example: server_encoding = latin2
sys_dir
System directory. It is a place where is entire content of LMS's UI, that means index.php, graphics, templates and the rest. By default index.php seek in filesystem using getcwd(), but better is to say him where hi is:
Example: sys_dir = /var/www/htdocs/lms/
modules_dir
Directory with "modules" of LMS. That is content of /modules directory. By default it is subdirectory modules in sys_dir.
Example: modules_dir = /usr/share/lms/modules/
lib_dir
Directory with "libraries" of LMS. That is content of /lib directory. By default it is subdirectory lib in sys_dir.
Example: lib_dir = /usr/share/lms/lib/
backup_dir
Directory for database backup files - place where LMS write database snapshots. By default it is subdirectory backups in sys_dir.
Example: backup_dir = /var/backup/lms/
![]() | If directory with backups will be accessible from WWW level, then anybody will can to access them without authorization. |
smarty_dir
Directory with Smarty library - By default, subdirectory Smarty in lib_dir.
Example: smarty_dir = /usr/lib/php/Smarty
smarty_compile_dir
Smarty's compilation directory. Place where Smarty compile templates. By default it is subdirectory templates_c in sys_dir.
Example: smarty_compile_dir = /var/smarty/compile/lms
smarty_templates_dir
Directory with Smarty's templates. By default it is subdirectory templates in sys_dir.
Example: smarty_templates_dir = /usr/share/lms/templates
allow_from (optional)
Lis of networks and IP addresses, which have access to LMS. If empty, every IP address has access to LMS. When you write here list of addresses or address classes, LMS dismiss every unwanted user with HTTP 403 error.
Example: allow_from = 192.168.0.0/16, 213.25.209.224/27, 213.241.77.29
lang
User interface language symbol. When is not set, language will be based on html browser settings. Default: en.
Example: lang = pl
timeout
Timeout of www session. After that time (in seconds) user will be log out if not take some action. Default: 600.
Example: timeout = 900
![]() | There is not possible to set no timeout. If you set this value on zero, you'll can't use LMS! |
customerlist_pagelimit
Limit of displayed positions on one page on customers list. Default: no limit.
Example: customerlist_pagelimit = 10
nodelist_pagelimit
Limit of displayed records on page on nodes list. Default: no limit.
Example: nodelist_pagelimit = 10
balancelist_pagelimit
Limit of displayed records on page on user's balance. Default: 100.
Example: balancelist_pagelimit = 50
invoicelist_pagelimit
Limit of displayed records on page on invoices list. Default: 100
Example: invoicelist_pagelimit = 50
ticketlist_pagelimit
Limit of displayed records on page on tickets (requests) list. Default: 100
Example: ticketlist_pagelimit = 50
networkhosts_pagelimit
Limit of displayed nodes on one page in Network Information. Default: 256
Example: networkhosts_pagelimit = 1024
accountlist_pagelimit
Limit of displayed records on page on accounts list. Default: 100
Example: accountlist_pagelimit = 50
domainlist_pagelimit
Limit of displayed records on page on domains list. Default: 100
Example: domainlist_pagelimit = 50
aliaslist_pagelimit
Limit of displayed records on page on aliases list. Default: 100
Example: aliaslist_pagelimit = 50
configlist_pagelimit
Limit of displayed records on page on UI config options list. Default: 100
Example: configlist_pagelimit = 50
reload_type
Reload type. Allowed values:
exec - calling of some command (most often with sudo, some script or something else, configurable below)
sql - doing SQL writes (also can be set concrete query)
Default: sql.
Example: reload_type = exec
reload_execcmd
Command to run during reload, if reload_type is set to 'exec'. By default /bin/true. That string is send to command system(), so I propose consideration what you do and how :) Altogether, semicolons should be parsed by bash, but LMS splits that string and execute commands singly.
Example: reload_execcmd = "sudo /usr/bin/reload_lms.sh"
reload_sqlquery
SQL query executed while reload, if reload_type = sql. By default, query inserts into table 'timestamps' value '_force'. In query can be used '%TIME%' as replacement to current unix timestamp. WARNING! Semicolon is handled by a queries separator, that means you can enter couple of SQL queries separate them by semicolon sign.
Example: reload_sqlquery = "INSERT INTO reload VALUES ('1','%TIME%')"
force_ssl
SSL Enforcing. Setting this option to 1 will make that LMS will enforce SSL connection doing redirect to 'https://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI] at every access without SSL. Default: 0 (off).
Example: force_ssl = 1
allow_mac_sharing
Permission for addition of nodes with duplicated MAC address (not checking that some computer have that MAC yet). Default: 0 (off)
Example: allow_mac_sharing = 1
smarty_debug
Enable Smarty's debug console. Usefull for tracking values passed from PHP to Smarty. Default: 0 (off).
Example: smarty_debug = 1
lang_debug
Enable LMS language console. Usefull for tracking missing translation strings. Default: 0 (off).
Example: lang_debug = 1
debug_email
E-mail address for debugging - at this address will goes messages sended from madule 'Mailing', instead of proper users.
Example: debug_email = root@localhost
default_zip, default_city, default_address
Default zip code, city, street, used while inserting of new user. Useful when we have many users on the same street.
Example: default_zip = 39-300
use_current_payday
Qualify to use current day of month for payment day instead of most often used day. Default: 0 (off).
Example: use_current_payday = 1
lastonline_limit
Specify time (in seconds), after which node will be treated as inactive. It should match with frequency of running script inspecting nodes activity (i.e. lms-fping). Default: 600.
Example: lastonline_limit = 300
timetable_days_forward
Specify number of days (including current day) on timetable. Default: 7.
Example: timetable_days_forward = 2
arpd_servers
List of arpd servers for reading of MAC addresses from remote networks. That list should include items IP[:port] separated with spaces. Default: empty.
Example: arpd_servers = 192.168.1.1 192.168.2.1
helpdesk_backend_mode
When enabled, all messages in helpdesk system (except sended to requestor) will be send to mail server at address of right queue. On server should be running script lms-rtparser, which will write messages to database. Default: disabled.
Example: helpdesk_backend_mode = On
contract_template
Specify customer contract template. Can include comma separated list of contract templates. Default: contract.html.
Example: contract_template = "../my_templates/contract.html"
Example: contract_template = "contract.html:Default Contract, file.html:Contract Plus"
to_words_short_format
Specify format of verbal amounts representation (on invoices). For value "1" verbal expand of 123,15 will be "one two thr 15/100". Default: 0.
Example: to_words_short_format = 1
LMS may define up to 256 rules of access to the system. Each can forbid or permit access to definite modules. To each user we can freely assign combination of access rules.
By default following access rules list is defined:
full access
read only (excluding Helpdesk)
nodes connection/disconnection
finances management
configuration reload
customers management
nodes management
stats access
mailing access
Helpdesk (RT) administration
Helpdesku (RT) operation
accounts management
UI configuration
networks and devices management
timetable management
users edition and addition forbidden
no access
![]() | If we do not define to user any access rule, then LMS implicitly define rule 0 for him - full access. |
Decision if user have right to access to module or not, looks like this:
- First of all: checking list of modules that user always have access. |
- Next: checking if module mach to rules in each levels that user have access. |
- Finally: Decision if user have authorizations to access to modules. If module mach to any level that forbid access then access will be forbiden even if user have level that permit access to module. (for example. Someone have full access and no access to adding computer module then he would not be able to appeal to this module). If module maches to level that permit access to module. Then LMS permit farther work. But if module does not match on any level then also will be printed no-access-msg. |
LMS upgrade process in two stages. First make directory of new version (overwriting old files with new ones is not recommended) then we have to make some changes in database.
For easy migration of data in catalog/doc we prepared file:UPGRADE-1.0-1.5.mysql and UPGRADE-1.0-1.5.pgsql for upgrade from 1.0 to 1.5 version. Also UPGRADE-1.2-1.5.mysql and UPGRADE-1.2-1.5.pgsql For migration from version 1.3 (and 1.3.0) to current version. In those files you can find short description how to upgrade in dependence of used database. In versions 1.3.0 and higher upgrade of database structure is automatically executed while first logon.
![]() | In 1.0.x and higher versions ADOdb library Is not required, you can remove applicable directory from lib/ directory. |
Written in C program facilitate management of services. Daemon is responsible for starting of appropriate modules on user demand only. Modules are making configuration files based on data from LMS's database and restarting selected services on a server.
Why such name? The better part of daemon code was written by one of developers - Aleksander 'A.L.E.C' Machniak, nevertheless must underline a contribution of Marcina 'Lexx' Krol. Program include fragments of code of Mateusza 'mteg' Golicz's old daemon and use Nicolas Devillard's iniparser library.
A.L.E.C's LMS Daemon require:
LMS user interface installation
libmysqlclient (full MySQL installation or respective packet) or libpq in case of PostgreSQL database or sqlite
libdl (that is in every present-day distribution)
C compiler
Prior to compilation you must set options described on following listing with help of ./configure script (in brackets are shown default values):
--help help --enable-debug0 SQL queries logging (disabled) --enable-debug1 events logging (disabled) --with-pgsql enables using of PostgreSQL database (disabled) --with-mysql enables using of MySQL database (enabled) --with-sqlite enables using of SQLite database (disabled) --prefix=DIR program install directory (/usr/local/bin) --libdir=DIR location of database libraries (/usr/lib) --incdir=DIR location of database header files (/usr/include)Then, required is to set database which you will use (--with-mysql or --with-pgsql) and location of libraries supplied with database (--incdir, --libdir). You can use only one database. If you will change database, you must to recompile daemon.
# ./configure --with-pgsql --libdir=/usr/local/pgsql/lib --incdir=/usr/local/pgsql/includeAfter that you can compile and install (put daemon in directory given with --prefix option):
# make && make installFinally, compiled modules (files with .so extension), found in directory modules/module_name move to any directory. Their location you will set in configuration file.
Example daemon configuration you can find in file lms.ini.sample. Following listing describe basic options for daemon (modules configuration is described in separate chapters concerning modules):
[database] host = localhost # host name or IP, default: localhost user = lms # user name, default: lms password = mypasswd # database password, default: empty database = lms # database name, default: lms port = 0 # port number, default: 0 [lmsd] sleeptime = 30 # time interval (in seconds) how often to # check for reload order, default: 30 instances = hosts oident firewall # module instances list command = 'echo Connecting...' # shell command to run before every database connection
![]() | List of instances contains instances names detached with spaces. Instance is a name of section in configuration file. |
In instance section, beside config modules params, you must specify primary options, as on following listing:
[instance_name] module = /path/to/module.so info = "Additional description of module"
Change of 'instances' and any option i instances sections do not require daemon restart. For other global options restart is required.
You can run program as a daemon working in background (option '-b'). Then configuration and services reload is done on demand with use of 'Reload' menu in LMS-UI. Option 'sleeptime' (-s) specify interval between database reads. When daemon detects reload order, he runs modules defined by 'instances' option in lms.ini. For example:
# almsd -b
Other way to run is disposable reload with usage of cron. You must to use this manner of reload for runing modules like 'payments' 'notify' or 'traffic'. In that case you can specify instances to reload with use of option '-i'. Example crontab's entry:
1 0 * * * /usr/local/bin/almsd -qi "payments notify"
Following listing describe program command line options:
-c path to config (default: /etc/lms/lms.ini) -i list of instances (separated by space) to reload -b run in background (daemon mode) -s 'reload' table reading interval in sec. (default: 30) -q reload and quit -h prints command line options