mod_auth
mod_auth.c
file for
ProFTPD 1.3.x, and is compiled by default.
<VirtualHost>
, <Global>
The DefaultRoot
directive is used to chroot()
the
session process for the connecting client. A fuller explanation can be
found in the Chroot howto.
<VirtualHost>
, <Global>
The MaxLoginAttempts
directive configures the maximum number of
times a client may attempt to authenticate to the server on the same TCP
connection. After the number of attempts exceeds the configured
count, the client is disconnected and an appropriate message is
logged.
<VirtualHost>
, <Global>
, <Anonymous>
The RootRevoke
directive causes all root privileges to be dropped
once a user is authenticated. This will also cause active data transfers
(e.g. via the PORT
/EPRT
FTP commands) to be
disabled if the server is listening on a port less than 1024. Note that
this only affects active data transfers; passive transfers will not be
blocked.
The reason for rejecting active data transfers in these cases is because of a requirement in RFC 959 (which defines the File Transfer Protocol) that for active data transfers, the data connection must have a source port of L-1, where L is the control connection port (see RFC 959, Section 3.2 "Establishing Data Connections"). Thus if the FTP server listens on port 21, then a client requesting an active data transfer from that server will have a data connection whose source port (on the server) is port 20 (L = 21, L-1 = 20).
Even though passive data transfers are highly preferable, many FTP clients may still require/expect to be able to do an active data transfer. One question, though, is how many FTP clients actually check that the source port of the active data transfer connection is actually L-1. Or how many networking appliances along the way (i.e. firewalls, NATs, routers, etc) enforce this restriction as well.
If not for that requirement, then with "RootRevoke on" in the
proftpd.conf
, proftpd
would not be required
to use root privileges for binding to a privileged port like port 20.
Thus the RootRevoke
directive also accepts (as of proftpd-1.3.5rc1
) a parameter of "UseNonCompliantActiveTransfers", e.g.:
# Drop root privs, but allow active data tranfers (only use a non-standard # source port for the active data connection). RootRevoke UseNonCompliantActiveTranfersWith this configuration,
proftpd
will drop root privileges,
but would not reject PORT
/EPRT
commands at all. Instead, the active data transfers would be allowed as per
normal, except that proftpd
would not try to bind to the
L-1 port for those active transfers.
This RootRevoke
parameter is valuable because it helps in
getting proftpd
to drop root privileges for sessions more often,
which is a far more secure configuration. Exploits such as the
"Roaring Beast" attack would not be possible in a session where root privileges
have been dropped completely.
<VirtualHost>
, <Global>
The TimeoutLogin
directive configures the maximum number of
seconds a client is allowed to spend authenticating, i.e.
from the time when the client connects to the time when the client has
successfully authenticated. The login timer is not reset when a client
transmits data, and is only removed once a client has transmitted an
acceptable combination of USER
/PASS
commands.
The maximum allowed seconds value is 65535 (108 minutes).
See also: TimeoutIdle
,
TimeoutNoTransfer
,
TimeoutStalled
<VirtualHost>
, <Global>
, <Anonymous>
The TimeoutSession
directive sets the maximum number of
seconds a control connection between the proftpd server and client
can exist, after the client has successfully authenticated. If the
seconds argument is set to zero, sessions are allowed to last
indefinitely; this is the default. There is no maxium value for the
seconds parameter.
<VirtualHost>
, <Global>
, <Anonymous>
The UserPassword
directive creates a password for a particular
user; this configured password will override the user's normal
password in /etc/passwd
(or whichever auth module handles that
user). Note that the user configured is a real user, and
not a UserAlias
.
The encrypted-password parameter is a string which has been passed
through the standard Unix crypt(3)
function. Do not use a
cleartext password. To obtain this encrypted-password value,
you can use the ftpasswd
script's --hash
option, e.g.:
# ftpasswd --hash Password: Re-type password: ftpasswd: $1$EsnXxyD6$tsO2YwTAT/Tl5u1NYPHIw1
Example configuration:
# Override user bob's password with a hash version of "password" UserPassword bob $1$EsnXxyD6$tsO2YwTAT/Tl5u1NYPHIw1
mod_auth
module is compiled by default.