smtpserver - zmailer SMTP server
smtpserver [ -46aignBVvw ] [ -p port ] [ -l SYSLOG ] [ -l logfile ] [ -s[ftveR] ] [ -s strict ] [ -I pidfile ] [ -L maxloadaver ] [ -M SMTPmaxsize ] [ -P postoffice ] [ -R router ] [ -C cfgfile ] [ -T '[1.2.3.4]' ]
This program implements the server side of the SMTP protocol as described in RFC821, and knows about the common extensions to the protocol expected by Sendmail and BSMTP clients.
By default the program will kill the previous smtpserver daemon, if any, then detach and listen for SMTP connec- tions. Incoming messages will be submitted for processing using the zmailer(3) interface to ZMailer. Nontrivial address checking is done asynchronously, although this behaviour can be changed by a command line option if you cannot afford to transfer data just to bounce it back. All checking is done by executing the router(8) program in interactive mode, and executing a well-known shell function with well-known parameters for each request.
-4 |
Explicitely to use IPv4 type of socket even on machines that is capable to do IPv6 type of sockets. |
|
-6 |
Explicitely to (try to) use IPv6 type of socket even if the machine does not support it. For a default the server will try to use IPv6, if it has been compiled on an environment where it is present, but will do a fallback to IPv4 in case the runtime system does not have IPv6. |
|
-a |
turn on RFC931/RFC1413 indentification protocol, and log the information acquired with it to the submitted file. |
|
-w |
turn on usage of "whoson" protocol. This option is available even if actual code is not avail- able. |
|
-g |
the gullible option will make the program believe any information it is told (such as origin of a connection) without checking. |
|
-i |
runs the server interactively, which makes it usable for processing a batched SMTP stream (BSMTP) on stdin. With -v option this echoes incoming BSMTP to create more accurate faximille of BITNET BSMTP mailers. |
|
-l SYSLOG |
A magic value of "SYSLOG" for the logfile is interpreted by directing all session log stuff thru syslogd; something which may require better syslogd, than your system has by default; see ``syslog-ng'' at a well indexed free software sites. |
|
-l logfile |
specifies a logfile and enables recording of incoming SMTP conversations. If you want both file based session log, and syslog() based, issue this option after ``-l SYSLOG'' one. |
|
-n -p -B -I pidfile -L maxloadaver -M SMTPmaxsize |
indicates the program is being run from inetd(8). specifies the TCP port to listen on instead of the default SMTP port, 25. flags the email to arrive via BSMTP channel (via BITNET, for example). specifies an alternate PID file location. tells the maximum load-average the system is under when we still accept email in. Defines the asolute maximum size we accept from incoming email. (Default: infinite) (This is local policy issue.) |
|
-P postoffice -R router -C cfgfile |
specifies an alternate POSTOFFICE directory. specifies an alternate router (8) program to use for address verification. specifies nonstandard configuration file location; the default is $MAIL- SHARE/smtpserver.conf. |
|
-s strict |
this turns on all kinds of strict smtp protocol adherence checks, which in normal life can be relaxed slightly. Great for compliance testing ;) |
|
-s [ftveRS] |
specifies the style of address verification to be performed. There are four independent commands that can invoke some kind of address verification, and four independent flags to control whether this should be done. They are: f check MAIL FROM addresses |
R |
require addresses to be of syntax: |
|||
S |
allow sloppy input for systems incapable to |
-T '[1.2.3.4]' |
The flags are concatenated to form the argument to the -s option. The default is ve. |
-T '[ipv6.hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:1.2.3.4]'
Supply (in interactive mode) test address for policy dataset address testing. The optionset recommended for that case is: -i -d 1 -T '[1.2.3.4]' A notable detail is that to see what really is going on in the policy analysis, one must usei the ``-d 1'' option to turn on the debugging early enough to see its initial verdict at the time the ``220..'' greeting banner is produced.. Also notable is that brackets in the supplied IP address must be present, otherwise illegal syntax will be reported. (Using RFC 821 address literal parser here.) |
-V prints a version message and exits.
If the MAILSHARE/smtpserver.conf exists it is read to configure two kinds of things:
PARAM -entries |
allow server start-time parametrization of several things, including: |
|
The style (-s) option |
behaviour based on glob patterns matching the HELO/EHLO name given by a remote client. Lines beginning with a # or whitespace are ignored in the file, and all other lines must consist of two tokens: a shell-style (glob) pattern starting at the beginning of the line, whitespace, and a sequence of style flags. The first matching line is used. As a special case, the flags section may start with a ! character in which case the remainder of the line is a failure comment message to print at the client. This configuration capability is intended as a way to control misbehaving client software or mailers. |
|
PARAM maxsize |
This is synonym to start-time -M option. |
PARAM min-availspace 5000
This defines, in kilobytes, the minimum available space in POSTOFFICE directory after |
PARAM max-error-recipients
This defines how many recipients can be on a message whose source address is MAIL
FROM:<>. That is, is an error message. (Sometimes SPAMs are tried to inject in that
form...)
PARAM MaxSameIpSource
This sets the maximum number of active connections from any given single IP address. When the limit is reached, system tells the remote end: ``450 Too many simultaneous con- nections...'' (and then closes the connection.) When the limit is exceeded by factor of four, the server just closes the connection without telling anything. Do note that this works only when the smtpserver is running as its own daemon, not while run from under inetd! |
PARAM MaxParallelConnections
This limits how many simultaneous connections the server will accept in total -- e.g. how
many childs a master server can have running. Default value: 800.
Exceeding the limit by less than 100 will get a message ``450 Too many simultaneous con-
nections...'' printed to the connection. In every case the connection is closed right after
the possible message.
Do note that this works only when the smtpserver is running as its own daemon, not |
PARAM ListenQueueSize
This sets the listen queue size parameter for listen(2) call at the server.
PARAM TcpRcvBufferSize
This sets setsockopt(SO_RCVBUF) value, in case the system default is not suitable.
PARAM TcpXmitBufferSize
This sets setsockopt(SO_SNDBUF) value, in case the system default is not suitable.
PARAM RcptLimitCount 10000
This sets the maximum number of accepted recipients per one message transaction. |
PARAM BindPort 25
PARAM BindAddress [0.0.0.0]
PARAM BindAddress [IPv6.0::0]
Per default the server mode SMTP-server binds to port 25 and any locally accepted address, but occasionally people seem to want to have separate server instances with dif- ferent configurations, and for those cases are these parameters. |
||
PARAM DEBUGcmd PARAM EXPNcmd PARAM VRFYcmd |
This trio (DEBUGcmd, EXPNcmd, VRFYcmd) are enablers of like named SMTP verbs |
|
which have some uses in the debug mode. They are normally disabled, but running them enabled does not allow direct attacks with |
PARAM enable-router
This enables interactive router use where user inputs reach the router. As things turn out, while the canned scripts should be safe against any and all inputs, a careless change in the router scripts may endanger this status. Per default this is disabled to protect your system. To enable EXPN and VRFY, this must be enabled, but be very carefull when you do this. This is also required for interactive router processing of ``MAIL FROM'' and ``RCPT TO'' addresses. |
PARAM smtp-auth This enables 'SMTP AUTH' facility (AUTH verb, plus optional parameter to MAIL verb).
With this the users who are able to 'login' successfully to this host, are then able to relay the
email thru the server unlimited.
PARAM AUTH-LOGIN-also-without-TLS
This enables 'SMTP AUTH' facility usage also without running under SSL/TLS security
envelope.
PARAM MSA-mode |
Enable Message Submission Agent mode, where smtpserver requires successful user authentication during SMTP sessions initiated from outside of the trusted networks or the networks with relaying enabled (see "fulltrustnet" and "relaycustnet" at the sample proto/db/smtp-policy.src file). |
PARAM SMTP-auth-pipe /path/to/program
This is a path to the external authentication program. The authenticator should read a user-
name from command line and a password from standard input. Exit status 0 means suc-
cessful authentication.
It is relatively easy to make a mistake in external authentication program that follows
the specification. Use this option only if you know exactly what you do! BE CARE-
FULL!
PARAM No8BITMIME
PARAM NoCHUNKING
PARAM NoDSN
PARAM NoEHLO
PARAM NoENCHANCEDSTATUS(CODES)
PARAM NoETRN
PARAM NoPIPELINING
This set are disablers of like named Extended SMTP EHLO responses, plus EHLO verb
itself, e.g. using these will turn off given (for example ``PIPELINING'') response from the
EHLO replies, and then a client possibly capable to feed PIPELINING will not do it --
unless it breaks rules, and does it even when the server does not report facility being avail-
able.
If you want to disable any of these, you better have a good reason for it, as in general they
work quite fine.
Of these, 8BITMIME can not in reality be disabled, only its adverticement can be turned |
PARAM no-multiline-replies
Turn off ZMailer's default multiline replies; many systems (especially from M$ breed) don't |
PARAM policydb This defines smtp input policy filtering/analysis database location. See the comments at the
sample proto/db/smtp-policy.src file.
PARAM contentfilter @MAILBIN@/smtp-contentfilter
An external program for received message content analysis. The interface to the program is simple, smtpserver writes relative filepath of the programs stdin, ending it with a newline. The reply begins with a signed integer, then if an additional message follows, a space separates the integer from the message. |
PARAM tarpit n1 n2 |
This defines a pre-reply slow-down factor, and next delay multiplier (both are integers). Default values are (0, 0). Delay tops at 250 (seconds). The ``n1'' is used as the initial tarpit delay, and ``n2'' is multiplier for formula: next = prev + (prev * n2) |
|
PARAM rcvd-ident |
PARAM rcvd-whoson
PARAM rcvd-auth-user
PARAM rcvd-tls-mode
PARAM rcvd-tls-peer PARAM etrn-cluster node-name-or-address mq2-username mq2-passwd |
In load-balance clusters a network level load-balancer may distribute the incoming SMTP This method requires that the scheduler runs its mailq service in MAILQv2 mode! Here is a possible configuration file: |
# |
# # Enable, if the "AUTH LOGIN" is to be allowed to
# # be used without running under SSL/TLS security
# # envelope.
#
#PARAM MSA-mode
# |
# Message Submission Agent mode. Require |
#PARAM SMTP-auth-pipe /path/to/program
# |
# External authentication program. The |
# Disablers of some facility adverticements
#PARAM NoEHLO
#PARAM NoPIPELINING
#PARAM No8BITMIME
#PARAM NoCHUNKING
#PARAM NoDSN
#PARAM NoETRN
#PARAM no-multiline-replies # except to EHLO
#
# HDR220 metatags:
# %% -- '%' character
# %H -- SS->myhostname
# %I -- '+IDENT' if 'identflg' is set
# %V -- VersionNumb
# %T -- curtime string
# %X -- xlatelang parameter
#
#PARAM hdr220 %H ZMailer ESMTP-server %V running at Yoyodyne Inc.
#PARAM hdr220 %H (NO UCE)(NO UBE) our local time is now %T
#
PARAM help ------------------------------------------------------
PARAM help This mail-server is at Yoyodyne Propulsion Inc.
PARAM help Our telephone number is: +1-234-567-8900, and
PARAM help telefax number is: +1-234-567-8999
PARAM help Our business-hours are Mon-Fri: 0800-1700 (TZ: -0700)
PARAM help
PARAM help Questions regarding our email service should be sent
PARAM help via email to address <postmaster@OURDOMAIN>
PARAM help Reports about abuse are to be sent to: <abuse@OURDOMAIN> PARAM help ------------------------------------------------------
# |
#PARAM tarpit 0 0 # No "tarpit" for 4XX/5XX reply codes
#PARAM tarpit 20 2 # Initial delay: 20 secs, next = prev + (prev * 2) # # Elements to be added into "Received:" header's # A load-balanced server cluster may want to communicate # |
If the system has <security/pam_appl.h> file, following file will also be needed for the system:
------- /etc/pam.d/smtpauth-login ----------- |
shadow |
auth required /lib/security/pam_nologin.so |
/etc/zmailer.conf
/var/spool/postoffice/.pid.smtpserver (POSTOFFICE/.pid.smtpserver)
/local/share/mail/smtpserver.conf (MAILSHARE/smtpserver.conf)
router(8)
RFC 821 |
The basic SMTP specification |
Several extended SMTP facilities are implemented:
RFC 1341/1521/2045 |
MIME specification (body, formats) |
This program authored and copyright by:
Rayan Zachariassen (was at U of Toronto)
Extended SMTP, policy facilities, etc. by
Matti Aarnio <mea@nic.funet.fi>