I've tried to block external emails coming to our mailing lists defined in LDAP.
I've already tried the following means:
1) "LDAP_SOURCE mailsource" setting in ldapaliasrc, then "mailsource: local" attribute on mailing lists in LDAP - it doesn't work as documented, Courier's ldapaliasd does searches on that attribute (&(mail=all)(mailsource=esmtp)), but still delivers to those lists afterwards;
2) Delivery checks in maildroprc with forward to a moderator - unacceptable, the moderator account receives as many copies of each mail as there were members in a list; the envoronment variable AUTHENTICATED isn't available to test whether the user authenticated with SMTP AUTH;
3) Alias filtering account specified in /etc/courier/aliasfilteracct - it doesn't seem to work for LDAP aliases
4) Global perlfilter - hard to debug, dangerous and still doesn't work...
Ad. 4): I can see filter processes: courier 8229 0.0 0.0 4464 456 ? S 20:59 0:00 perlfilter
Filtering is enabled:
# cat /etc/courier/enablefiltering esmtp local
But the following code from the filterdata() function doesn't seem to give any results, as if it wasn't run at all:
<snip> # Here's where the custom content filter is implemented. Use filehandles # so that cleanup's automatic.
my $fh=new IO::File "< $filename";
return "" unless defined $fh;
my $line; my $to_private_list = 0; my $from_admin_account = 0;
my $logfh = new IO::File ">>/var/spool/courier/tmp/perlfilterlog.txt";
while ( defined ($line=<$fh>))
{
chomp $line;
last if $line eq ""; # End of headers if (
$line =~ /^To:[EMAIL PROTECTED]/i
) {
$to_private_list = 1;
}
if (
$line =~ /^From:[EMAIL PROTECTED]/i
) {
print $logfh "From admin";
$from_admin_account = 1;
}}
if ($to_private_list && ! $from_admin_account) {
return "550 Access to list denied."
}
return "";
</snip>--
Aleksander Adamowski
Jabber JID (to nie e-mail!): [EMAIL PROTECTED]
GG#: 274614
ICQ UIN: 19780575 http://olo.office.altkom.com.pl
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ courier-users mailing list [EMAIL PROTECTED] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
