For sites that run a large number of
proftpd, it can be cumbersome to configure them all in
proftpd.conf file. Adding or removing virtual server
configurations require restarting the daemon, as do changes to one of the
server configurations. The daemon also consumes memory for each server
configuration, and the memory footprint for the daemon process can grow
large for large numbers of servers.
mod_autohost module allows for server configurations to
be configured in individual files, and for those configuration to be used
in an "on demand" fashion. Rather than loading the configurations into
memory when the daemon starts up, the daemon will check the IP address and
port being contacted by a connecting client, check in the filesystem for
mod_autohost configuration file for that address/port,
dynamically parse the configuration, and insert the configuration into
the session's process space. Thus changes to the configuration are
seen whenever a client connects, without requiring a daemon restart.
The memory footprint is reduced because
mod_autohost, only reads and uses the needed configuration.
This module is contained in the
mod_autohost file for
ProFTPD 1.3.x, and is not compiled by default. Installation
instructions are discussed here.
The most current version of
mod_autohost can be found at:
Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.
AutoHostConfig directive specifies the path that
mod_autohost checks for, when handling incoming connections.
The given path must be an absolute path, and may contain the
following variables, which will be interpolated:
/etc/ftpd/vhosts/%0/autohost.confand a client connecting to 188.8.131.52, the above path would expand into:
/etc/ftpd/vhosts/184.108.40.206/autohost.confGiven a path of:
/etc/ftpd/vhosts/%1/%2/%3/%4/%p/vhost.confand a client connecting to 220.127.116.11, port 2121,
mod_autohostwould check for the following file:
AutoHostEngine directive enables or disables the module's
runtime checks for dynamic server configuration files. If it is set to
off this module does no checking. Use this directive to disable the
module instead of commenting out all
AutoHostLog directive is used to a specify a log file for
mod_autohost reporting and debugging. The path
parameter must be the full path to the file to use for logging. Note that
this path must not be to a world-writeable directory and, unless
AllowLogSymlinks is explicitly set to on (generally a
bad idea), the path must not be a symbolic link.
AutoHostPorts directive is used to specify a list of
port numbers on which
proftpd should listen. By default,
proftpd listens on a wildcard socket, which means
that a single socket can be used to listen for all address for a given
port. But there is no such thing as a socket which can listen on
all ports. Thus
mod_autohost needs to know when to
listen on other ports.
Note that the
AutoHostPorts directive is only needed
AutoHostConfig path uses the "%p" variable
(i.e. uses the port number to which the client connected as part
of the path to the matching configuration).
For example, if your
AutoHostConfig path included configurations
for servers on non-standard ports, you would need to use the
AutoHostPorts directive to list those ports, so that
proftpd could handles connections to them:
<IfModule mod_autohost.c> AutoHostEngine on AutoHostLog /etc/ftpd/var/autohost.log # This is required for mod_autohost to work AutoHostConfig /etc/ftpd/vhosts/%0/%p/autoconf.conf # Define the other non-standard ports for which we have config files AutoHostPorts 2121 2222 4444 </IfModule>
mod_autohost, copy the
proftpd-dir/contrib/after unpacking the latest proftpd-1.3 source code. For including
mod_autohostas a staticly linked module:
mod_autohostcould be built as a DSO module:
./configure --enable-dso --with-shared=mod_autohostThen follow the usual steps:
make make install
<IfModule mod_autohost.c> AutoHostEngine on AutoHostLog /etc/ftpd/var/autohost.log # This is required for mod_autohost to work AutoHostConfig /etc/ftpd/vhosts/%0/autoconf.conf </IfModule>With this configuration, a client connecting to 18.104.22.168 would cause
mod_autohostto look for the following path:
/etc/ftpd/vhosts/22.214.171.124/autohost.confIf the file is not present,
proftpdhandles the connection as it normally would.
SocketBindTight directive cannot be "on"
mod_autohost is to work directly. With
SocketBindTight being off by default,
listens for incoming connections on a wildcard socket, which will
receive connections to all IP addresses on that port.
mod_autohost relies on this behavior. If
SocketBindTight is set to on, then
listen only to the addresses of the servers configured in
proftpd.conf, and any
autohost.conf files will
DefaultServer directive will have no effect if it appears
mod_tls module will not be able to properly prompt for
passphrases for keys in an
autohost.conf file on server startup.
IPv6 addresses are not currently handled by