.\" Copyright (c) 2000-2004 Andrey Simonenko .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)$Id: ipa.conf.5,v 1.9.2.3 2007/07/20 09:53:38 simon Exp $ .\" .TH IPA.CONF 5 "April 16, 2005" .SH NAME ipa.conf -\- ipa(8) configuration file .SH DESCRIPTION The \fBipa.conf\fP file is a configuration file for ipa(8). This file or any other one, specified in the \fB-f\fP option in the ipa(8) command line, is read when ipa(8) starts working or receives a SIGHUP signal. .SH FILE FORMAT The \fBipa.conf\fP file can be quite simple and can be complex enough. The main idea is to place as much as possible into configuration file(s) instead of writing external programs to do accounting related tasks. .PP This manual page contains complete file format description and complete documentation about all features of ipa(8). .PP Almost after each paragraph there is an example. Since IPA distribution does not have any module, ipa_ipfw, ipa_ip6fw, ipa_atest and ipa_db_sdb modules are used in examples, just because they were the first modules designed for IPA. .PP \fBGeneral syntax.\fP .PP Any logical line in the configuration file can be written in several text lines for indenting purpose. There is not any rule in which line to place reserved words, arguments and special symbols. If some format allows one space character (a space character and a tab character), then as much as needed space characters can be written there for indenting. All elements in a configuration file are case sensitive. A configuration file consists of sections, parameters and comments. .PP \fBComments.\fP .PP There are shell\-like and C\-like comments. If you use a C\-like comment in a shell\-like comment, then a C\-like comment is ignored. .PP \fIExample:\fP .PP .nf # Shell-like comment. /* C-like comment. */ /* * Another C-like comment. */ .fi .PP \fBSections and parameters.\fP .PP A section consists of its name, optional arguments and its body. A section's body should be placed in curly braces: .PP .nf section [[=] argument] { /* Parameters and sections. */ } .fi .PP A parameter consists of its name and optional arguments. Every parameter should have the `;' character at the end of its arguments list: .PP .nf parameter [[=] argument]; .fi .PP The `=' character after the section's or parameter's name is optional. Some parameters look like variables (it is naturally to use the `=' character for such parameters), another ones look like instructions. In any case, you can choose a syntax you like more. .PP An argument can contain strings: .PP .nf "string" .fi .PP It is possible to use ``\\t'', ``\\n'', ``\\\\'' and ``\\"'' sequences to represent tab, newline, back-slash and double quote characters inside a string. If it is needed to split a string to several lines, then use one `\\' character at the end of the current line (do not put extra space characters after the back-slash character). If a string is written in several lines without `\\' characters, then each newline character is added to a string. .PP \fBMacro variables.\fP .PP It is possible to define macro variables and then use them almost anywhere in the configuration file: .PP .nf ${variable} = "string"; .fi .PP A name of any macro variable can consist of characters, digits and dollar signs. What is a character is checked with isalpha(3) function, which uses locale. .PP A value of any macro variable should be a string, when a macro variable is expanded then first and last double quotes of its value are removed. .PP Macro variables can be local or global. A macro variable is global if it is defined outside any section, else a macro variable is local. A local macro variables are local for all nested sections and for all external sections. Local macro variables can hide global ones. .PP There are some predefined macro variables: .PP ${$}\ \ \ \ \ \-\ expands to a `$' character; .br ${rule}\ \ \-\ expands to the name of current \fBrule\fP section; .br ${limit}\ \-\ expands to the name of current \fBlimit\fP section; .br ${sublimit}\ \-\ expands to the name of current \fBsublimit\fP section; .br ${threshold}\ \-\ expands to the name of current \fBthreshold\fP section; .br ${autorule}\ \-\ expands to the name of current \fBautorule\fP section. .PP Any macro variable (including predefined ones) except ${$} can be redefined if needed. It is not recommended to redefine or delete predefined macro variables in modules. .PP Macro variable ${$} cannot be used for constructing macro variables names (see an example). .PP Macro variables are expanded at the moment of their usage and not at the moment of their definition. Macro variables are expanded also in strings. Macro variables is a feature of the internal configuration file parser, so ${rule} macro variable cannot be used in autorules and in rules patterns (see information about substitutions in command strings). .PP \fIExample:\fP .PP .nf ${a} = "${b}"; # Definition of ${a}. ${b} = "1"; # Definition of ${b}. param = ${a}; # Expands to 1. ${b} = "2"; # Redefine ${b}. param = ${a}; # Expands to 2. param = "${$}{b}"; # Expands to "${b}" (sequence of characters # inside string). section { ${a} = "1"; # Definition of local ${a}, which hides # global ${a}. ${c} = "4"; # Definition of local ${c}. param = ${a}; # Expands to 1. subsection { ${a} = "2";# Redefine local ${a}. ${b} = "3";# Redefine global ${b}. } param = ${a}; # Expands to 2. param = ${b}; # Expands to 3. } # param = ${c}; <-- Error: ${c} is not defined as global. .fi .PP \fBIncluding files.\fP .PP It is possible to keep configuration information in several configuration files. Files are included with the help of following parameters: .PP .nf include "/path/file"; include_files "/directory/pattern"; .fi .PP The \fBinclude\fP parameter includes one file. The \fBinclude_files\fP parameter includes some files from the specified directory, names of which match the given shell pattern. .PP These parameters can be used anywhere in the configuration file, except inside modules' sections, and included files will be included at once. It is possible to include files from included files, and so on. Each included file should have correctly specified parameters with arguments, comments and sections with arguments, but it can have not closed sections. .PP It is possible to use POSIX extended regular expressions as patterns in \fBinclude_files\fP parameters, for this set the \fBposix_re_pattern\fP parameter to ``yes'' before parameters, which include files with POSIX regular expression patterns, by default the value of this parameter is ``no'': .PP .nf posix_re_pattern = ; .fi .PP This parameter should not be placed in any section. .PP Included files must be owned by the user, who run ipa(8) and must not be writable for group and other users. If files are included with the help of the \fBinclude_files\fP parameter, then a directory in this parameter also should have the same properties. .PP \fIExamples:\fP .PP .nf posix_re_pattern = yes; include "/usr/local/etc/ipa.local.conf"; include_files "/usr/local/etc/ipa/LAN/."; .fi .PP First parameter includes one file, second parameter includes each file in the given directory, the ``.'' POSIX regular expression means any character. .PP .nf /* posix_re_pattern = no; */ include_files "/usr/local/etc/ipa/LAN/*"; .fi .PP Here a shell pattern is used. First string should be uncommented if previously POSIX regular expressions were used. .PP \fBUsing accounting modules.\fP .PP There are special accounting modules, which are used for gathering statistics. ipa(8) uses such external accounting modules with the help from the special \fIipa_ac_mod\fP API, described in the ipa_mod(3) manual page. .PP The \fBac_mod\fP parameter tells ipa(8) to load the given IPA accounting module: .PP .nf ac_mod "file_name"; .fi .PP This parameter should not be placed in any section. It is possible to use several accounting modules at once. .PP \fIExample:\fP .PP .nf ac_mod "ipa_ipfw.so"; ac_mod "ipa_ip6fw.so"; .fi .PP These parameters load two accounting modules. .PP \fBUsing database modules.\fP .PP There are special database modules, which are used for storing statistics to databases. ipa(8) uses such external database modules with the help from the special \fIipa_db_mod\fP API, described in the ipa_mod(3) manual page. .PP The \fBdb_mod\fP parameter tells ipa(8) to load the given IPA database module: .PP .nf db_mod "file_name"; .fi .PP This parameter should not be placed in any section. It is possible to use several database modules at once. .PP \fIExample:\fP .PP .nf db_mod "ipa_db_sdb.so"; .fi .PP This parameter loads one database module. .PP \fBConfiguring modules.\fP .PP Documentations for some IPA module should give all information how to configure it, but usually configuration of some IPA module is integrated to the configuration file ipa.conf(5). .PP Each module has a configuration prefix, which is used for distinguishing module's sections and parameters. If there is a parameter like this one: .PP .nf prefix:parameter [[=] argument]; .fi .PP then ipa(8) will try to find a loaded module with configuration prefix ``prefix'', then ipa(8) will give this parameter for parsing to the found module. .PP Sections also can have prefixes: .PP .nf prefix:section [[=] argument] { /* Module's parameters and sections. */ } .fi .PP In this case parameters and sections inside such section should be written without a prefix and this section and all its internal sections and parameters will be passed to the appropriate module for parsing. .PP Documentation for some module should describe a module itself, module's configuration prefix, database or accounting system name and all module's parameters and sections. .PP \fIExample:\fP .PP .nf sdb: { allow_symlinks = yes; } ipfw:debug_ipfw = 1; .fi .PP Given section's name can confuse one, but everything is correct. A module can have empty section's and parameter's name. .PP \fBAccounting rules.\fP .PP ipa(8) performs accounting based on rules. There are two types of rules: static and dynamic. A static rule is described in the \fBrule\fP section. A dynamic rule does not have description in the configuration file, but any dynamic rule is generated on-the-fly from some autorule described in the \fBautorule\fP section. .PP Several rules (static, dynamic) can share the same settings. There are several ways to do this. First way is to use the \fBglobal\fP section. Second way is to use \fBrulepat\fP (rules patterns) sections. And the third way is specifying common settings for dynamic rules in \fBautorule\fP sections. .PP If some rule (static, dynamic) does not have settings for some section or parameter (dynamic rules also inherit settings from their autorule), then it inherits settings from matched \fBrulepat\fP section, then it inherits settings from the \fBglobal\fP section, if there are still some unspecified sections or parameters, then default settings are used. Run ipa(8) with \fB-tt\fP switches to see real values of all parameters. .PP Following parameters can be used in \fBglobal\fP, \fBrulepat\fP, \fBrule\fP and \fBautorule\fP sections: \fBac_list\fP, \fBdb_list\fP, \fBappend_time\fP, \fBupdate_time\fP, \fBworktime\fP, \fBctl_rule_acl\fP, \fBdebug_exec\fP, \fBdebug_limit\fP, \fBdebug_limit_init\fP, \fBdebug_threshold\fP, \fBdebug_threshold_init\fP. .PP \fBUsing accounting systems.\fP .PP Above the \fBac_mod\fP parameter was introduced, which tells to load a module and allows it to parse its configuration. The \fBac_list\fP parameter specifies a list of used accounting systems: .PP ac_list = ; .PP is a set of names separated by space characters. To get names of accounting systems read documentations for modules you specified in \fBac_mod\fP parameters. .PP If some rule has the \fBac_list\fP parameter, then accounting systems listed in its value will be asked for statistics for this rule. This parameter allows to create per rule accounting systems list. .PP There is one built-in accounting system \fInull\fP in ipa(8): this accounting system always returns 0 as statistics. If the \fBac_list\fP parameter is not specified, then the \fInull\fP accounting system is used. .PP \fIExample:\fP .PP .nf ac_mod "ipa_ipfw.so"; ac_mod "ipa_ip6fw.so"; global { ac_list = ipfw ip6fw; } .fi .PP Here two accounting systems are specified. .PP \fBUsing databases.\fP .PP Above the \fBdb_mod\fP parameter was introduced, which tells to load a module and allows it to parse its configuration. The \fBdb_list\fP parameter specifies a list of used databases: .PP db_list = ; .PP is a set of names separated by space characters. To get names of databases read documentations for modules you specified in \fBdb_mod\fP parameters. .PP If some rule (limit, threshold) has the \fBdb_list\fP parameter, then databases listed in its value will be used for storing statistics for this rule (limit, threshold). This parameter allows to create per rule (limit, threshold) databases list. .PP There is one built-in database \fInull\fP in ipa(8): data sent to this database is not kept anywhere. If the \fBdb_list\fP parameter is not specified, then the \fInull\fP database is used. .PP \fIExample:\fP .PP .nf db_mod "ipa_db_sdb.so"; global { db_list = sdb; } .fi .PP Here one database is specified. .PP \fBAccounting per period of a week.\fP .PP By default ipa(8) performs accounting for all days in a week, but it is possible to perform accounting only for some time intervals in a week. The \fBworktime\fP parameter specifies time intervals when ipa(8) should perform accounting: .PP .nf worktime = h1:m1-h2:m2 [h1:m1-h2:m2]; worktime = *; .fi .PP means a day of a week. Valid values for are: `\fBS\fP' Sunday, `\fBM\fP' Monday, `\fBT\fP' Tuesday, `\fBW\fP' Wednesday, `\fBH\fP' Thursday, `\fBF\fP' Friday, `\fBA\fP' Saturday. There can be only one record for each day. Time intervals cannot be overlapped or be placed not in the order. .PP 00:00-24:00 interval or the `\fB*\fP' character means a whole day. .PP When \fBworktime\fP allows to perform accounting, the section where it is placed is called ``active'', else it is called ``inactive''. .PP What exactly this parameter defines for autorules, rules, limits and thresholds read in appropriate paragraphs. .PP Note that time intervals given in the \fBworktime\fP parameter do not guarantee that exactly the same time intervals will appear in the database, because the running copy of ipa(8) can have low priority or the system can be to busy. .PP The end of one time interval can be the start of the next time interval, this feature is only useful for rules (see below). .PP \fIExample:\fP .PP Perform accounting only at Monday, Tuesday and Wednesday: .PP .nf worktime = M * T * W *; .fi .PP Perform accounting at Thursday from 8:00 till 14:30 and from 18:20 till 21:00, at Sunday from midnight till 10:35 (the value is written in several lines, just for indenting): .PP .nf worktime = H 08:00-14:30 18:20-21:00 S 00:00-10:35; .fi .PP \fBDatabase time intervals.\fP .PP The \fBupdate_time\fP parameter determines time interval when ipa(8) should update statistics for some rule: .PP .nf update_time =