6 messages in net.sourceforge.lists.courier-usersRe: [courier-users] SMTP auth and the...
FromSent OnAttachments
Otto SolaresFeb 15, 2007 5:19 pm 
Sam VarshavchikFeb 15, 2007 6:37 pm 
Gordon MessmerFeb 15, 2007 9:46 pm 
Otto SolaresFeb 15, 2007 10:30 pm.pm
Otto SolaresFeb 16, 2007 12:58 am.pm
Otto SolaresFeb 22, 2007 8:30 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] SMTP auth and the From headerActions...
From:Otto Solares (sol@guug.org)
Date:Feb 15, 2007 10:30:10 pm
List:net.sourceforge.lists.courier-users
Attachments:

On Thu, Feb 15, 2007 at 09:47:19PM -0800, Gordon Messmer wrote:

Otto Solares wrote:

I am a happy courier-mta user for a long time, I'm using it in a large University (60k users), now we are facing a problem where users connect to SMTP with authentication in order to send a mail (we don't allow sending email without auth) and some users are changing the From: header, it is possible to tell courier so it'll check the From: header to conform to the auth user?

No, but you could write a courierfilter to do that. Frameworks for Python and Perl exist, if you're comfortable with either of those languages.

Excellent! Although I am not versed in perl here is my first filter attempt, dunno why it doesn't work, when printing (for debugging) any message->* variable, all the message is shown. Does somebody knows what I am missing?

-otto

package Courier::Filter::Module::AuthMailFrom;

use warnings; use strict;

use base qw(Courier::Filter::Module);

use constant TRUE => (0 == 0); use constant FALSE => not TRUE;

sub match;

sub match { my ($module, $message) = @_; my $class = ref($module);

STDERR->print("AuthMailFrom: MAIL FROM: \"$message->sender\", LOGIN:
\"$message->authenticated_user\".\n");

return if not $message->authenticated;

STDERR->print("AuthMailFrom: message is authenticated.\n");

if ($message->authenticated_user =~ m/^($message->sender)/) { STDERR->print("AuthMailFrom: authenticated user match the sender.\n");

return; }

return $module->{response}; }

TRUE;