[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When GNU Anubis accepts incoming connection, it first has to identify the remote party, i.e. to determine whether it is authorised to use Anubis resources and, if so, what configuration settings to use during the session. We call this process authentication. The exact method of authentication depends on Anubis operation mode. Currently there are three modes:
No authentication is performed. Anubis switches to the unprivileged user (see section user-unprivileged) and acts as an SMTP proxy.
Anubis relies on AUTH service (identd
) to authenticate users.
This is the default mode. It is compatible with versions of GNU Anubis
up to 3.6.2.
This mode uses SMTP AUTH mechanism to authenticate incoming connections. See section Pixie & Dixie, the original description of this mode.
Proxy mode is special in that no authentication is performed in it. The remaining two modes require authentication. Both have their advantages and deficiencies, which you need to weigh carefully before choosing which one to use. They are discussed below:
Deficiencies:
identd
installed on his machine.
Advantages:
Deficiencies:
Advantages:
identd
on their machines.
3.1 Auth Service | ||
3.2 User Database | ||
3.3 Database URL | ||
3.4 Managing the Database |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Anubis session in traditional mode begins by querying auth
service on the client machine in order to obtain system name of the
user that initiated the session. Some identd
servers are able
to encrypt sensitive information in their replies. Anubus
supports encryption protocol introduced by pidentd
server
(2). If some of
your clients implement encryption, you would need the DES key
(or keys) they use for that purpose. Each such key is a sequence of
1024 bytes. Store them in a file and ensure its ownership and
mode prevent dissemination of this information. Any number of keys can
be stored.
Once done, inform anubis
about location of this file by
placing the following statement in the CONTROL
section of your
configuration file:
identd-keyfile filename
(replace filename with the actual name of the file).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A User Database is a storage system where GNU Anubis keeps user credentials, i.e. data necessary for authenticating and authorizing users. The exact way of storing these data is described further in this manual. In this section we treat user database as an abstraction layer.
The user database consists of records. Each record keeps information about a particular user. A record consists of four fields. A field may contain some value, or be empty, in which case we say that it has null value.
The fields are:
SMTP AUTHID
SMTP authentication ID of the user.
AUTH PASSWORD
SMTP password.
ACCOUNT
System user name.
CONFIG
Path to the configuration file.
The first two fields are mandatory and must always have non-null values.
No two records in the database may have the same value of
SMTP AUTHID
field. When anubis
is trying to
authenticate a user, it first looks up in the database a record
with the value of SMTP AUTHID
field matching AUTHID given
by the user. If no such entry is found, authentication fails.
Otherwise, anubis
goes on and compares the password
supplied by the user with that from AUTH PASSWORD
field.
If they match, authentication succeeds and anubis
passes to authorization state.
In this state, it first determines the user ID
(UID) to switch to. If the ACCOUNT
field
is not null, its value is used as account login name. If it is null,
anubis
will use privileges of the default not
privileged user, specified by user-notprivileged
statement in
the global configuration file (see section user-notprivileged).
The final step is to parse the user configuration file. If
CONFIG
field is not null, its value is the absolute
pathname of the user configuration file. Otherwise, anubis
searches for file ‘~/.anubisrc’ (where ‘~’ denotes home
directory for the system account obtained on the previous step) and if
such a file exists, loads it.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Anubis database is identified by its URL, or Universal
Resource Locator. A URL
consists of following elements
(square brackets enclose optional ones):
proto://[[user[:password]@]host]/path[params]
where:
Specifies the database protocol. The protocol describes how to access the database. In a way, it may be regarded as specifying the database type. Currently, GNU Anubis supports the following database protocols:
‘text’ | A plain text file with users’ credentials. |
‘gdbm’ | GDBM database |
‘mysql’ | MySQL database |
‘pgsql’ | PostgreSQL database |
‘postgres’ | Alias for ‘pgsql’. |
These protocols are described in detail below.
The name of the user authorized to access the database.
Password for the above user.
Domain name or IP address of a machine running the database.
A path to the database. The exact meaning of this element depends on the database protocol. It is described in detail when discussing particular protocols.
A list of protocol-dependent parameters. Each parameter consists of the parameter name, or keyword and its value separated by a equals sign:
keyword=name
Multiple parameters are separated by semicolons.
3.3.1 Plain text databases | ||
3.3.2 Databases in GDBM format | ||
3.3.3 MySQL and PostgreSQL | MySQL and PostgreSQL databases |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A simplest database is a plain text file, with lines representing records. Empty lines and lines beginning with ‘#’ (comments) sign are ignored. A record consists of fields, separated by colons (‘:’, ASCII 58). If ‘:’ character occurs as a part of a field, it must be escaped by a single backslash character (‘\\’, ASCII 92). Each record must contain at least two and no more than four fields:
The URL syntax for this type of databases is quite simple:
text:path
where path specifies absolute file name of the database file.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The protocol value ‘gdbm’ specifies a GDBM database. For the detailed description of GDBM system Introduction in The GNU DBM Manual.
Technically speaking, each GDBM record consists of
a key and content. Its key
holds the value of
SMTP ‘AUTHID’, whereas its content
holds
SMTP password, system account name and path to user
configuration file, separated by commas. As it was with ‘text’
databases, the two last fields are optional.
The URL syntax for GDBM databases is:
gdbm:path
where path specifies absolute file name of the database file.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is the most flexible database format. GNU Anubis 4.3 supports MySQL(3) and PostgreSQL(4) interfaces. No matter which of them you use, the implementation details are hidden behind a single consistent Anubis interface.
GNU Anubis supposes that all user data are kept in a single database table. This table must have at least four columns for storing SMTP ‘AUTHID’, SMTP password, system account name and path to user configuration file. Among those, only the last two may have NULL values. There is no restriction on the name of the database or the authentication table, nor on its column names. This information may be specified in URL as discussed below.
proto://[[user[:password]@]host/]dbname[params]
Proto describes the database type to use. Use ‘mysql’ for MySQL databases and ‘pgsql’ or ‘postgres’ for PostgreSQL databases.
Optional user and password specify authentication credentials for accessing the database.
Host sets the domain name or IP address of the machine running the database. It may be omitted if the database resides on ‘localhost’.
The database name is specified by the dbname element.
Further details needed for connecting to the database are given by URL parameters. All of them have reasonable default values, so you’ll have to specify only those parameters that differ from the default. The following parameters are defined:
Specifies port number the database server is listening on. If it is not given, the behavior depends on the value of the ‘socket’ parameter (see below). If ‘socket’ is not present, the program will use the default port number for the given protocol (i.e. 3306 for ‘mysql’ and 5432 for ‘pgsql’.
Specifies the UNIX file name of the socket to connect to. This parameter cannot be used together with ‘port’ (see above).
Sets length of the buffer for storing SQL queries. Default is 1024 bytes.
Specifies name of the database table with the authentication data. Default is ‘users’.
Specifies the name of a column in ‘table’ which holds ‘AUTHID’ value. Default is ‘authid’.
Specifies the name of a column in ‘table’ which holds the user password. Default is ‘passwd’.
Specifies the name of a column in ‘table’ which holds the name of system account to be used for this ‘AUTHID’. Default is ‘account’.
Specifies the name of a column in ‘table’ which holds the path to the user’s configuration file. Default is ‘rcfile’.
When using a MySQL database (‘mysql://’), database parameters and access credentials are first read from the file ‘/etc/my.cnf’, if it exists. This file called option file in ‘MySQL’ parlance (see option files). is organized in groups, each group beginning with the group name in square brackets on a separate line. Within a group, each non-empty line consists of a MySQL option name, optionally followed by an equals sign and the value. By default, settings from the group named ‘anubis’ are read.
Two additional parameters are provided to fine-tune this behavior:
Read options from file instead of ‘/etc/my.cnf’. An empty value (‘options-file=’), disables using the options file.
Set the name of the group in the MySQL configuration file, from which to read configuration options.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Managing the user database is a complex task, which looks differently from administrator’s and user’s point of view. Administrators have all privileges on the database, they can add new records and delete or modify existing ones. Users, of course, do not have such ample rights. The only thing a user is able to do is to maintain his own record in the database, provided that he already has one.
3.4.1 Administrators | Administrator’s View | |
3.4.2 Users | User’s View |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All administrative tasks are done via the anubisadm
command —
a multipurpose tool for Anubis administrators.
The command usage syntax is:
anubisadm command [options] database-url
where command specifies the operation to be performed on the database, options give additional operation-specific parameters, and database-url specifies the database to operate upon.
All administrative tasks can be subdivided into the following five categories:
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To create a database, use anubisadm --create (or
anubisadm -c). Anubisadm
will read database
entries from the standard input and write them to the database.
The standard input is supposed to be formatted as a text
database
(see section Plain text databases).
For example, to create a GDBM database from plain text file ‘userlist’, use the following command
anubisadm --create gdbm:/etc/anubis.db < userlist
Similarly, to create an initially empty database, type
anubisadm --create gdbm:/etc/anubis.db < /dev/null
Notice, that if you use SQL database format, ‘--create’ command does not imply creating the database structure! So, before running
anubisadm --create mysql://localhost/dbname < userlist
make sure you create the underlying database structure (including
granting privileges to the anubis
user), via the
usual procedure. Please refer to corresponding database manual
for the detailed instructions on this.
It is sometimes necessary to convert an existing user database
from one format (protocol) to another. For example, suppose you
have been running GDBM database (text:/etc/anubis.db
)
for some time, but now it has grown so big that you decided to
switch to PostgreSQL database to improve performance. To do so,
first create the database using postgres utilities. Then run
anubisadm --list text:/etc/anubis.db | \ anubisadm --create pgsql://localhost/dbname
That’s all there is to it!
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The ‘--list’ (or ‘-l’) option lists the existing database:
anubisadm --list gdbm:/etc/anubis.db
By default it displays all records from the database.
Among its other uses, such invocation is handy for converting user database to another format (see section Creating the Database).
If you wish to list only a particular record, specify the
AUTHID
using ‘--authid’ (‘-i’) option. For example,
to list the record for AUTHID
‘test’,
type:
example$ anubisadm --list --authid test gdbm:/etc/anubis.db
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To add a new record use the ‘--add’ (‘-a’) option. Additional data are specified via the following options:
Specify the user SMTP AUTHID
.
Specify the user password.
Specify the system user name for this AUTHID
.
Specify configuration file to be used for this user.
For example, the following command adds a record with SMTP
AUTHID
‘test’, password ‘guessme’ and maps it
to the system account ‘gray’:
anubisadm --add --authid test --password guessme \ --user gray gdbm:/etc/anubis.db
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Removing a record is quite straightforward: use the ‘--remove’
(‘-r’) option and supply the AUTHID
to delete via the
‘--authid’ option. For example, to remove the record created
in the previous subsection, run:
anubisadm --remove --authid test gdbm:/etc/anubis.db
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To modify an existing record use the ‘--modify’ (‘-m’) option. The record is identified via the ‘--authid’ option. The following options supply the changed values:
Specify new user password.
Specify new system user name for this AUTHID
.
Specify the user’s configuration file.
For example, the following command changes the name of configuration file for the user ‘smith’:
anubisadm --authid smith \ --rcfile=/var/spool/anubis/common gdbm:/etc/anubis.db
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
anubisadm command [options] database-url
Create the database.
List the contents of an existing database.
Add a new record.
Modify an existing record.
Remove an existing record.
Display program version number and exit.
Display short usage summary and exit.
Specify the authid to operate upon. This option is mandatory for ‘--add’, ‘--modify’ and ‘--remove’ commands. It may also be used with ‘--list’ command.
Specify the password for the authid. This option is mandatory for ‘--add’, ‘--modify’ and ‘--remove’ commands.
Specify the system user name corresponding to the given authid. It may be used with ‘--add’, ‘--modify’, and ‘--remove’ commands.
Specify the rc file to be used for this authid. The option may be used with ‘--add’, ‘--modify’, and ‘--remove’ commands.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Users maintain their database records via the anubisusr
command. This command is built if anubis
is configured
with TLS support.
We suggest invoking anubisusr
from your ‘~/.profile’,
which will make sure that your configuration file is up to date when
you log in.(5).
anubisusr [options] [smtp-url]
where smtp-url is a URL of your GNU Anubis server.
Notice that if it lacks user name and password, then
anubisusr
will first try to retrieve them from your
‘~/.netrc’ file (see netrc in netrc manual page), and if not
found, it will prompt you to supply them.
Use the SASL mechanism mech. Give this option several times to set a list of allowed mechanisms.
Sets the user configuration file name (default is ‘.anubisrc’).
Sets the name of the automatic login configuration file (default is ‘.netrc’).
Verbose output. Multiple options increase verbosity. Maximum verbosity level is 3.
Options controlling encryption:
Disable the use of TLS encryption.
Sets the name of certificate authority file to use when verifying the server certificate.
Sets cipher suite preferences to use. The list argument may contain a single initial keyword or be a colon-separated list of TLS keywords. The description of TLS keywords is well beyond the scope of this document. Please refer to Priority Strings in GnuTLS Manual, for a detailed discussion.
Default priority list is ‘NORMAL’.
Informational options:
Display program version number and exit.
Display short usage summary and exit.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 6, 2024 using texi2html 5.0.