Re: Fastforward AND smarthost-style operation at once

2000-08-23 Thread tibbs . joshd


I'm working on a similar situation. I had tried what Dave suggested and it
worked as documented. However, I need to be able to actually relay messages
that don't match an alias (ie. don't rewrite the recipient address).

My normal config:

I have my qmail box acting as my primary MX and behind that sits my Domino
server running SMTP. My rcpthosts has:
kendle.com

My smtproutes has:
kendle.com:mail.kendle.com

locals has only the machine itself.

So any message for kendle.com is relayed to mail.kendle.com (the Domino
server), which accepts messages for recipients @kendle.com.

Here's what I tried:

I put kendle.com in locals and used a .qmail-default like this:

| fastforward -p /etc/aliases.cdb
| forward "$LOCAL"@mail.kendle.com

messages are forwarded to [EMAIL PROTECTED] instead of [EMAIL PROTECTED]

 If I use:

| fastforward -p /etc/aliases.cdb
| forward "$LOCAL"@kendle.com

the message just loops because qmail-send thinks that kendle.com is local.
I know it's sort of nitpicky, but I need messages to be processed through
fastforward and be relayed to the next server with the recipient address of
[EMAIL PROTECTED] if no match is found.

Any ideas?

Thanks,
Josh




RFC821 bounce compliance

2000-08-17 Thread tibbs . joshd

Hi all,

Long story short here. I need to convince a business partner's admin that
we are correct in sending their users bounce messages with a null envelope
sender.

The partner is using Exchange and they are relaying a bounce message from
us to one of their internal non-M$ systems and rewriting the envelope
sender to unknown. M$ acknowledges the problem, it is documented. The
partner admins will refute the M$ document (it has happened before!) and
continue to assert that our MTA is to fault for this. I hate doing other
people's work.

Now, we all know that's the correct way to do it, but I went to RFC821 to
back me up. RFC821 states that this is "permissible". Fair enough - if it's
"permissible" then a compliant MTA that receives such a message should be
able to deliver or relay as appropriate. Permissible implies to me that you
may choose to use that feature, but you MUST support it when used by
another MTA delivering a message to yours. I think my argument is sound
here.

My real question is the reference in 821 (page 15) that the sender
(apparantly header sender) is server-SMTP. Now typically this is
mailer-daemon. Does this RFC really say that I should be using some form of
`cat /var/qmail/control/me`-SMTP instead? I really don't think it matters
in practice, but I want to have my ducks in a row when I take my position.
Bottom line: Should I change my bouncefrom if I want to stand by the RFC
100%?


Josh Tibbs
Kendle International




Re: How to grab the envelope contents while filtering?

2000-07-20 Thread tibbs . joshd


Actually, I was looking at the release notes, not the man page, but yes I
should have known that from version 1.0. Thanks.

As for the empty messages, I found that if my filter has no output a blank
message is sent to the envelope recipients. I circumvented by this
modification to qmail-qfilter.c v1.0:

/* remap the appropriate FDs and exec qmail-queue */
int run_qmail_queue(int tmpfd, int envpipe[2])
{
struct stat mystat;
struct stat *ptr_mystat;
ptr_mystat=mystat;
fstat(tmpfd,ptr_mystat);
if (mystat.st_size  5){
  if(close(envpipe[1]) == -1 ||
 dup2(tmpfd, 0) != 0 || close(tmpfd) == -1 ||
 dup2(envpipe[0], 1) != 1 || close(envpipe[0]) == -1 ||
 close(2) == -1)
return QQ_WRITE_ERROR;
  execl(QMAIL_QUEUE, QMAIL_QUEUE, 0);
  return QQ_INTERNAL;
}
return QQ_SUCCESS;
}

It's kind of a hack, but it works so far. Should I continue to use this method or is 
there a better solution here?

Thanks again for all your help and patience with a newbie. :)

Josh






Bruce Guenter [EMAIL PROTECTED] on 07/19/2000 06:14:42 PM

To:   [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]
Subject:  Re: How to grab the envelope contents while filtering?


On Wed, Jul 19, 2000 at 05:01:48PM -0400, [EMAIL PROTECTED] wrote:
 Yup, I use the mess822 stuff too, but I need envelope addresses, not
header
 addresses.

 I see now that qmail-qfilter 1.3 sets QMAILRCPTS to the message
recipients.
 I assume this is envelope recipients. If so, I'm halfway there. I just
need
 to doctor up 1.3 a little bit to also pass a variable for envelope sender
 (and to drop empty messages). Can anyone confirm?

The same man page tells you that qmail-qfilter sets QMAILUSER and
QMAILHOST to the username and hostname portions of the envelope sender.
Dropping empty messages is something you can do in your filter.
--
Bruce Guenter [EMAIL PROTECTED]   http://em.ca/~bruceg/



 $RFC822.eml
 C.DTF


Re: How to grab the envelope contents while filtering?

2000-07-20 Thread tibbs . joshd


I have a filter the looks at file attachments in the message. If certain
file types are attached, the message delivery is stopped (ie. no output
from the filter). Without the qmail-qfilter hack, qmail-queue gets only the
envelope and sends what amounts to an empty message to the envelope
recipients. With the hack, if the message is  5 characters, qmail-queue is
not run.

Josh





Bruce Guenter [EMAIL PROTECTED] on 07/20/2000 12:13:03 PM

To:   [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]
Subject:  Re: How to grab the envelope contents while filtering?


On Thu, Jul 20, 2000 at 09:24:33AM -0400, [EMAIL PROTECTED] wrote:
 As for the empty messages, I found that if my filter has no output a
blank
 message is sent to the envelope recipients. I circumvented by this
 modification to qmail-qfilter.c v1.0:

What are you trying to do?  Why are you not sending any output to
qmail-queue?  qmail-qfilter allows you to filter the headers and body of
a messages before it reaches qmail-queue.
--
Bruce Guenter [EMAIL PROTECTED]   http://em.ca/~bruceg/



 $RFC822.eml
 C.DTF


Re: How to grab the envelope contents while filtering?

2000-07-20 Thread tibbs . joshd


I saw that in your example, but it causes a delivery failure, which is not
what I want to happen. I need the message to be accepted and silently
dropped if it meets certain criteria. I do the appropriate notification on
the back end.

I suppose qmail-qfilter can be patched so that qmail-queue is not run on a
specific filter exit code, no?

Josh





Bruce Guenter [EMAIL PROTECTED] on 07/20/2000 12:55:28 PM

To:   [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]
Subject:  Re: How to grab the envelope contents while filtering?


On Thu, Jul 20, 2000 at 12:42:27PM -0400, [EMAIL PROTECTED] wrote:
 I have a filter the looks at file attachments in the message. If certain
 file types are attached, the message delivery is stopped (ie. no output
 from the filter).

If you want to block a message, exit with a permanent error code (ie 31).
--
Bruce Guenter [EMAIL PROTECTED]   http://em.ca/~bruceg/



 $RFC822.eml
 C.DTF


How to grab the envelope contents while filtering?

2000-07-19 Thread tibbs . joshd

Hi all,

I'm using a content filter shell script that I've written (based on inflex)
with qmail-qfilter. During this filter process, I'd like to grab the
contents of the envelope and store them in a file for use later (ie,
reconstructing the envelope for an inject).

I've toyed with trying to pipe fd 1 into a file without success. I know
that this has to be doable with a small C program, but quite honestly, I
don't have the familiarity with C to do it. Can it be done with Perl? In
the shell? Is it as simple as reading fd1, writing a file, and re-writing
fd1?

Any ideas on how I can accomplish this?

Some details:

qmail 1.03
qmail-qfilter 1.0
Redhat 6.2


Thanks in advance for any help,
Josh Tibbs
Kendle International Inc.





RE: How to grab the envelope contents while filtering? - syntax error

2000-07-19 Thread tibbs . joshd


OK, so I tried this:

#!/usr/bin/perl

if ($#ARGV != 0) {
die "Usage:  $0 outputfile\n";
}

open (INFD, "1") or die "BAD FD IN";
open (OUTFILE, "$ARGV[0]") or die "BAD FILE OUT";
# open (OUTFD, "1") or die "BAD FD OUT";

while (INFD) {
  print OUTFILE "$_";
#  print OUTFD "$_";
}

close (OUTFILE);
close (INFD);
# close (OUTFD);

I tried as is and with the commented lines enabled (just to be sure I didn't step on 
my input for some silly reason). I still end up with a 0 byte
output file, same as
using redirection in the shell. The more I think about it, I'm almost certain that my 
script does not have access to this data (so to speak) when run
via qmail-qfilter.

I think it's time to go back to the drawing board and go dig in the qmail-qfilter 
source. Any more ideas, concurrences, disagreements, etc?

Thanks,
Josh





"Ihnen, David" [EMAIL PROTECTED] on 07/19/2000 03:02:08 PM

To:   "Ihnen, David" [EMAIL PROTECTED], "'[EMAIL PROTECTED]'"
  [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject:  RE: How to grab the envelope contents while filtering? - syntax e
  rror


Provided you remove the comma from the print statement, it'll actually work
too.  ;)

David

-Original Message-
From: Ihnen, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:58 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: How to grab the envelope contents while filtering?


In fooling with tcpclient I found the syntax to do this.  As I'm a perl
junky, here's a program that will read descriptor 6 and print to descriptor
7.  If you know any perl at all this should get you to where you need to
be.

#!/usr/bin/perl

# read descriptor 6 and print it to descriptor 7

open INFILE, "6" or die "BAD IN";
open OUTFILE, "7" or die "BAD OUT";

while (INFILE) {
  print OUTFILE, $_;
}

close OUTFILE;
close INFILE;


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:20 AM
To: [EMAIL PROTECTED]
Subject: How to grab the envelope contents while filtering?


Hi all,

I'm using a content filter shell script that I've written (based on inflex)
with qmail-qfilter. During this filter process, I'd like to grab the
contents of the envelope and store them in a file for use later (ie,
reconstructing the envelope for an inject).

I've toyed with trying to pipe fd 1 into a file without success. I know
that this has to be doable with a small C program, but quite honestly, I
don't have the familiarity with C to do it. Can it be done with Perl? In
the shell? Is it as simple as reading fd1, writing a file, and re-writing
fd1?

Any ideas on how I can accomplish this?

Some details:

qmail 1.03
qmail-qfilter 1.0
Redhat 6.2


Thanks in advance for any help,
Josh Tibbs
Kendle International Inc.



 $RFC822.eml


Re: How to grab the envelope contents while filtering?

2000-07-19 Thread tibbs . joshd


Yup, I use the mess822 stuff too, but I need envelope addresses, not header
addresses.

I see now that qmail-qfilter 1.3 sets QMAILRCPTS to the message recipients.
I assume this is envelope recipients. If so, I'm halfway there. I just need
to doctor up 1.3 a little bit to also pass a variable for envelope sender
(and to drop empty messages). Can anyone confirm?

Josh





"asantos" [EMAIL PROTECTED] on 07/19/2000 05:30:32 PM

To:   [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject:  Re: How to grab the envelope contents while filtering?


From: [EMAIL PROTECTED] [EMAIL PROTECTED]
I've toyed with trying to pipe fd 1 into a file without success. I know
that this has to be doable with a small C program, but quite honestly, I
don't have the familiarity with C to do it. Can it be done with Perl? In
the shell? Is it as simple as reading fd1, writing a file, and re-writing
fd1?


Have a look at http://cr.yp.to/mess822.html , the 822header utility could
be
what you need.

Armando





 $RFC822.eml


RE: How to grab the envelope contents while filtering?

2000-07-19 Thread tibbs . joshd


This is fine. I think the qmail-inject might be overkill, but does no harm.
With the -n, it merely prints the message (with some headers tidied up if
need be), which is then pumped into qmail-queue. The recipients are coming
from the envelope (the fd 1 magic that I'm trying to figure out), not from
the header. Therefore, no extra or double recipients.

Your concern is my reality :(. When an administrator needs to resubmit a
message that was stopped by the filter, we need to reconstruct the envelope
as it was at the time that the message was stopped. Now, if I just inject
the message, it's gonna go out to everybody in the header all over again.

Josh




"Ihnen, David" [EMAIL PROTECTED] on 07/19/2000 05:19:57 PM

To:   "'[EMAIL PROTECTED]'" [EMAIL PROTECTED],
  "'[EMAIL PROTECTED]'" [EMAIL PROTECTED]
cc:
Subject:  RE: How to grab the envelope contents while filtering?


MAN PAGE ALERT
(from qmail-qfilter page)

   qmail-qfilter sends the message text through each  of  the
   filter commands named on the command line.  Each filter is
   run seperately, with __standard input__ opened  to  the  input
   email,  and __standard output__ opened to a new temporary file
   that will become the input to either the next  filter,  or
   qmail-queue.  Each filter on the command line in seperated
   with --.

With this data in mind, I made a little script that does some censoring

--- qmail-qfilter myfilter.pl -- qmail-inject -n ---
--
#!/usr/bin/perl

while () {
  s/fuck/fsck/i;
  print $_;
}
--

David

PS - I'm concerned that with this qmail-inject thing going on that multiple
recipients might get multiple copies - but then I haven't read the
documentation enough to clarify that in my head.  Would a relayed message
to
multiple recipients have those other recipients re-qualified as
undelivered-to and hence would get multiple copies?  Somebody knows, I'm
sure.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 1:16 PM
To: Ihnen, David
Cc: [EMAIL PROTECTED]
Subject: RE: How to grab the envelope contents while filtering? - syntax
error



OK, so I tried this:

#!/usr/bin/perl

if ($#ARGV != 0) {
die "Usage:  $0 outputfile\n";
}

open (INFD, "1") or die "BAD FD IN";
open (OUTFILE, "$ARGV[0]") or die "BAD FILE OUT";
# open (OUTFD, "1") or die "BAD FD OUT";

while (INFD) {
  print OUTFILE "$_";
#  print OUTFD "$_";
}

close (OUTFILE);
close (INFD);
# close (OUTFD);

I tried as is and with the commented lines enabled (just to be sure I
didn't
step on my input for some silly reason). I still end up with a 0 byte
output file, same as
using redirection in the shell. The more I think about it, I'm almost
certain that my script does not have access to this data (so to speak) when
run
via qmail-qfilter.

I think it's time to go back to the drawing board and go dig in the
qmail-qfilter source. Any more ideas, concurrences, disagreements, etc?

Thanks,
Josh





"Ihnen, David" [EMAIL PROTECTED] on 07/19/2000 03:02:08 PM

To:   "Ihnen, David" [EMAIL PROTECTED], "'[EMAIL PROTECTED]'"
  [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject:  RE: How to grab the envelope contents while filtering? - syntax e
  rror


Provided you remove the comma from the print statement, it'll actually work
too.  ;)

David

-Original Message-
From: Ihnen, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:58 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: How to grab the envelope contents while filtering?


In fooling with tcpclient I found the syntax to do this.  As I'm a perl
junky, here's a program that will read descriptor 6 and print to descriptor
7.  If you know any perl at all this should get you to where you need to
be.

#!/usr/bin/perl

# read descriptor 6 and print it to descriptor 7

open INFILE, "6" or die "BAD IN";
open OUTFILE, "7" or die "BAD OUT";

while (INFILE) {
  print OUTFILE, $_;
}

close OUTFILE;
close INFILE;


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 19, 2000 11:20 AM
To: [EMAIL PROTECTED]
Subject: How to grab the envelope contents while filtering?


Hi all,

I'm using a content filter shell script that I've written (based on inflex)
with qmail-qfilter. During this filter process, I'd like to grab the
contents of the envelope and store them in a file for use later (ie,
reconstructing the envelope for an inject).

I've toyed with trying to pipe fd 1 into a file without success. I know
that this has to be doable with a small C program, but quite honestly, I
don't have the familiarity with C to do it. Can it be done with Perl? In
the shell? Is it as simple as reading fd1, writing a file, and re-writing
fd1?

Any ideas on how I can accomplish this?

Some details:

qmail 1.03
qmail-qfilter 1.0
Redhat 6.2


Thanks in advance for any help,
Josh Tibbs
Kendle International Inc.





 $RFC822.eml