Manual Reference Pages  - UCSPI2SOCKET (8)

NAME

ucspi2socket - module for connecting greylite to SMTP servers via TCP

CONTENTS

Synopsis
Description
Controls
Load Balancing
Examples
See Also

SYNOPSIS

ucspi2socket [weight:]addr[:port] [[weight:]addr[:port] ...]

DESCRIPTION

ucspi2socket is a post-module for greylite ( http://mij.oltrelinux.com/net/greylite) that enables it to connect to "upstream" SMTP servers via TCP instead of the internal UCSPI interface.

ucspi2socket takes as arguments one or more addresses of SMTP servers to connect to, possibly accompanied by a weight and a port number when it is not the standard SMTP port (25). Each item can thus be specified with the format "weight:ip:port" (see EXAMPLES below) where "ip" must be an IP address (names are not resolved) and both the "weight:" and ":port" parts may be omitted.

If more than one upstream server is specified, ucspi2socket performs load balancing, picking one server to route to from the list based on a probabilistic basis (see LOAD BALANCING below).

CONTROLS

ucspi2socket is sensitive to the following environment variables:
LOGTHRESHOLD if set to an integer between 0 (LOG_EMERG) and 7 (LOG_DEBUG), log messages with priority strictly lower than this value are not reported. Otherwise, the default threshold is 3 (LOG_ERR).
LOGPID if set, every log message will be prepended by the PID of the process writing it.

LOAD BALANCING

When many upstream servers are specified, ucspi2socket distributes the load across all of them from a uniform probability density function, thus alloting the load fairly across all of the candidates. For example, with four servers each gets 25% of the original load circa.

When the capacity of the candidates is not the same it is possible to distribute the load in a weighted manner, by specifying the weight for each item as a numeric prefix. For example, if three servers A,B,C are available and one wants the policy "55% to A, 30% to B and 15% to C" this is done by specifying "55:A", "30:B" and "15:C". The weights don’t need to add up to 100, although this can be nicer to assess for the administrator.

EXAMPLES

The simplest command line enables ucspi2socket in a greylite service chain with only one upstream server (192.168.12.10):
/usr/local/bin/tcpserver -v -R -l "$LOCAL" \
    -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
    -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
    /usr/local/bin/greylite /usr/local/bin/ucspi2socket 192.168.12.10

More complex setups use several upstream servers. It is ok to specify one address more than once with different port numbers, and even to specify the same service (address and port) multiple times:

/usr/local/bin/tcpserver -v -R -l "$LOCAL" \
    -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
    -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
    /usr/local/bin/greylite /usr/local/bin/ucspi2socket 192.168.12.10 \
    192.168.12.10:26 192.168.12.11 192.168.12.11 192.168.12.12

When load has to be distributed non-evenly, weights can be specified along with server names (and possibly ports):
/usr/local/bin/tcpserver -v -R -l "$LOCAL" \
    -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
    -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
    10:10.2.2.10 25:10.2.2.11 35:10.2.2.12:26 30:10.2.2.13

SEE ALSO

greylite(8), tcpserver(1)


May 4, 2008 UCSPI2SOCKET (8)
Generated by manServer 1.07 from ucspi2socket.8 using doc macros.