LMS - LAN Management System 1.5.4 Ramius

   [logo-small.png]

LMS Developers

   Copyright  2001-2005 LMS Developers
     _________________________________________________________________

   Table of Contents
   1. Intro

        1.1. About LMS
        1.2. Authors
        1.3. Legal Notice
        1.4. Other Information

   2. Installation and configuration

        2.1. Intro
        2.2. Requirements
        2.3. LMS Installation
        2.4. Database Server Installation
        2.5. Basic Configuration
        2.6. Access rights
        2.7. Upgrade

   3. A.L.E.C's LMS Daemon

        3.1. Basics
     _________________________________________________________________

Chapter 1. Intro

1.1. About LMS

   "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.
     _________________________________________________________________

1.2. Authors

1.2.1. LMS Developers

     * 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
       Przemysaw 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
     _________________________________________________________________

1.2.2. Others

   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.
     _________________________________________________________________

1.3. Legal Notice

   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.
     _________________________________________________________________

1.4. Other Information

1.4.1. Contact

   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.
     _________________________________________________________________

1.4.2. Ideas and Bugs Advertising

   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.
     _________________________________________________________________

1.4.3. Newest version

   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
     _________________________________________________________________

1.4.4. Changelog

   Informations about changes, which was made in all versions of LMS are
   included in file ChangeLog.
     _________________________________________________________________

Chapter 2. Installation and configuration

2.1. Intro

   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.
     _________________________________________________________________

2.2. Requirements

2.2.1. WWW Server

   Because LMS-UI is written in PHP, necessary is WWW server with
   interpreter of that language. Perefered server is Apache
   (www.apache.org).
     _________________________________________________________________

2.2.2. PHP Interpreter

   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.
     _________________________________________________________________

2.2.3. Database Server

   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.
     _________________________________________________________________

2.2.4. Smarty Library

   LMS-UI require Smarty library(http://smarty.php.net) in version 2.5.0
   or higher (don't use 2.6.4 version).
     _________________________________________________________________

2.2.5. Perl

   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);
     _________________________________________________________________

2.2.6. C Compiler

   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.
     _________________________________________________________________

2.3. LMS Installation

   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

   Note

   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.

   Warning

   Server www must have reading rights on file lms.ini and writing rights
   on directory backup. It makes potential drop of system security level.
     _________________________________________________________________

2.4. Database Server Installation

2.4.1. MySQL

2.4.1.1. Intro

   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.
     _________________________________________________________________

2.4.1.2. MySQL Server Installation

   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_haso
     _________________________________________________________________

2.4.1.3. Create Database

   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;
     _________________________________________________________________

2.4.1.4. LMS Configuration (lms.ini)

   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.
     _________________________________________________________________

2.4.2. PostgreSQL

2.4.2.1. Intro

   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.
     _________________________________________________________________

2.4.2.2. Instalacja

   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 &
     _________________________________________________________________

2.4.2.3. Database Creation

   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
     _________________________________________________________________

2.4.2.4. LMS Configuration (lms.ini)

   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

   Note

   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.
     _________________________________________________________________

2.4.3. SQLite

2.4.3.1. Intro

   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.
     _________________________________________________________________

2.4.3.2. Instalacja SQLite

   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.tgz

   Next in php.ini set:
extension=sqlite.so

   There is option to compile-in SQLite into PHP : --with-sqlite.
     _________________________________________________________________

2.4.3.3. Database Creation

   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
     _________________________________________________________________

2.4.3.4. LMS Configuration (lms.ini)

   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.
     _________________________________________________________________

2.5. Basic Configuration

   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.

   Note

   Remember to remove semicolons from begining of line with seted
   parameter.
     _________________________________________________________________

2.5.1. Section [database] - Database Settings

     * 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
     _________________________________________________________________

2.5.2. Section [directories] - Directories Settings

     * 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/

       Warning

   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
     _________________________________________________________________

2.5.3. Section [phpui] - Interface Setting

     * 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

       Warning

   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
     _________________________________________________________________

2.6. Access rights

2.6.1. Idea

   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

   Some of them permit access to modules and two forbid. Modules that
   user has always access is: welcome, copyrights, logout, chpasswd
   (chpasswd can change only own password), access to others is defined
   by rules.
   Note

   If we do not define to user any access rule, then LMS implicitly
   define rule 0 for him - full access.
     _________________________________________________________________

2.6.2. How does it work?

   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.
     _________________________________________________________________

2.7. Upgrade

   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.

   Note

   In 1.0.x and higher versions ADOdb library Is not required, you can
   remove applicable directory from lib/ directory.
     _________________________________________________________________

Chapter 3. A.L.E.C's LMS Daemon

3.1. Basics

   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.
     _________________________________________________________________

3.1.1. Requirements

   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
     _________________________________________________________________

3.1.2. Installation

   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/include

   After that you can compile and install (put daemon in directory given
   with --prefix option):
# make && make install

   Finally, compiled modules (files with .so extension), found in
   directory modules/module_name move to any directory. Their location
   you will set in configuration file.
     _________________________________________________________________

3.1.3. Configuration

   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

   Note

   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.
     _________________________________________________________________

3.1.4. Starting

   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
