client_options - set client-specific options


The client_options plugin adds values to the connection note ``client_options'' depending on the connecting client's IP address or host name.

The ``client_options'' note (together with its brethren ``sender_options'' and ``recipient_options'') establishes a common mechanism to set and query configuration data specific to the current transaction. The value of the note is a hashref, where each value can be either a simple scalar or another hashref. By convention the keys at the top level are the names of the plugins ``owning'' them.

Thus, the plugin ``foo'' could check

    $self->qp->connection->notes('client_options')->{foo}{active} and

to find out whether it should be active for that client at all and what the action in case of a failure for that client should be.

In the configuration file of the client_options plugin, these options could be set with:    foo/active=1, foo/active/failure=LOGONLY foo/active=1, foo/active/failure=DENY foo/active=0


To enable the plugin, add it to the ~qpsmtpd/config/plugins file as usual. It should precede any plugins which need to access the options.

Each line of the configuration file ``config/client_options'' consists of a pattern and a list of options, separated by a colon and optional whitespace. The pattern can be an IP address, an IP network (written in x.x.x.x/y CIDR notation), or a domain name. If an IP address is given, the client's IP address must match exactly. For an IP network, the client's address must lie within the range of addresses. For a domain name, all PTR records for the clients address are looked up and for each result all A records are looked up. All domain names for which at least one A record matches the client's IP address are considered valid host names of the client and matched against the pattern. A match occurs if a host name is equal to the pattern or is a subdomain of the pattern.

If a match occurs, the options specified on the same line are set and the plugin returns DECLINED.

The option list is a list of comma-separated key=value pairs. The namespace for keys is hierarchical, with / as a delimiter.


connect: connect_handler($self, $transaction)


Copyright (c) 2003-2004 Peter J. Holzer

This plugin is licensed under the same terms as the qpsmtpd package itself. Please see the LICENSE file included with qpsmtpd for details.