On Mon, Aug 31, 2009 at 8:34 PM, Noel Jones<njo...@megan.vbhcs.org> wrote: > On 8/31/2009 12:58 PM, none none wrote: >> >> I've created this simple_filter: >> http://www.postfix.org/FILTER_README.html#simple_filter >> >> This is email, being sent via sendmail command, after it has been >> filtered: >> >> ---------------------------------------------------------------------------- >> Received: from [192.168.0.3] (unknown [192.168.0.3]) >> (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) >> (No client certificate requested) >> by khole.example1.com (Postfix) with ESMTPSA id 5EDEC11425 >> for<j...@example2.com>; Sun, 23 Aug 2009 18:15:02 +0200 (CEST) >> Message-ID:<4a9aa581.3050...@starforce.biz> >> Date: Sun, 23 Aug 2009 18:14:57 +0200 >> From: Root<r...@example1.com> >> User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) >> MIME-Version: 1.0 >> To: j...@example2.com >> Subject: Is it in? >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> Content-Transfer-Encoding: 7bit >> >> I think it should not be. > > Should not be what? It's unclear what you refer to here.
LOL! You've deleted bottom line (...-----------------...) which divides mail(header + body) from this chatter. String "I think it should not be.", is just a part of mail, that is, it's body. Completely irrelevant here. >> Filter is using this command: >> /usr/local/sbin/sendmail -G -i -f r...@example1.com j...@example2.com >> <msg-headers+body-from-above> > > The sendmail commend is a pipe. Don't put headers+body on the command line. Yes I know that.Simply haven't knew how to formulate this mail comand line. I send mail by firstly typing: /usr/local/sbin/sendmail -G -i -f r...@example1.com j...@example2.com Then I hit enter. Then I paste mail(header + body). Then I hit: ^D > >> >> I have 2 problems >> >> Above command, if used as a root user results in MODIFIED headers+body >> msg-headers+body MUST be exactly same, after it pass through filter >> and STAY that way, until it leaves my server. >> As first 2 lines below shows, another Received: header, has been >> added, as soon as it passes through sendmail >> >> ---------------------------------------------------------------------------- >> Received: by khole.example1.com (Postfix, from userid 1003) >> id 1CCB111428; Mon, 23 Aug 2009 19:32:15 +0200 (CEST) > > Yes, postfix adds a Received: header when a mail is received. There is no > option to turn this off. Postfix has already received relayed mail and added first Received: header Then it came into my filter. After filter has done it's job, it send it back to potfix by using /usr/local/sbin/sendmail, which adds ANOTHER Received: header Nothing should touch or add anything to mail header or it's body, after filter has done it's job! > You may be able to later remove the header with an appropriate header_checks > entry, but be careful when removing headers. That is not an option > >> Second problem: >> If msg-headers+body from begening of this post, is being sent as: >> /usr/local/sbin/sendmail -G -i -f r...@example1.com j...@example2.com >> <msg-headers+body> > > The sendmail command is a pipe. I've gave you exact example of how I use sendmail command You've also deleted key part here. If that sendmail command is being executed as a ROOT, then mail ends up in target mailbox as I showed. BUT, after I've created user "filter" and set it as owner and executioner of filter proces in master.cf In target mailbox I get mail like this: from (unknown sender) to (no subject) ---------------- Received: by khole.example1.com (Postfix, from userid 1003) id 27A1711429; Mon, 23 Aug 2009 19:29:36 +0200 (CEST) ---------------- Everything is being stripped!!! Only that has been left is a SECOND header added by sendmail command. In mail log I see: postfix/cleanup[17465]: C473511429: message-id=<> It does it? But NOT for root user > If you describe what original problem you're trying to solve maybe you can > get some better pointers. > > > -- Noel Jones > Done Noel! ;)