PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Logiciels d'hébergement > comp.mail.sendmail > special rewriting of outgoing mail
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.mail.sendmail Configuring and using the BSD sendmail agent.

special rewriting of outgoing mail

Réponse
 
LinkBack Outils de la discussion
Vieux 03/11/2006, 07h32   #1
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut special rewriting of outgoing mail

Colleagues,

I use genericstable and FEATURE(`masquerade_envelope')
to rewrite some outgoing mail.

The problem is that both envelope-from and the "From:" header are
rewritten.

Is there a way to rewrite just the envelope-from and leave the "From:"
header intact?

I know that the direct hacking at the rulesets can do anything, but
would be glad to find a more or less ready-made solution.

Thank you for any ideas.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 04/11/2006, 01h16   #2
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <eierac$2b76$1@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>
>I use genericstable and FEATURE(`masquerade_envelope')
>to rewrite some outgoing mail.
>
>The problem is that both envelope-from and the "From:" header are
>rewritten.
>
>Is there a way to rewrite just the envelope-from and leave the "From:"
>header intact?


Not as such (with a canned solution), but in specific cases you can
perhaps achieve "identity rewriting" for the header (first requirement
is of course that the original envelope and header addresses are
different).

It's a pretty unusual request - I would say that in the vast majority of
cases rewriting both (i.e. what masquerade_envelope achhieves) is
desired, with header-only (i.e. the default) being a distant second. In
fact I don't think I've ever seen anyone ask for envelope-only before -
care to elaborate on why you want this?

>I know that the direct hacking at the rulesets can do anything, but
>would be glad to find a more or less ready-made solution.


Yes, it can be done with a custom mailer definition of course - look at
e.g. how the esmtp mailer turns out in the .cf with and without
masquerade_envelope and/or allmasquerade (which adds header recipient),
and you can probably figure out how it should look to achieve what you
want. Then give it a different name and paste it into your .mc after a
MAILER_DEFINITIONS line (and do whatever it takes to use it, depends a
bit on how you do outgoing mail routing).

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 04/11/2006, 04h41   #3
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Per Hedeland wrote:

> It's a pretty unusual request - I would say that in the vast majority of
> cases rewriting both (i.e. what masquerade_envelope achhieves) is
> desired, with header-only (i.e. the default) being a distant second. In
> fact I don't think I've ever seen anyone ask for envelope-only before -
> care to elaborate on why you want this?


Sure. We have a web hosting which produces a significant amount of
outgoing mail (generated by users' scripts, forums etc). Users should be
free to use any address in the "From:" header, but I want all the
bounces and DSNs sent to one mailbox for analysis.

Perhaps later we might think of some scheme of sender rewriting, much
like Yahoo Groups uses for their mailing lists. But for the present,
directing all the bounces to one mailbox (and not bothering innocent
parties with bounces) would be a great step forward.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 04/11/2006, 05h52   #4
Patrick
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In news:eih5lf$i9r$1@relay.tomsk.ru,
Victor Sudakov <vas@mpeks.no-spam-here.tomsk.su> wrote:

>> In fact I don't think I've ever seen anyone ask for
>> envelope-only before - care to elaborate on why you want this?

>
> Sure. We have a web hosting which produces a significant amount of
> outgoing mail (generated by users' scripts, forums etc).


Ah yes, a spam portal I think it's called.
  Réponse avec citation
Vieux 04/11/2006, 10h53   #5
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <eih5lf$i9r$1@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>Per Hedeland wrote:
>
>> It's a pretty unusual request - I would say that in the vast majority of
>> cases rewriting both (i.e. what masquerade_envelope achhieves) is
>> desired, with header-only (i.e. the default) being a distant second. In
>> fact I don't think I've ever seen anyone ask for envelope-only before -
>> care to elaborate on why you want this?

>
>Sure. We have a web hosting which produces a significant amount of
>outgoing mail (generated by users' scripts, forums etc). Users should be
>free to use any address in the "From:" header, but I want all the
>bounces and DSNs sent to one mailbox for analysis.


OK, but then I think having envelope sender rewriting in sendmail is
quite the wrong way to go about it - just make sure the desired envelope
sender address is set appropriately to start with. I would guess that
the mail is sent via direct invocation of sendmail, in that case just
use the -f option (see the man page). In case it's done via SMTP, the
envelope sender is the 'MAIL From:' argument of course.

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 05/11/2006, 05h34   #6
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Patrick wrote:

> >> In fact I don't think I've ever seen anyone ask for
> >> envelope-only before - care to elaborate on why you want this?

> >
> > Sure. We have a web hosting which produces a significant amount of
> > outgoing mail (generated by users' scripts, forums etc).


> Ah yes, a spam portal I think it's called.


I presume, you have never seen a web forum with E-mail notifications?
You have also never seen a forum where a valid E-mail address is
required for access?

Get a life.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 05/11/2006, 05h54   #7
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Per Hedeland wrote:
> >> It's a pretty unusual request - I would say that in the vast majority of
> >> cases rewriting both (i.e. what masquerade_envelope achhieves) is
> >> desired, with header-only (i.e. the default) being a distant second. In
> >> fact I don't think I've ever seen anyone ask for envelope-only before -
> >> care to elaborate on why you want this?

> >
> >Sure. We have a web hosting which produces a significant amount of
> >outgoing mail (generated by users' scripts, forums etc). Users should be
> >free to use any address in the "From:" header, but I want all the
> >bounces and DSNs sent to one mailbox for analysis.


> OK, but then I think having envelope sender rewriting in sendmail is
> quite the wrong way to go about it - just make sure the desired envelope
> sender address is set appropriately to start with. I would guess that
> the mail is sent via direct invocation of sendmail, in that case just
> use the -f option (see the man page). In case it's done via SMTP, the
> envelope sender is the 'MAIL From:' argument of course.


It would work only for our own scripts.

But this is a commercial hosting. We do not have supervision over the
numerous web applications that the customers install. Nor do we want
to intervene unless there is some abuse.

If their scripts send mail via /usr/sbin/sendmail, I could provide a
wrapper, though this would be a waste of resources. But for SMTP
submissions, rewriting seems to be the only solution.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 05/11/2006, 07h43   #8
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Per Hedeland wrote:

> >I know that the direct hacking at the rulesets can do anything, but
> >would be glad to find a more or less ready-made solution.


> Yes, it can be done with a custom mailer definition of course - look at
> e.g. how the esmtp mailer turns out in the .cf with and without
> masquerade_envelope and/or allmasquerade (which adds header recipient),
> and you can probably figure out how it should look to achieve what you
> want.


I am sorry but adding

MASQUERADE_AS(`domain.com')
FEATURE(masquerade_envelope)

to the .mc file does not produce any changes in the mailer
definitions. It only modifies the rulesets.

Any more ideas?

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 05/11/2006, 20h19   #9
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <eijua8$1mhp$1@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>Per Hedeland wrote:
>
>> OK, but then I think having envelope sender rewriting in sendmail is
>> quite the wrong way to go about it - just make sure the desired envelope
>> sender address is set appropriately to start with. I would guess that
>> the mail is sent via direct invocation of sendmail, in that case just
>> use the -f option (see the man page). In case it's done via SMTP, the
>> envelope sender is the 'MAIL From:' argument of course.

>
>It would work only for our own scripts.
>
>But this is a commercial hosting. We do not have supervision over the
>numerous web applications that the customers install. Nor do we want
>to intervene unless there is some abuse.
>
>If their scripts send mail via /usr/sbin/sendmail, I could provide a
>wrapper, though this would be a waste of resources.


A very marginal waste.

> But for SMTP
>submissions, rewriting seems to be the only solution.


And are there any SMTP submissions? I believe it's quite uncommon for
"cgi scripts" and the like to use SMTP to send mail (and those that do
it probably get it wrong anyway).

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 05/11/2006, 20h32   #10
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <eik4mt$1up5$1@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>Per Hedeland wrote:
>
>> Yes, it can be done with a custom mailer definition of course - look at
>> e.g. how the esmtp mailer turns out in the .cf with and without
>> masquerade_envelope and/or allmasquerade (which adds header recipient),
>> and you can probably figure out how it should look to achieve what you
>> want.

>
>I am sorry but adding
>
>MASQUERADE_AS(`domain.com')
>FEATURE(masquerade_envelope)
>
>to the .mc file does not produce any changes in the mailer
>definitions. It only modifies the rulesets.


Yes, sorry, it's allmasquerade that changes the mailer definition. But
anyway, since you've now looked at the mailer definition, you'll have
found a reference to the EnvFromSMTP ruleset, which is the one
responsible for dealing with the envelope sender. And since it isn't
really masquerading you want to do, I'd suggest that you don't use that
feature but instead have the mailer definition call a ruleset of your
own instead of EnvFromSMTP. That ruleset just needs to throw away the
original address and insert your desired fixed one, and then call
EnvFromSMTP.

Something like this (untested):

LOCAL_RULESETS
SFixedEnvFrom
R$* $: sender < @ domain.com. >
R$* $: $>EnvFromSMTP $1

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 07/11/2006, 03h07   #11
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Victor Sudakov wrote:

> Is there a way to rewrite just the envelope-from and leave the "From:"
> header intact?


So, where are all the gurus? The task seems pretty trivial, I would be
surprised if sendmail really could not do this.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 09/11/2006, 22h54   #12
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <eiot95$1cqi$2@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>Victor Sudakov wrote:
>
>> Is there a way to rewrite just the envelope-from and leave the "From:"
>> header intact?

>
>So, where are all the gurus? The task seems pretty trivial, I would be
>surprised if sendmail really could not do this.


Of course sendmail can do it, wheter it is trivial to make it do it is
another thing - since it is not a common requirement, there has been no
effort at providing a "canned feature" for it. But anyway I already
posted the outline of a solution in

http://groups.google.com/group/comp....17781ad3be3e99

- I'm afraid it won't get more trivial than that.

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 12/11/2006, 11h02   #13
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Per Hedeland wrote:

> And since it isn't
> really masquerading you want to do, I'd suggest that you don't use that
> feature but instead have the mailer definition call a ruleset of your
> own instead of EnvFromSMTP. That ruleset just needs to throw away the
> original address and insert your desired fixed one, and then call
> EnvFromSMTP.


I like this idea. However, how do I gracefully change the esmtp mailer
S parameter? "S=EnvFromSMTP/HdrFromSMTP" is hardcoded into
cf/mailer/smtp.m4, as well as the EnvFromSMTP ruleset itself. And I
don't want my configuration to break with the next upgrade of
sendmail.

If I write my own mailer definition for this purpose, how do I make
my custom mailer the default one?


--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Vieux 13/11/2006, 00h30   #14
Per Hedeland
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

In article <ej6v10$1a8r$1@relay.tomsk.ru> Victor Sudakov
<vas@mpeks.no-spam-here.tomsk.su> writes:
>Per Hedeland wrote:
>
>> And since it isn't
>> really masquerading you want to do, I'd suggest that you don't use that
>> feature but instead have the mailer definition call a ruleset of your
>> own instead of EnvFromSMTP. That ruleset just needs to throw away the
>> original address and insert your desired fixed one, and then call
>> EnvFromSMTP.

>
>I like this idea. However, how do I gracefully change the esmtp mailer
>S parameter? "S=EnvFromSMTP/HdrFromSMTP" is hardcoded into
>cf/mailer/smtp.m4, as well as the EnvFromSMTP ruleset itself. And I
>don't want my configuration to break with the next upgrade of
>sendmail.
>
>If I write my own mailer definition for this purpose, how do I make
>my custom mailer the default one?


I already described this earlier in the thread:

>>>Then give it a different name and paste it into your .mc after a
>>>MAILER_DEFINITIONS line (and do whatever it takes to use it, depends a
>>>bit on how you do outgoing mail routing).


(Here "it" refers to the mailer definition you find in sendmail.cf.)
I.e. there isn't a single default - if parsing just reaches the end of
ruleset zero the message is handed to confSMTP_MAILER; if you have
e.g. a SMART_HOST definition that doesn't specify a mailer,
confRELAY_MAILER will be used. In most places you can specify the mailer
to be used, though.

--Per Hedeland
per@hedeland.org
  Réponse avec citation
Vieux 13/11/2006, 02h58   #15
Victor Sudakov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: special rewriting of outgoing mail

Per Hedeland wrote:
> >I like this idea. However, how do I gracefully change the esmtp mailer
> >S parameter? "S=EnvFromSMTP/HdrFromSMTP" is hardcoded into
> >cf/mailer/smtp.m4, as well as the EnvFromSMTP ruleset itself. And I
> >don't want my configuration to break with the next upgrade of
> >sendmail.
> >
> >If I write my own mailer definition for this purpose, how do I make
> >my custom mailer the default one?


> I already described this earlier in the thread:


> >>>Then give it a different name and paste it into your .mc after a
> >>>MAILER_DEFINITIONS line (and do whatever it takes to use it, depends a
> >>>bit on how you do outgoing mail routing).


> (Here "it" refers to the mailer definition you find in sendmail.cf.)
> I.e. there isn't a single default - if parsing just reaches the end of
> ruleset zero the message is handed to confSMTP_MAILER;


I see. I must redefine confSMTP_MAILER to my custom mailer.
Thanks a lot for your , your advice has been most useful.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h40.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 1,04179 seconds with 23 queries