--- spamass-milter.1.in +++ spamass-milter.1.in @@ -16,6 +16,7 @@ .Op Fl f .Op Fl g Ar group .Op Fl i Ar networks +.Op Fl I .Op Fl m .Op Fl M .Op Fl P Ar pidfile @@ -134,6 +135,8 @@ Multiple flags will append to the list. For example, if you list all your internal networks, no outgoing emails will be filtered. +.It Fl I +Ignores messages if the sender has authenticated via SMTP AUTH. .It Fl m Disables modification of the .Ql Subject: --- spamass-milter.cpp +++ spamass-milter.cpp @@ -178,6 +178,7 @@ bool flag_full_email = false; /* pass f bool flag_expand = false; /* alias/virtusertable expansion */ bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */ bool auth = false; /* don't scan authenticated users */ +bool ignore_authenticated_senders = false; /* authenticated users bypass spam checks */ // {{{ main() @@ -185,7 +186,7 @@ int main(int argc, char* argv[]) { int c, err = 0; - const char *args = "afd:mMp:P:r:u:D:i:b:B:e:xS:R:C:g:"; + const char *args = "afd:mMp:P:r:u:D:i:Ib:B:e:xS:R:C:g:"; char *sock = NULL; char *group = NULL; bool dofork = false; @@ -225,6 +226,10 @@ main(int argc, char* argv[]) debug(D_MISC, "Parsing ignore list"); parse_networklist(optarg, &ignorenets); break; + case 'I': + debug(D_MISC, "Ignore authenticated senders"); + ignore_authenticated_senders = true; + break; case 'm': dontmodifyspam = true; smfilter.xxfi_flags &= ~SMFIF_CHGBODY; @@ -301,7 +306,7 @@ main(int argc, char* argv[]) cout << PACKAGE_NAME << " - Version " << PACKAGE_VERSION << endl; cout << "SpamAssassin Sendmail Milter Plugin" << endl; cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl; - cout << " [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl; + cout << " [-e defaultdomain] [-f] [-i networks] [-I] [-m] [-M]" << endl; cout << " [-P pidfile] [-r nn] [-u defaultuser] [-x] [-a]" << endl; cout << " [-C rejectcode] [-R rejectmsg] [-g group]" << endl; cout << " [-- spamc args ]" << endl; @@ -318,6 +323,7 @@ main(int argc, char* argv[]) cout << " -g group: socket group (perms to 660 as well)" << endl; cout << " -i: skip (ignore) checks from these IPs or netblocks" << endl; cout << " example: -i 192.168.12.5,10.0.0.0/8,172.16.0.0/255.255.0.0" << endl; + cout << " -I: skip (ignore) checks if sender is authenticated" << endl; cout << " -m: don't modify body, Content-type: or Subject:" << endl; cout << " -M: don't modify the message at all" << endl; cout << " -P pidfile: Put processid in pidfile" << endl; @@ -850,6 +856,22 @@ mlfi_envfrom(SMFICTX* ctx, char** envfro return SMFIS_ACCEPT; } } + + if (ignore_authenticated_senders) + { + char *auth_authen; + + auth_authen = smfi_getsymval(ctx, const_cast("{auth_authen}")); + debug(D_MISC, "auth_authen=%s", auth_authen ?: ""); + + if (auth_authen) + { + debug(D_MISC, "sender authenticated (%s) - accepting message", + auth_authen); + debug(D_FUNC, "mlfi_envfrom: exit ignore"); + return SMFIS_ACCEPT; + } + } debug(D_FUNC, "mlfi_envfrom: enter"); try {