LMS - LAN Management System 1.11-git
Prev | Chapter 4. Scripts | Next

# 4.3. Description and configuration

## 4.3.1. lms-notify

lms-notify it's a perfect tool to remind your customers that they are actually the ones who cover all your network and WAN links costs. It makes you possible to create numerous text templates for various occasions and use them for mailing your customers. For SMTP connection Mail::Sender module is used.

### 4.3.1.1. Templates

You can use following variables in your templates:

- %date-m - will be substituted with current month in numerical form with leading zero, eg. 02

- %date-y - will be substituted with current year, eg. 2003

- %date_month_name - will be substituted with current month name, eg. March

- %saldo - will be substituted with current customer balance, eg. 535

- %abonament - will be substituted with customer's subscription fee, eg. 107

- %b - customer balance with opposite sign, eg. 107

- %B - customer balance with real sign, eg. -107

- %pin - PIN code of the customer

- %cid - customer ID

- %number - document number (invoices, debit notes and deadline notifies only)

- %value - invoice value (invoices and deadline notifies only)

- %last_10_in_a_table - list of last 10 operations on customer's account, eg.

Example 4-1. Lms-notify: example of last 10 customer's operations

    -----------+------------------------------------------------------+---------
    2003-02-02 | Subscription for month 2003/02                       |  107.00
    2003-02-01 | Payment                                              | -107.00
    2003-02-01 | Subscription for month 2003/02                       |  107.00
    2003-02-01 | Payment                                              | -321.00
    2003-01-31 | Subscription for month 2003/01                       |  107.00
    2003-01-31 | Subscription for month 2003/01                       |  107.00
    2003-01-31 | Subscription for month 2003/01                       |  107.00
    -----------+------------------------------------------------------+---------

Example 4-2. Lms-notify: example of mailing template

    NOTE: This message has been generated automatically.

    We kindly remind that you have debt on your internet service provide account
    for the amount of $ %B.

    If you have already regulated your subscription fees for current month, that
    is %date-m %date-y, please just skip this message.

    If you think this message was sent to you in error, please contact our
    customer service representative.

    All information about payments could be also found at:
    http://bigpro.com/myAccount/

    If you want to regulate your account status, please contact our accountant:

    Aldfert Rule
    phone: 0-509031337
    e-mail: alde@staff.bigpro.com

    Garmund Cooper
    phone: 0-606666666
    e-mail: gcooper@free.bigpro.com

    PS. Last 10 operations on your account has been attached below for your
    convenience.

    Date       | Description                                          | Amount
    %last_10_in_a_table

    --
    Big and Professional Internet Provider, BigPro ISP
    http://www.bigpro.com/

### 4.3.1.2. Configuration

Configuration of lms-notify should be set in `lms.ini` file, [notify] section. Following parameters are valid (also in lms-notify-sms):

- debtors_template

  Lets you setup message template which will be sent to debted customers. Default: none.

  Example: `debtors_template = /etc/lms/debtors_template.txt`

- debtors_subject

  Lets you set subject of message to debtors. Default: 'Debtors notification'.

  Example: `debtors_subject = Debt information`

- invoices_template

  The message template which will be sent to customers if new invoice is created (in last 24 hours). Default: none.

  Example: `invoices_template = /etc/lms/invoices_template.txt`

- invoices_subject

  Subject of 'invoices' message. Default: 'New invoice notification'.

  Example: `invoices_subject = Invoice information`

- notes_template

  The message template which will be sent to customers if new debit note is created (in last 24 hours). Default: none.

  Example: `notes_template = /etc/lms/notes_template.txt`

- notes_subject

  Subject of 'notes' message. Default: 'New debit note notification'.

  Example: `notes_subject = Debit note information`

- deadline_template

  Lets you setup message template which will be sent to debted customers when (not payed) invoice reaches paytime. Default: none.

  Example: `deadline_template = /etc/lms/deadline_template.txt`

- deadline_subject

  Subject of 'deadline' message. Default: 'Invoice deadline notification'.

  Example: `deadline_subject = Deadline information`

- limit

  Lets you setup limit of customer debt. The message will be sent if customer balance is below that value. Default: limit = 0

  Example: `limit = -20`

And list of options for mailing only:

- mailfrom (mandatory)

  Lets you setup email of the sender. Default: none.

  Example: `mailfrom = staff@bigpro.com`

- mailfname

  Sender name. Default: none

  Example: `mailfname = Administrators`

- smtp_host

  SMTP server to be used when sending emails. Default: localhost

  Example: `smtp_host = smtp.bigpro.com`

- smtp_auth

  SMTP authorization type. Allowed values: LOGIN, PLAIN, CRAM-MD5, NTLM. Default: none

  Example: `smtp_auth = LOGIN`

- smtp_user

  Login for SMTP authorization. Default: none

  Example: `smtp_user = admin`

- smtp_pass

  Password for SMTP authorization. Default: none

  Example: `smtp_pass = password`

- debug_email (optional)

  Email address for debugging. All email will be sent to this address instead of sending to real customers. Default: not set.

  Example: `debug_email = lexx@domain.pl`

## 4.3.2. lms-notify-sms

lms-notify-sms it's a lms-notify equivalent, but it's intended to send reminders via SMS. Actually it supports smstools and gnokii services. Use [sms] section for SMS Service configuration.

Configuration of lms-notify-sms should be set in `lms.ini` file, [notify-sms] section. Here you can use all lms-notify options plus:

- service

  Allows you to overwrite SMS service option from [sms] section. Default: empty

  Example: `service = smstools`

## 4.3.3. lms-cutoff

This script allows to cutoff (actually mark as cutoff in database and cutting off should be performed by one of firewall rules creation script) customers whose debt is below some defined value.

Configuration of lms-cutoff should be set in `lms.ini` file, [cutoff] section. Following parameters are valid:

- limit (optional)

  Lets you setup limit of customer debt. Customer will be marked as disconnected below that value. Default: 0

  Example: `limit = -20`

- message (optional)

  If not empty, that message will be written to warning message field in customer record after cutting him off. You can use %now variable - it will be replaced by current date, and %b and %B like in lms-notify script. Default: 'Automatic cutoff caused by exceeding of liabilities limit on %now'

  Example: `message = ''`

## 4.3.4. lms-payments

This script is being used to calculate and account subscription and solid (fixed) fees. It also accounts your company liabilities and makes invoices. You should allow it to run daily if you want it to make it work done well.

This scripts may be configured with two options related to invoices in [payments] section of `lms.ini` file:

- deadline (optional)

  Payment deadline in days. Default: 14

  Example: `deadline = 7`

- paytype (optional)

  Payment type identifier (1-cash, 2-transfer, 3-transfer/cash, 4-card, 5-compensation, 6-barter, 7-contract). Default: 2

  Example: `paytype = 1`

- suspension_description (optional)

  Suspension description for suspended liabilities added at the end of comment. Default: ''

  Example: `suspension_description = '(suspension)'`

- comment (optional)

  Description on invoice attached to every periodical assigment

  Default: '%tariff subscription for period %period'

  Some keywords are substitiuted:

  %tariff - subscription name

  %period - period (counted from current day to the last in cycle, in YYYY/MM/DD format)

  %current_month - period form 1st day of current month to the last day

  %current_period - current month in MM/YYYY format

  %next_period - next month in MM/YYYY format

  %prev_period - previous month in MM/YYYY format

  %desc - tariff description

  Example: `comment = 'Subscription for %current_month'`

- settlement_comment (optional)

  Description of settlement.

  Default set to `comment` option contents.

  Example: `settlement_comment = 'Settlement for %period'`

Script has also one useful command line parameter: `--fakedate` (`-f`). With this option you can make that script will execute with system date (in format YYYY/MM/DD) other that current, eg. `--fakedate=2004/10/10`.

## 4.3.5. lms-traffic

This script is an interface between your application and LMS database and is intended to gather bandwidth usage statistics. You should provide number of bytes received and sent by each computer, which will be stored in LMS DB next to computer id and current timestamp. It's up to you how often this configuration will be refreshed, just remember to set your application to refresh its data in similar interval. Best sources of data are iptables or ipchains. You can also use external program, eg. ipfm.

Browsing gathered statistics with several filtering capabilities is available in LMS-UI in main menu, menu 'Statistics'.

### 4.3.5.1. Installation

Before you can run lms-traffic you need to create data file which will be read in. Format of the file should be as follows:

    <IP_address> <n_of_spaces> <upload_bytes> <n_of_spaces> <download_bytes>
    <IP_address> <n_of_spaces> <upload_bytes> <n_of_spaces> <download_bytes>
    ...

| Example script utilizing iptables might be found in `sample/traffic_ipt.pl` file.

Next you should install lms-traffic script and your custom script into crontab. Among standard options you can use define location with created data file.

    -f=/file 	location and name of data file, default: /var/log/traffic.log

| Frequency checks should be set not higher than 10 minutes, due that each execution will write new database record for each computer. Thus, statistics database might grow fast and it might take longer to generate desired statistics.

## 4.3.6. lms-traffic-logiptables

This script uses iptables to gather received and sent data statistics for each computer. Data is being read from firewall rules, which are created on-the-fly. Thus, you are not responsible for setting appropriate rules or running custom statistics collector (eg. `lms-traffic`).

Configuration of lms-traffic-logiptables should be set in `lms.ini` file, [traffic-logiptables] section. Following parameters are valid:

- outfile

  Location of file with iptables rules. Default: /etc/rc.d/rc.stat

  Example: `outfile = /etc/rc.d/rc.stat`

- iptables_binary

  Location of iptables binary. Default: /usr/sbin/iptables

  Example: `iptables_binary = /usr/local/sbin/iptables`

- wan_interfaces

  Interface(s) name(s) that should be considered. Default: not defined.

  Example: `wan_interfaces = eth0`

- local_ports

  List of source/destination ports for packet counting. Default: not defined.

  Example: `local_ports = 80`

- script_owneruid

  UID of 'outfile' script owner. Default: 0 (root).

  Example: `script_owneruid = 0`

- script_ownergid

  GID of 'outfile' script owner. Default: 0 (root).

  Example: `script_ownergid = 0`

- script_permission

  Permissions of 'outfile' script. Default: 700 (rwx------).

  Example: `script_permission = 700`

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

## 4.3.7. lms-makedhcpconf

This module creates DHCP configuration script - dhcpd.conf.

Configuration of lms-makedhcpconf should be set in `lms.ini` file, [dhcp] section. Following parameters are valid:

- config_file

  Output file location. Default: /etc/dhcpd.conf

  Example: `config_file = /tmp/dhcpd.conf`

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- customergroups

  List of (space separated) customer groups, that should be considered while creating configuration file. If unset, configuration will include all customer groups.

  Example: `customergroups = group1 group2`

- default_lease_time

  Default lease time. Default: 86400.

  Example: `default_lease_time = 43200`

- max_lease_time

  Maximal lease time. Default: 86400.

  Example: `max_lease_time = 43200`

- ignore_ddns

  Don't put 'ddns-update-style none;' at the beginning of file. Useful for older (2.2) versions of DHCP. Default: Off.

  Example: `ignore_ddns = 1`

- log_facility

  Logging options for DHCP daemon. Default is applied if not specified.

  Example: `log_facility = 7`

- authoritative

  Add 'authoritative;' entry at the beginning of file. Default: Off.

  Example: `authoritative = 1`

- script_owneruid

  UID of 'config_file' config owner. Default: 0 (root).

  Example: `script_owneruid = 0`

- script_ownergid

  GID of 'config_file' config owner. Default: 0 (root).

  Example: `script_ownergid = 0`

- script_permission

  Permissions of 'config_file' file. Default: 600 (rwx------).

  Example: `script_permission = 700`

You can setup leases time on per-host basis by creating `[dhcp:network_name]` section (in lowercase), eg.

    [dhcp:public-custa] # network name, must be lowercase!!!
    default_lease_time = 3600
    max_lease_time     = 3600

You can also specify gateway, dns servers, domains name and wins server for individual host by creating `[dhcp:ip_address]` section, eg.

    [dhcp:213.25.209.216]
    domain  = anotherdomain.com
    gateway = 213.25.209.251
    dns     = 213.25.209.8
    wins    = 213.25.209.10

## 4.3.8. lms-makeiptables, lms-makeipchains

This pair of script is being used to generate files with firewall rules inside. You can prepend this file with previously written header (ie. containing network-wide rules or NAT rules) and set some fixed permissions to it. Those scripts does not run generated files.

Configuration of those scripts should be set in `lms.ini` file, [iptables] or [ipchains] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- iptables_binary (ipchains_binary)

  Location of iptables (ipchains) binary. Default: /usr/sbin/iptables (/usr/sbin/ipchains)

  Example: `iptables_binary = /usr/local/sbin/iptables`

- script_file

  Output file with rules. Default: /etc/rc.d/rc.masq

  Example: `script_file = /etc/rc.d/rc.firewall`

- pre_script

  File appended after cleaning existing rules and before adding new. Default: undefined.

  Example: `pre_script = /etc/rc.d/rc.masq-pre`

- post_script

  File appended after adding rules. Default: undefined.

  Example: `post_script = /etc/rc.d/rc.masq-post`

- forward_to

  List of networks for which NAT should be set. Possible values: "" - full forward, "any string" - forward off, "net1 net2" - forward active for selected networks. Default: full forward.

  Example: `forward_to = public-custa public-custb`

- script_owneruid

  UID of file owner. Default: 0 (root).

  Example: `script_owneruid = 0`

- script_ownergid

  GID of file owner. Default: 0 (root).

  Example: `script_ownergid = 0`

- script_permission

  Permissions for the file. Default: 700 (rwx------).

  Example: `script_permission = 700`

- snat_address

  SNAT public address. If unset, for hosts with private addresses assigned "-j MASQUERADE" rule will be used. If set "-j SNAT --to 123.123.123.123" (with your IP here) will be used. Only with lms-makeiptables. Default: not set.

  Example: `snat_address = 123.123.123.123`

- tcp_redirect_ports (udp_redirect_ports)

  List of port forwardings in source_port:dest_port format. Can be used to map ports of your firewalled machines to the ones on your router. Only with lms-makeipchains. Default: not set.

  Example: `tcp_redirect_ports = 80:3128 25:25`

## 4.3.9. lms-etherdesc

This script is intended to create file including MAC and IP address pairs from LMS DB. MACs are being fetched in 'stripped' format, such is, without colon separators. This type of file might be used with iptraf tools.

Configuration of lms-etherdesc should be set in `lms.ini` file, [ether] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- etherdesc_owneruid

  UID of file owner. Default: 0 (root).

  Example: `etherdesc_owneruid = 0`

- etherdesc_file

  File location. Default: /var/lib/iptraf/ethernet.desc.

  Example: `etherdesc_file = /etc/ethernet.desc`

- etherdesc_ownergid

  GID of file owner. Default: 0 (root).

  Example: `etherdesc_ownergid = 0`

- etherdesc_permission

  Permissions for the file. Default: 600 (rw-------).

  Example: `etherdesc_permission = 600`

## 4.3.10. lms-sendinvoices

This script make you possible to automatically send invoices by email, as email attachments. Invoices are being created in accordance to template used in LMS-UI, thus, you need to provide username and password to interface for this module to work.

This module, unlike the others, needs some extra Perl modules to work: LWP::UserAgent, MIME::QuotedPrint and Mail::Sender.

Configuration of lms-sendinvoices should be set in `lms.ini` file, [sendinvoices] section. Following parameters are valid:

- lms_url

  URL for your LMS installation. Default: http://localhost/lms/

  Example: `lms_url = http://lms.mynet.pl`

- lms_user

  LMS user login name. Default: empty

  Example: `lms_user = admin`

- lms_password

  LMS user password. Default: empty

  Example: `lms_password = my_secret`

- debug_email

  Email address to test (mail will be redirected here). Default: undefined.

  Example: `debug_email = admin@mynet.pl`

- sender_name

  Email sender name. Default: undefined.

  Example: `sender_name = ASK MyNet`

- sender_email

  Email sender address. Default: undefined.

  Example: `sender_email = admin@mynet.pl`

- mail_subject

  Email subject. %invoice variable will be replaced by invoice number. Default: 'Invoice No. %invoice'.

  Example: `mail_subject = 'New invoice'`

- mail_body

  Email body. %invoice variable will be replaced by invoice number. Default: 'Attached file with Invoice No. %invoice'.

  Example: `mail_body = ''`

- customergroups

  List of (space separated) customer groups, that should be considered while sending invoices. Default: unset - all customers.

  Example: `customergroups = group1 group2`

- smtp_host

  SMTP server to be used when sending emails. Default: localhost

  Example: `smtp_host = smtp.bigpro.com`

- smtp_auth

  SMTP authorization type. Allowed values: LOGIN, PLAIN, CRAM-MD5, NTLM. Default: none

  Example: `smtp_auth = LOGIN`

- smtp_user

  Login for SMTP authorization. Default: none

  Example: `smtp_user = admin`

- smtp_pass

  Password for SMTP authorization. Default: none

  Example: `smtp_pass = password`

Script has also one useful command line parameter: `--fakedate` (`-f`). With this option you can make that script will execute with system date (in format YYYY/MM/DD) other that current, eg. `--fakedate=2004/10/10`.

## 4.3.11. lms-makemacs

This script is capable of making netfilter rules to filter traffic based on MAC address of the sender. For each computer one rule for configured chain is created, which makes test on sender IP and MAC addresses. If it returns success, it returns to parent chain with RETURN target. On the end of tests two rules are appended, which redirects all http and webcache traffic to given host and port. This is intended to inform customer about his debt, by running specialized server on this host:port which returns administration message to each request. At last, the rule which blocks all traffic is added.

Configuration of lms-makemacs should be set in `lms.ini` file, [macs] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- customergroups

  List of (space separated) customer groups, that should be considered while creating configuration file. If unset, configuration will include all groups.

  Example: `customergroups = settlement1 settlement2`

- iptables_binary

  Location of iptables binary. Default: /sbin/iptables

  Example: `iptables_binary = /usr/local/sbin/iptables`

- config_owneruid

  UID of file owner. Default: 0 (root).

  Example: `config_owneruid = 0`

- config_file

  Location of the output file. Default: /etc/rc.d/rc.macs

  Example: `config_file = /etc/conf.d/rc.macs`

- config_ownergid

  GID of file owner. Default: 0 (root).

  Example: `config_ownergid = 0`

- config_permission

  Permissions of the file. Default: 700 (rwx------).

  Example: `config_permission = 700`

- chain

  Chain name to use (if non-standard, it will be created). Default: MACS.

  Example: `chain = CHECKMAC`

- redirect_address

  Address and port, where unmatched traffic for http and webcache will be redirected, in address:port format. Default: 127.0.0.1:80.

  Example: `redirect_address = 192.168.1.1:3000`

- lock_noaccess

  Should RETURN rule be used for disconnected (cutoff) nodes. Default: 0 (rules are being generated)

  Example: `lock_noaccess = 1`

## 4.3.12. lms-makehosts

This script generates /etc/hosts file, with IP address to name mappings.

Configuration of lms-makehosts should be set in `lms.ini` file, [hosts] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- customergroups

  List of (space separated) customer groups, that should be considered while creating configuration file. If unset, configuration will include all groups.

  Example: `customergroups = settlement1 settlement2`

- config_owneruid

  UID of file owner. Default: 0 (root).

  Example: `config_owneruid = 0`

- config_file

  Location of the file. Default: /etc/hosts.

  Example: `config_file = /etc/hosts`

- config_ownergid

  GID of file owner. Default: 0 (root).

  Example: `config_ownergid = 0`

- config_permission

  Permissions of the file. Default: 644 (rw-r--r--).

  Example: `config_permission = 600`

- config_header

  First line in /etc/hosts. Default: 127.0.0.1 localhost localhost.localdomain.

  Example: `config_header = 192.168.1.1 ourserver ourserver.ournetwork`

## 4.3.13. lms-makewarnings

This script may be used to create file including netfiler rules redirecting http and webcache traffic to configured IP and port, for customers in debt. It uses nat table, tests source IPs and makes use of DNAT target.

Configuration of lms-makewarnings should be set in `lms.ini` file, [warnings] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- customergroups

  List of (space separated) customer groups, that should be considered while creating configuration file. If unset, configuration will include all groups.

  Example: `customergroups = settlement1 settlement2`

- iptables_binary

  Location of iptables binary. Default: /sbin/iptables

  Example: `iptables_binary = /usr/local/sbin/iptables`

- config_owneruid

  UID of file owner. Default: 0 (root).

  Example: `config_owneruid = 0`

- config_file

  Location of the file. Default: /etc/rc.d/rc.warnings.

  Example: `config_file = /etc/conf.d/rc.warnings`

- config_ownergid

  GID of file owner. Default: 0 (root).

  Example: `config_ownergid = 0`

- config_permission

  Permissions of the file. Default: 700 (rwx------).

  Example: `config_permission = 700`

- chain

  Custom chain to which rules will be added. Default: WARNINGS.

  Example: `chain = WARN`

- redirect_address

  IP address and port, to which all http and webcache traffic will be redirected, for hosts to which warning was enabled in LMS-UI. Default: 127.0.0.1:80.

  Example: `redirect_address = 192.168.1.1:3001`

- limit

  Rules are being triggered if customer balance is below this limit. Default: 0

  Example: `limit = -85`

## 4.3.14. lms-makemessages

This script is being used to create file with netfilter rules to redirect all http and webcache traffic for customers, who has administration messages enabled (aka warnings) to configured IP address and port. It uses nat table, tests source IPs and makes use of DNAT target.

Configuration of lms-makemessages should be set in `lms.ini` file, [messages] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- customergroups

  List of (space separated) customer groups, that should be considered while creating configuration file. If unset, configuration will include all groups.

  Example: `customergroups = settlement1 settlement2`

- iptables_binary

  Location of iptables binary. Default: /sbin/iptables

  Example: `iptables_binary = /usr/local/sbin/iptables`

- config_owneruid

  UID of file owner. Default: 0 (root).

  Example: `config_owneruid = 0`

- config_file

  Location of the file. Default: /etc/rc.d/rc.messages.

  Example: `config_file = /etc/conf.d/rc.messages`

- config_ownergid

  GID of file owner. Default: 0 (root).

  Example: `config_ownergid = 0`

- config_permission

  Permissions of the file. Default: 700 (rwx------).

  Example: `config_permission = 700`

- chain

  Custom chain to which rules will be added. Default: MESSAGES.

  Example: `chain = MESG`

- redirect_address

  IP address and port, to which all http and webcache traffic will be redirected, for hosts to which warning was enabled in LMS-UI. Default: 127.0.0.1:80.

  Example: `redirect_address = 192.168.1.1:3002`

## 4.3.15. lms-fping

This script probes nodes activity and writes its status to database. Fast program fping is being used to scan, with "-ar1" parameters. First, list of nodes is prepares, and then fping is executed. For returned hosts date and time will be stored into DB, so availability can be visualized in interface.

Configuration of lms-fping should be set in `lms.ini` file, [fping] section. Following parameters are valid:

- networks

  List of (space separated) networks, that should be considered while creating configuration file. If unset, configuration will include all networks.

  Example: `networks = public-custa public-custb`

- fping_binary

  Location of fping binary. Default: /usr/sbin/fping

  Example: `fping_binary = /usr/local/sbin/fping`

- temp_file

  Location of temporary file, where list of hosts for fping will be stored. After script execution, this file is removed. Default: /tmp/fping_hosts.

  Example: `temp_file = /tmp/hosts`

## 4.3.16. lms-rtparser

This script is a backend to Helpdesk system, which should be integrated into your mail server configuration. It intercepts emails sent to queue (as defined in email address field of queue configuration), parses its content and puts ticket into database, confirming this operation in email to reporter. In subject of confirmation ticket ID will be placed. If email with this ID is received again, it will be placed in existing ticket history, otherwise new ticket number will be created. Any files in the message will be detached and stored in directory defined with `mail_dir` option.

Unlike other Perl modules, this one additionally requires: `MIME::Parser` and `MIME::Words` from MIME-Tools package along with `Mail::Sender` and `Text::Iconv`.

This script might be installed in several ways. One way is to create shell script which reads content of users' mailboxes and calls lms-rtparser for each mail (can be done with formail). But more elegant, faster and convenient method is to integrate it with your mail server. Below you can find example on how to setup Postfix using header_checks.

    # main.cf file:
    header_checks = regexp:/etc/postfix/header_checks

    # header_checks file:
    /^To:.*address@domain.*/ FILTER filter:dummy

    # master.cf file:
    filter unix - n n - 10 pipe
          -flags=Rq user=nobody argv=/path/to/lms-rtparser

Above method is valid for Postfix version equal or newer than 2.0. Earlier versions doesn't support FILTER in header_checks. You can work around this by using procmail:

    # main.cf file:
    mailbox_command = /usr/bin/procmail

    # in user directory (for whom mails should be routed via helpdesk);
    # .forward file:
    "|IFS=' ' && exec /usr/bin/procmail -f - || exit 75 #YOUR_USERNAME"

    # .procmailrc file:
    :0 c
       * ^To.*address@domain
       | /bin/lms-rtparser

    :0 A
    $DEFAULT

Next example shows how to connect parser to Exim, using system filter:

    # exim.conf file:

    system_filter_pipe_transport = address_pipe

    # system_filter.txt file:

    if $recipients is "queue_email@domena.pl"
    then
         pipe "/path/to/lms-rtparser -q queue id"
    endif

| Messages create in lms-ui may be directed to parser, instead of just being written to database. If you prefer this behavior turn on `helpdesk_backend_mode` option in [phpui] section of `lms.ini` file.

Configuration of lms-rtparser should be set in `lms.ini` file, [rt] section. Following parameters are valid:

- default_queue

  ID of the queue, to which requests should be sent if not specified on command line. If not set queue will be guessed according to recipient address. Command line -q will override this option. Default: undefined.

  Example: `default_queue =`

- mail_from

  Sender address for confirmations. If undefined, queue address will be used, to which ticket was assigned. Default: empty.

  Example: `mail_from = rt@net.pl`

- mail_from_name

  Sender name for confirmations. Default: undefined.

  Example: `mail_from_name = 'BOK SuperLAN'`

- autoreply_subject

  Confirmation subject. You can use replacement variables here: %tid - ticket id and %subject - request subject. Default: "[RT#%tid] Receipt of request '%subject'".

  Example: `autoreply_subject = '[RT#%tid] Helpdesk confirmation'`

- autoreply_body

  Confirmation body. You can use replacement variables here; %tid - ticket id and %subject - request subject. Default: 'Your request was registered in our system.\nTicket identifier RT#%tid has been assigned to this request.\nPlease, place string [RT#%tid] in subject field of any\nfurther mail relating to this request.\n.'

  Example: `autoreply_body = ''`

- smtp_host

  SMTP server to be used when sending emails. Default: localhost

  Example: `smtp_host = smtp.bigpro.com`

- smtp_auth

  SMTP authorization type. Allowed values: LOGIN, PLAIN, CRAM-MD5, NTLM. Default: none

  Example: `smtp_auth = LOGIN`

- smtp_user

  Login for SMTP authorization. Default: none

  Example: `smtp_user = admin`

- smtp_pass

  Password for SMTP authorization. Default: none

  Example: `smtp_pass = password`

- mail_dir

  Directory where attachments should be saved. This directory will be accessed for read/write both by rtparser user and your Web Server user. If undefined attachments won't be recorded. Default: undefined.

  Example: `mail_dir = /usr/local/lms/mail`

- tmp_dir

  Temp directory. By default it will be taken from environment or set to `/tmp`.

  Example: `tmp_dir = /home/user/tmp`

- auto_open

  This will force reopening closed/dead ticket if request is sent to it's ID. Default: Off.

  Example: `auto_open = 1`

- newticket_notify

  If enabled script will send notification about new ticket to all users with rights for current queue. Default: Off.

  Example: `newticket_notify = 1`

- lms_url

  This link, pointing to corresponding ticket page in UI is appended to the notification about new ticket. Default: http://localhost/lms/.

  Example: `lms_url = https://lms.domain.pl/`

- include_customerinfo

  Adds basic customer information in new ticket notification footnote. Default: On.

  Example: `include_customerinfo = 0`

Prev | Home | Next
List of available scripts | Up | Configuration file generator (lms-mgc)