On 4/14/2017 10:19 PM, Ramon F Herrera wrote:
On 4/14/2017 8:41 PM, Kevin A. McGrail wrote:
On 4/14/2017 9:35 PM, Ramon F Herrera wrote:

I guess this would be more descriptive and succinct:

A "members-only PLUS disguising of all e-mail addresses contained in the headers" mailing list.
I didn't follow all your logic in the previous email but overall you'll likely need something like *mailman or majordomo* plus something like MIMEDefang in front of it to achieve your needs.

This begs the question, to all the readers: Given those 2 requirements, and my lack of time to learn/compare Majordomo vs. mailman, which one would you use?
Attached is the discussed scrap we use in MIMEDefang that we mangle emails before they get to our mailing list. It maintains the same GPL the original MIMEDefang-filter is produced under. I didn't include every sub, etc. as I expect it's not all relevant except to kick off your thinking.

I use MIMEDefang with Postfix and it's a very good solution. I monitor the MD list as well if you have questions and use it.

I use Mailman and it works. Of course, I'm an advisor to Virtru along with John Viega, Mailman's original author. So in solidarity with him, I'm going to completely malign majordomo and say that it's horrible! :-) More seriously, both are great, both work well and I use lists every day using both. Lot comparing a Honda Civic to a Toyota Camry. They both just work and get you from point A to B with little grief or comfort.

Regards,
KAM
# This program may be distributed under the terms of the GNU General
# Public License, Version 2, or (at your option) any later version.
#***********************************************************************
#
# Copyright (C) 2017 PCCC
#***********************************************************************

#get domain name from an email address
sub get_domain_from_email {
  my ($domain) = @_;

  #REMOVE ANY LEADING/TRAILING <>'s
  $domain =~ s/(^<|>$)//g;
  #REMOVE ANY LEADING/TRAILING SPACE'S
  $domain =~ s/^ *//g;
  $domain =~ s/ *$//g;
  #REMOVE EVERYTHING UP TO THE @ SYMBOL
  $domain =~ s/.*\@//g;

  return $domain;
}

    foreach $recip (@Recipients) {
      # BLOCK IF FROM YAHOO (AND OTHERS) BECAUSE THEY SET DMARC TOO STRICTLY
      # 
http://www.pcworld.com/article/2141120/yahoo-email-antispoofing-policy-breaks-mailing-lists.html
      # REWRITE THE FROM HEADER AND OTHER FIELDS PER RECOMMENDATION HERE: 
http://dmarc.org/faq.html#s_3

      # If Sender is set to DMARC reject and recipient is a mailing list - NOTE 
Yahoo.com and AOL.com reject as of 4/23
      if (($recip =~ m/\@mailman\./i or
           $recip =~ m/\@lists\./i)

          and

         # exclude the admnistrivia addresses like admin confirm, join, leave, 
etc.
         ($recip !~ 
/\-(admin|bounces|confirm|join|leave|owner|request|subscribe|unsubscribe)(\+.*)?\@/i)

         ) {
        
        my ($container, $parser, $original, $report2, $dmarc_reject_notice, 
$daemon_sender, $dmarc_result, $sender_domain, $modification_subject, 
$pretty_sender);

        # Automatically check DMARC DNS entry
        $sender_domain = &get_domain_from_email($Sender);
        # DNS test for DMARC entry with timeout of 5 seconds
        $dmarc_result = &check_dmarc(domain=>$sender_domain, timeout=>5);

        if ($dmarc_result =~ /p=(reject|quarantine)/i) {

          # NOTIFY SENDER AND REWRITE THE SENDER TO A DO-NOT-REPLY ADDRESS
          md_syslog('warning', "Modifying message to mailing list due to DMARC 
- $recip - $Sender - $Subject");
          $dmarc_reject_notice = "Your email to $recip was modified to prevent 
your email address on mailing lists from being incorrectly flagged as a forgery.

In order to permit your email through to the mailing list, we have rewritten 
the From address to a do-not-reply address.  Depending on the list 
configuration, you may not receive replies and will need to monitor the list.  
Additionally, this may delay your email as it will require manual intervention 
by the list moderator to approve.

We apologize for the inconvenience but the cause of the issue rests squarely 
with spammers who have forced email providers to implement anti-forgery 
technologies that impact mailing lists heavily.

Sincerely,

Kevin A. McGrail
President, PCCC";


          #CUSTOMIZE NOTIFICATION PARAMS
          $daemon_sender = 'do-not-re...@daemon.pccc.com';
          $modification_subject = &utf8_to_mime("Important Mailing List 
Notification re:[". &mime_to_utf8($Subject) ."]");

          #SEND NOTIFICATION
          action_notify_sender_immediately(Sender=>$Sender, DaemonName=>'PCCC 
Raptor Notice', DaemonAddress=>$daemon_sender, 
NotifySenderSubject=>$modification_subject, body=>$dmarc_reject_notice);

          #TEMPORARILY REMOVE MAILING LIST
          #delete_recipient($recip); - NO LONGER NEEDED WITH REWRITE OF FROM

          #CHANGE SENDER ON ENVELOPE
          change_sender($daemon_sender);

          #CHANGE SENDER ON FROM
          if (&check_header(header=>'From')) {
            action_delete_all_headers('From');
            action_delete_all_headers('Reply-To');

            #REMOVE ANY DKIM SIGS AS WELL
            action_delete_all_headers('DKIM-Signature');
            action_delete_all_headers('DomainKey-Signature');

            $pretty_sender = $Sender;
            $pretty_sender =~ s/[<>]//g;

            action_add_header("From","\"DMARC Modified Email (was 
$pretty_sender)\" <$daemon_sender>");
            action_add_header("Reply-To", "$Sender");
          }
        }
      }
    }
    #END DMARC MAILING LIST HANDLING


sub check_dmarc {
  my (%params) = @_;
  my ($res, $packet, @answer);

  $res = Net::DNS::Resolver->new;

  $params{'timeout'} ||= 10;
  $params{'domain'} || return undef;

  if (defined ($res)) {
    $res->tcp_timeout($params{'timeout'});       #Number of Seconds before 
query will fail
    $res->udp_timeout($params{'timeout'});       #Number of Seconds before 
query will fail

    $packet = $res->query("_dmarc.$params{'domain'}","TXT","IN");

    #Parse the Query
    if (defined ($packet)) {
      if (defined ($packet->answer)) {
        @answer = $packet->answer;
        if ($answer[0]->type eq "TXT") {
          return $answer[0]->txtdata;
        }
      }
    }
  }

  return undef;
}

Reply via email to