The callout verification is usually performed by a special instance of mailfromd (see callout server).  However, it is also possible to set up a dedicated callout server on a separate machine. You can choose to do so, for instance, in order to reduce the load on the server running mailfromd.

This stand-alone callout facility is provided by the calloutd daemon.

Calloutd Configuration
======================

Main configuration file /etc/mailfromd.conf is used (see Mailfromd Configuration).  The configuration statements are basically the same as for mailfromd.

The address to listen on is defined in the server statement. Basically, it is the only statement the configuration file is required to have.  The minimal configuration can look like:

     program calloutd {
       server {
         listen inet://198.51.100.1:3535;
       }
     }

To instruct the mailfromd daemon to use this server, the following statement should be added to the /etc/mailfromd.conf file:

     program mailfromd {
       callout-url inet://198.51.100.1:3535;
     }

The server statement differs a little from the similar statement for mailfromd.  This and another calloutd-specific statements are described in detail in the subsections that follow.  The rest of statements is shared with mailfromd.  The following table lists all supported configuration statements along with cross-references to the correspondent descriptions:

Statement   Reference
acl   see Mailutils Configuration File (GNU Mailutils Manual).
auth   see Mailutils Configuration File (GNU Mailutils Manual).
database   see conf-database.
database-mode   see database-mode.
database-type   see database-type.
debug (section)   see Mailutils Configuration File (GNU Mailutils Manual).
debug   see conf-calloutd-log.
ehlo-domain   see ehlo-domain.
enable-vrfy   see enable-vrfy.
group   see group.
include   see Mailutils Configuration File (GNU Mailutils Manual).
io-timeout   see io-timeout.
locking   see Mailutils Configuration File (GNU Mailutils Manual).
lock-retry-count   see lock-retry-count.
lock-retry-timeout   see lock-retry-timeout.
logger   see conf-calloutd-log.
logging   see Mailutils Configuration File (GNU Mailutils Manual).
mailer   see Mailutils Configuration File (GNU Mailutils Manual).
mail-from-address   see mail-from-address.
pidfile   see pidfile.
server   see conf-calloutd-server.
source-ip   see source-ip.
smtp-timeout   see conf-timeout.
state-directory   see state-directory.
transcript   see conf-calloutd-log,
user   see user.

calloutd General Setup
----------------------

 -- Calloutd Conf: source-ip IP
     Sets source IP address for TCP connections.

 -- Calloutd Conf: pidfile filename
     Defines the name of the file to store PID value in.

 -- Calloutd Conf: state-directory dir
     Sets the name of the program state directory.  See statedir.

The server statement
--------------------

The server statement configures how calloutd will communicate with the client mailfromd server.

     server {
       id NAME;
       listen URL;
       backlog NUM;
       max-instances NUM;
       single-process BOOL;
       reuseaddr BOOL;
       default BOOL;
       callout URL;
       acl { ... }
     }

 -- Calloutd Conf: server
     Define a server.  Optional label may follow the server keyword.  The label is ignored.

     The substatements in the server block provide parameters for configuring this server.

 -- server: id name
     Assign an identifier to this server.  This identifier is used as a suffix to syslog tag (see syslog tag) in messages related to this server.  For example, if a server block had the following statement in it:

          id main;

     then all messages related to this server will be marked with tag calloutd#main.

     The part before the # is set using the tag statement in logging block (see Mailutils Configuration File (GNU Mailutils Manual)).

 -- server: listen url
     Listen for connections on the given URL. See milter port specification, for a description of allowed URL formats.

     Example:

          listen inet://10.10.10.1:3331;

 -- server: backlog NUM
     Configures the size of the queue of pending connections.  Default value is 8.

 -- server: max-instances number
     Sets the maximum number of instances allowed for this server.

 -- server: single-process bool
     When set to yes, this server will run in single-process mode, i.e. it will not fork sub-processes to serve requests.  This option is meant exclusively to assist in debugging calloutd.  Don't use it for anything else but for debugging!

 -- server: reuseaddr bool
     When set to yes, calloutd will attempt to reuse existing socket addresses.  This is the default behavior.

 -- server: acl  STATEMENTS
     Defines access control list for this server.  See Mailutils Configuration File (GNU Mailutils Manual), for a detailed discussion.

     If the global ACL is defined as well, an incoming connection is checked against both lists: first the per-server ACL, then the global one.  The connection will be permitted only if it passes both checks.

calloutd logging
----------------

 -- Calloutd Conf: logger mech
     Set default logger mechanism.  Allowed values for MECH are:

     stderr
          Log everything to the standard error.

     syslog
          Log to syslog.

     syslog:async
          Log to syslog using the asynchronous syslog implementation.

     See Logging and Debugging, for a detailed discussion. See also Using non-blocking syslog, for information on how to set default syslog implementation at compile time.

 -- Calloutd Conf: debug spec
     Set mailfromd debug verbosity level.  The SPEC must be a valid debugging level specification (see debugging level specification).

 -- Calloutd Conf: transcript BOOL
     If the boolean value BOOL is true, enables the transcript of call-out SMTP sessions.

Calloutd Command-Line Options
=============================

The calloutd invocation syntax is:

       calloutd [OPTION...]

The following options are available:

Server configuration modifiers
------------------------------

     foreground, calloutd

--foreground
     Stay in foreground.  When given this option, calloutd will not disconnect itself from the controlling terminal and will run in the foreground.

     group, calloutd

-g NAME
--group=NAME

     Retain the group NAME when switching to user privileges.  See Starting and Stopping.

     pidfile, calloutd

--pidfile=FILE
     Set pidfile name.  Overrides the pidfile configuration statement, which you are advised to use instead (see pidfile).

     resolv-conf-file, calloutd

--resolv-conf-file=FILE
     Read resolver settings from FILE, instead of the default /etc/resolv.conf.

     source-ip, calloutd

-S IP
--source-ip=IP
     Set source address for TCP connections.  Overrides the source-ip configuration statement, which you are advised to use instead (see source-ip).

     single-process, calloutd

--single-process
     Do not fork sub-processes to serve requests.  This option is meant to assist in debugging calloutd.  Don't use it for anything else but for debugging, as it terribly degrades performance!

     state-directory, calloutd

--state-directory=DIR
     Set new program state directory.  See Local state directory, for the description of this directory and its purposes.

     user, calloutd

-u NAME
--user NAME
     Switch to this user's privileges after startup.  Overrides the user configuration file statement, which you are advised to use instead (see user).  Default user is DEFAULT_USER.

Logging and debugging options
-----------------------------

     debug, calloutd

-d STRING
--debug=STRING
     Set debugging level.  See Logging and Debugging.

     log-facility, calloutd

--log-facility=FACILITY
     Output logs to syslog FACILITY.

     log-tag, calloutd

--log-tag=STRING
     Tag syslog entries with the given STRING, instead of the program name.

     logger, calloutd

--logger=MECH
     Set logger mechanism (MECH is one of stderr, syslog, syslog:async).  See Logging and Debugging.

     syslog, calloutd

--syslog
     Selects default syslog mechanism for diagnostic output.

     stderr, calloutd

--stderr
     Directs all logging to standard output.  Similar to --logger=stderr.

     source-ip, calloutd

-S IP
--source-ip=IP
     Set source address for TCP connections.  Overrides the source-ip configuration statement, which you are advised to use instead (see source-ip).

     debug-level, calloutd

--debug-level=LEVEL
     Set Mailutils debugging level.  See http://mailutils.org/wiki/Debug_level, for a detailed discussion of LEVEL argument.

     source-info, calloutd

--source-info
--no-source-info
     Include C source information in debugging messages.  This is similar to setting line-info yes in the debug configuration block (see line-info (GNU Mailutils Manual)).

     The --no-source-info can be used to cancel the effect of the line-info yes configuration statement.

     You do not need this option, unless you are developing or debugging calloutd.

     transcript, calloutd

-X
--transcript
--no-transcript
     Enable or disable transcript of the SMTP sessions to the log channel.  See Logging and Debugging.

Configuration file control
--------------------------

     config-file, calloutd

--config-file=FILE
     Load this configuration file.

     config-lint, calloutd

--config-lint
     Check syntax of configuration files and exit.  Exit code is 0 if the file or files are OK, and 78 otherwise.

     config-verbose, calloutd

--config-verbose
     Verbosely log parsing of the configuration files.

     no-site-config, calloutd

--no-site-config
--no-config
     Don't load site-wide configuration file.

     set, calloutd

--set=PARAM=VALUE
     Set configuration parameter

Informational options
---------------------

     config-help, calloutd

--config-help
     Show configuration file summary.

     show-config-options, calloutd

--show-config-options
     Show compilation options.

     help, calloutd

-?
--help
     Give a short  help list.

     usage, calloutd

--usage
     Give a short usage message.

     version, calloutd

-V
--version
     Print program version

The Callout Protocol
====================

This section describes the protocol used to communicate with the calloutd server.

The protocol works over stream-oriented TCP/IP transport.  Either UNIX or IPv4 socket can be used.  Commands and responses are terminated by a single CR LF pair.  Each command occupies exactly one line.  If the server succeeded in executing the command, it replies with a line starting with the word OK.  Depending on the command, this keyword may be followed by a single space character and additional information.  More information can be returned in unsolicited replies before the OK line.  Each unsolicited reply line starts with and asterisk followed by a single horizontal space character.

On error, the server replies with NO followed by a horizontal space character and human-readable description of the problem.

The valid commands are discussed below.  In examples illustrating the commands, the lines sent by the client are prefixed with C:, and lines sent by the server are prefixed with S:.

 -- Command: vrfy EMAIL [OPTION ARG]
     Adds EMAIL to the queue of email addresses to be verified. Available OPTIONs are:

     mode KW
          Sets verification mode for this email address.  Available modes are:

          mxfirst
          default
               The default mode.

               If the host option is also given, its argument is taken as the domain name.  Otherwise, domain part of EMAIL is used.

               The verification goes as follows.  First, determine MX servers for that domain.  Query each of them in order of increasing priority. First of them that replies determines the result of the test.

               If no MX servers are defined for that domain, look for its A record.  If available, run SMTP probe on that IP.

          mxonly
               Query MX servers for the domain specified with the host option.

          hostonly
               Query the server whose name or IP address is supplied with the host option.

          hostfirst
               The reverse of mxfirst: first query the host, then the MX servers.  The domain must be specified using the host option.

     host NAME
          Supplies the domain name for mxonly and mode, and host name or IP address for hostfirst and hostonly modes.  The use of this keyword with any of these modes is mandatory.

     ehlo STRING
          Use STRING as the argument to the SMTP EHLO command.

     mailfrom EMAIL
          Use EMAIL in the SMTP MAIL FROM command.

     On success, the server replies with OK, followed by a non-negative session ID for that email:

          C: VRFY gray@example.org
          S: OK 0000000001

 -- Command: get ARG [ARG]
     Query value of internal callout parameters.  Valid values for ARG are:

     ehlo
          Return the string used as argument to the SMTP EHLO command.

     mailfromd
          Return the email address that is used in the SMTP MAIL FROM command.

     On success, the server returns the requested value (if found) in an unsolicited reply:

          C: GET ehlo timeout
          S: * ehlo=example.net
          S: OK

 -- Command: sid STRING
     Sets STRING as session identifier for that session.  Example:

          C: SID deadbeef
          S: OK

 -- Command: timeout CONNECT INITIAL HELO
     MAIL RCPT RSET QUIT
     Sets timeouts for various stages of SMTP session.  On success, OK is returned.

          C: timeout 300 300 300 600 300 300 120
          S: OK timeouts set

 -- Command: run
     Runs callout session for emails registered with the vrfy command.  On success, results of the check are returned after the OK keyword in a whitespace-separated list of ID=RESULT pairs.  In each pair, ID is its identifier as returned in the reply to the VRFY command and RESULT is one of the following result strings: success, not_found, failure, temp_failure, timeout.

     Additional information about each callout session is returned in unsolicited replies.  Each such reply is prefixed with the email identifier and callout stage name.  Stage names are:

     INIT REMOTE_NAME
          The calloutd server is establishing communication with the remote SMTP server REMOTE_NAME.

     GRTNG LINE
          calloutd received initial response from the remote server. LINE is the first line of the reply.

     HELO LINE
          calloutd received response to the EHLO (or HELO) command.  In case of multiline response, LINE is the first line.

     SENT COMMAND
          The SMTP command COMMAND has been sent to the remote server.

     RECV LINE
          The remote server returned LINE in response.  In case of multiline response, LINE is the first line.

     Example of verification session:

          C: RUN
          S: * 0000000000 INIT mx.example.org
          S: * 0000000000 GRTNG 220 mx.example.org ESMTP Ready
          S: * 0000000000 HELO 250-mx.example.org Hello tester
          S: * 0000000000 SENT RCPT TO:<gray@example.org>
          S: * 0000000000 RECV 250 Accepted
          S: * 0000000001 INIT foo.example.net
          S: * 0000000001 GRTNG 220 foo ESMTP server ready
          S: * 0000000001 HELO 250-foo.example.net Hello
          S: * 0000000001 SENT RCPT TO:<gray@example.net>
          S: * 0000000001 RECV 450 4.7.0 You are greylisted for 3600 seconds
          OK 0000000000=success 0000000001=temp_failure

 -- Command: drop SERIAL
     Drop the email with the given SERIAL number from the verification queue.  Example:

          C: DROP 0000000002
          S: OK

 -- Command: quit
     Finishes the current session and disconnects from the callout server.

          C: QUIT
          S: OK bye