restricting auth plugins to SSL *or* TLS
Brian Szymanski <ski-qpsmtpd <at> allafrica.com>
2006-10-03 01:51:34 GMT
Howdy again qpsmtpd folks...
I want to restrict my auth handlers for plain and login to secure
(SSL or TLS) connections, so that CRAM-MD5 is the only one that can
be used with plaintext. However, I'm not sure what the best way to do
this is. Before I had the tls plugin enabled, I was able to get by
with this:
sub register {
my ( $self, $qp ) = <at> _;
$self->register_hook("auth-cram-md5", "authuserdb");
#only make insecure mechanisms available if over SSL or localhost
if(($ENV{TCPLOCALPORT} == 465) || ($ENV{TCPREMOTEIP} eq
'127.0.0.1')) {
$self->register_hook("auth-plain", "authuserdb");
$self->register_hook("auth-login", "authuserdb");
}
}
But of course this winds up only offering the "secure" auth plugins
after starttls, which in my base (with versamail 3.X from a treo 650)
breaks things, since versamail only does auth plain and auth plain
only. I tried (naively) to add $self->connection->notes
('tls_enabled') in to that clause, but of course we don't know when
register() is called whether TLS will be enabled later or not.
Now, I could just register plain and login on port 25, but then
return DENY if tls_enabled isn't in the connection notes, but that
sucks for a number of reasons:
- A valid client can error out (AFTER shipping its credentials in
plaintext)
(Continue reading)