[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] IMAP/POP Before SMTP - IMAP not working



I know that most of you reading this are first thinking. Hey it is not
IMAP/POP before SMTP but rather it is called POP before SMTP. Well in
looking at the script poprelayd to see what it would take to add IMAP relay
authentication I was amazed to find that the script says it is writting to
add IMAP authentication to the relay.

Here is the top of the script
Usage: poprelayd [-p] [-a <ip>] [-r <ip>] [-d] [-f]\n

  -p          Displays a list of trusted IP addresses and their life in
seconds.
  -a <ip>     Adds the specified IP address to the trusted pool.
  -r <ip>     Removes the specified IP address from the trusted pool.
  -f          Removes all members of the trusted pool.

poprelayd is used to enable temporary SMTP relaying trusts by monitoring POP
and IMAP usage in the mail logfile, $logfile.

Every time a POP occurs, the client IP address will be added to the relay
trust
for $timeout_minutes minutes.  Every time an IMAP session is started, that
client will
be added to the relay trust for the same amount of time.  IMAP sessions that
last longer
than $timeout_minutes minutes will need to be restarted prior to sending
mail.

However it does not work. In looking at the script further I believe I have
found the reason why but do not know how to fix it.

Notice below that the imapd line that checks is looking for Authenticated
user= and the line in the maillog file actually reads Login user= and not as
they are looking for it. Seems to be that if this was corrected it would
work. Anyone have any insight? I have IMAP user that have had to so far add
POP accounts just so that they can relay.

# Scan $line to see if it's a log of a successful POP3 authentication.
# Return an array of the addresses that authenticated.
#
sub scanaddr ($) {
    my $s = $_[0];
    my @paddrs;         # Packed IP addresses.
    my @addrs;          # ASCII addresses.

    # POP login by user "admin" at (10.9.28.29) 10.9.28.29
    # ensure line ends at IP address.  Filter on rejection codes
    if ($s =~ /POP login by user \"[\-\_\.\w]+\" at \(.+\) ([0-9\.]+)\s*$/)
{
        my $authuser = $1;
        return $authuser unless ($s =~ /reject=\d/i);
    }

    # imapd[11676]: Authenticated user=admin host=pyro.cobalt.com
[10.9.28.29]
    # ensure line ends at IP address.  Filter on rejected syntax.
    if ($s =~ /Authenticated user=\S+ host=\S+ \[([\d\.]+)\]\s*$/) {
        my $authuser = $1;
        return $authuser unless ($s =~ /unknown command/i);
    }

    return ();
}