{"thread":{"id":"7366","subject":"[PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","startedAt":"2007-03-23T12:11:02Z","lastAt":"2007-03-24T19:58:42Z","messageCount":10,"participants":["Jim Meyering","Andy Parkins","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"37806","messageId":"874poc88ix.fsf@rho.meyering.net","threadId":"7366","inReplyTo":null,"subject":"[PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-03-23T12:11:02Z","receivedAt":"2007-03-23T12:11:02Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"This change adds a new, required, config variable: hooks.envelopesender,\nand use that with sendmail's -f option.  This is important in order\nto avoid relying on sendmail's \"guess\" at an appropriate envelope\nsender address.  Without this, and in the presence of strict servers,\nit is far too easy not ever to be notified, or (more insidious) never\nto receive bounce email.\n\nBelow, I've included an additional patch in case you want\nto require the envelopesender setting only when at least one of the\nmailing list variables is set.\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n templates/hooks--update |   12 +++++++++++-\n 1 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex 8f6c4fe..bc1f1a9 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -12,6 +12,10 @@\n #   This is the list that all pushes will go to; leave it blank to not send\n #   emails frequently.  The log email will list every log entry in full between\n #   the old ref value and the new ref value.\n+# hooks.envelopesender\n+#   Use this email address as the envelope sender (argument to sendmail's\n+#   -f option).  This is not the \"From:\" address.  This should be a useful\n+#   email address within your organization.  Required.\n # hooks.announcelist\n #   This is the list that all pushes of annotated tags will go to.  Leave it\n #   blank to just use the mailinglist field.  The announce emails list the\n@@ -52,10 +56,16 @@ fi\n \n # --- Config\n projectdesc=$(cat $GIT_DIR/description)\n+envelope_sender=$(git-repo-config hooks.envelopesender)\n recipients=$(git-repo-config hooks.mailinglist)\n announcerecipients=$(git-repo-config hooks.announcelist)\n allowunannotated=$(git-repo-config --bool hooks.allowunannotated)\n \n+if [ -z \"$envelope_sender\" ]; then\n+\techo \"Usage: hooks.envelopesender must be set in config\" >&2\n+\texit 1\n+fi\n+\n # --- Check types\n newrev_type=$(git-cat-file -t $newrev)\n \n@@ -279,7 +289,7 @@ $0 $1 \\\\\n   $3\n EOF\n #) | cat >&2\n-) | /usr/sbin/sendmail -t\n+) | /usr/sbin/sendmail -f \"$envelope_sender\" -t\n \n # --- Finished\n exit 0\n-- \n1.5.1.rc1\n\n\n>From 4b3d42890b2b33b2f34902d26561b78e5e92ddba Mon Sep 17 00:00:00 2001\nFrom: Jim Meyering <jim@meyering.net>\nDate: Fri, 23 Mar 2007 13:06:00 +0100\nSubject: [PATCH] Fail upon undefined envelopesender only if at least one of\nthe mailing list variables is set.\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n templates/hooks--update |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex bc1f1a9..c79b4b4 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -61,9 +61,11 @@ recipients=$(git-repo-config hooks.mailinglist)\n announcerecipients=$(git-repo-config hooks.announcelist)\n allowunannotated=$(git-repo-config --bool hooks.allowunannotated)\n \n-if [ -z \"$envelope_sender\" ]; then\n-\techo \"Usage: hooks.envelopesender must be set in config\" >&2\n-\texit 1\n+if [ -n \"$recipients$announcerecipients\" ]; then\n+\tif [ -z \"$envelope_sender\" ]; then\n+\t\techo \"Usage: hooks.envelopesender must be set in config\" >&2\n+\t\texit 1\n+\tfi\n fi\n \n # --- Check types\n-- \n1.5.1.rc1\n"},{"id":"37807","messageId":"200703231258.34339.andyparkins@gmail.com","threadId":"7366","inReplyTo":"874poc88ix.fsf@rho.meyering.net","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-03-23T12:58:31Z","receivedAt":"2007-03-23T12:58:31Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2007 March 23 12:11, Jim Meyering wrote:\n> This change adds a new, required, config variable: hooks.envelopesender,\n> and use that with sendmail's -f option.  This is important in order\n> to avoid relying on sendmail's \"guess\" at an appropriate envelope\n> sender address.  Without this, and in the presence of strict servers,\n> it is far too easy not ever to be notified, or (more insidious) never\n> to receive bounce email.\n\nWon't work.\n\n>From \"man sendmail\" (although my sendmail is actually exim)\n\n\"Set  the address of the sender of a locally-generated message. This option \ncan normally be used only by root or the Exim user or by one of the con-              \nfigured trusted users. However, anyone may use it when testing a filter file \nwith -bf or when testing or verifying addresses using the -bt  or  -bv\noptions.  In  other  cases, the sender of a local message is always set up as \nthe user who ran the exim command, and -f is ignored, with one exception.\"\n\nThe hook scripts run under the identity of the user doing the push; so \"-f\" \nwon't have an effect.\n\nI'm not sure why you would even need it; as the above quote says, the sender \nis set up as the user who ran the command.\n\nI've only tested this with exim; perhaps it's different for other mailers.\n\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"37808","messageId":"87wt186qcd.fsf@rho.meyering.net","threadId":"7366","inReplyTo":"200703231258.34339.andyparkins@gmail.com","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-03-23T13:29:06Z","receivedAt":"2007-03-23T13:29:06Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> wrote:\n> On Friday 2007 March 23 12:11, Jim Meyering wrote:\n>> This change adds a new, required, config variable: hooks.envelopesender,\n>> and use that with sendmail's -f option.  This is important in order\n>> to avoid relying on sendmail's \"guess\" at an appropriate envelope\n>> sender address.  Without this, and in the presence of strict servers,\n>> it is far too easy not ever to be notified, or (more insidious) never\n>> to receive bounce email.\n>\n> Won't work.\n\nThanks for the quick feedback.\n\nIt works for me using the sendmail from sendmail, and I have tested\nthis with the one from postfix, too.\n\n>>From \"man sendmail\" (although my sendmail is actually exim)\n...\n> The hook scripts run under the identity of the user doing the push; so \"-f\"\n> won't have an effect.\n\nIt has a dramatic effect for me.\nWith it, mail is sent, without, it's not.\n\n> I'm not sure why you would even need it; as the above quote says, the sender\n> is set up as the user who ran the command.\n\nPart of the problem was that sendmail used a mangled hostname.\nWithout -f, it would use user@foo.domain.com.domain.com.\n\nBut IMHO, relying on the current behavior (using envelope sender same as\nthe From: address) is not an option.  It must be configurable.  I want\nthe envelope sender to be the same admin address for all outgoing mail,\nsince that's where reports of delivery problems are sent.  Besides, the\nusers in question don't even have \"real\" shell or email access on the server\nsystem, so receiving systems would not be able to authenticate them.\n\nIn fact, some of the \"users\" in question are fake accounts used solely\nfor write access (via git-server) to the shared git repository, so the\nuser name exists only on the server system.\n\nIf we can't do this portably via the sendmail program, then\nperhaps it's a good time to switch to using a module like Net::SMTP.\n"},{"id":"37811","messageId":"eu0mmf$hln$2@sea.gmane.org","threadId":"7366","inReplyTo":"87wt186qcd.fsf@rho.meyering.net","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-03-23T14:05:57Z","receivedAt":"2007-03-23T14:05:57Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jim Meyering wrote:\n\n> If we can't do this portably via the sendmail program, then\n> perhaps it's a good time to switch to using a module like Net::SMTP.\n\nPerhaps taking some code from contrib/continuous/\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"37812","messageId":"200703231412.41591.andyparkins@gmail.com","threadId":"7366","inReplyTo":"87wt186qcd.fsf@rho.meyering.net","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-03-23T14:12:38Z","receivedAt":"2007-03-23T14:12:38Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2007 March 23 13:29, Jim Meyering wrote:\n\n> It works for me using the sendmail from sendmail, and I have tested\n> this with the one from postfix, too.\n\nIs your user set as a trusted user for sendmail though?  As a normal user \nwouldn't be allowed to do it.\n\n> It has a dramatic effect for me.\n> With it, mail is sent, without, it's not.\n\nOf course - I didn't doubt that it would, otherwise you wouldn't have bothered \nposting your patch :-)  The point is that I don't think it's universally \napplicable.  It's working for you; in your particular situation, but I'm \nguessing that you are set up as a trusted user for sendmail on your system, \nand so it's letting you rewrite the sender address.\n\n> Part of the problem was that sendmail used a mangled hostname.\n> Without -f, it would use user@foo.domain.com.domain.com.\n\nAh right; the fault lies not with the hook script but with your mail set up.  \nI don't know how it would be done with sendmail; but for me, with exim I \nwrite an /etc/email-addresses file which contains:\n\nandyp: andyparkins@gmail.com\n\nThis catches my username \"andyp\" on outgoing emails and rewrites the address \nto my real email \"andyparkins@gmail.com\".  I guess there will be an \nequivalent for other mailers.\n\n> But IMHO, relying on the current behavior (using envelope sender same as\n> the From: address) is not an option.  It must be configurable.  I want\n\nThat's not the current behaviour.  The \"From:\" in the email is set from the \ncommitter information from the revision.  The sender address is set using the \nlocal user account running sendmail; most email systems will ignore \nthe \"From:\" header and let you write what you want.  The sender field, \nhowever is tightly controlled.\n\n> the envelope sender to be the same admin address for all outgoing mail,\n> since that's where reports of delivery problems are sent.  Besides, the\n\nErm: tough.  What you're asking for requires root/trusted privileges on the \nbox for the user sending the email.  If it didn't, what would there be to \nstop any user sending emails that appeared to be from the admin?\n\n> users in question don't even have \"real\" shell or email access on the\n> server system, so receiving systems would not be able to authenticate them.\n\nI'm not sure you've got the right idea about email; the receiving system \ndoesn't have to authenticate the /user/ sending the email (if it did, then \nyou'd need an account on every email server in the world).  It does need to \nauthenticate the sending /machine/ (some ISPs go a bit further than that, and \ndo you're sending emails that you're entitled to, but let's ignore that).  So \nwhatever your email set up is; the box that has the repository must be set so \nthat whomever it routes its mail to trusts it do so.  Most email servers will \nonly accept incoming email for addresses local to itself; for outgoing email \nthey will only relay for a defined set of machines.\n\n> In fact, some of the \"users\" in question are fake accounts used solely\n> for write access (via git-server) to the shared git repository, so the\n> user name exists only on the server system.\n\nThey're not fake accounts then - they really exist on that system.  I'm \nguessing by \"fake\" you mean that their login shell is set to git-shell.  That \ndoesn't stop git-server from running as their UID, and in turn running the \nhook script under their UID.  The difficulty is that those users really are \nsending email - if your system is set so that they're not allowed to then the \nact of using git shouldn't magically give them that permission.\n\n> If we can't do this portably via the sendmail program, then\n> perhaps it's a good time to switch to using a module like Net::SMTP.\n\nI don't think that's the right solution either.  That's just making the hook \nscript be a mail transfer agent itself, and so it would then connect to your \nreceiving server directly.  That implies that it would have to be able to \nsolve all the problems that a real MTA solves itself - I don't think it's the \nright place for that level of functionality.\n\nSo; that was a whole load of negative stuff, here's some suggestions \n(untested):\n * Run the hook script SUID.  Pretty nasty.\n * Configure /etc/passwd so the fake users all map to the same UID; then use\n   that username in /etc/email-addresses (or equivalent) to set up the admin\n   address you want to use.\n * Change your local mail setup to include the fake users as trusted\n\nDoes anyone know how other VCSs solve this problem?  Short of running some \nsort of privileged process I can't think of a way.\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"37820","messageId":"87lkho6ky8.fsf@rho.meyering.net","threadId":"7366","inReplyTo":"200703231412.41591.andyparkins@gmail.com","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-03-23T15:25:35Z","receivedAt":"2007-03-23T15:25:35Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> wrote:\n\n> On Friday 2007 March 23 13:29, Jim Meyering wrote:\n>\n>> It works for me using the sendmail from sendmail, and I have tested\n>> this with the one from postfix, too.\n>\n> Is your user set as a trusted user for sendmail though?\n\nNo.  There is no need for that.\n\n> As a normal user wouldn't be allowed to do it.\n\nYou mean with exim's sendmail?\nsendmail -f alt-envelope-sender works just fine when run by a\nnon-privileged user when it's Sendmail's sendmail or the one from Postfix.\nIt's a shame if it doesn't work with exim's implementation.\n\n>> It has a dramatic effect for me.\n>> With it, mail is sent, without, it's not.\n>\n> Of course - I didn't doubt that it would, otherwise you wouldn't have bothered\n> posting your patch :-)  The point is that I don't think it's universally\n> applicable.  It's working for you; in your particular situation, but I'm\n> guessing that you are set up as a trusted user for sendmail on your system,\n> and so it's letting you rewrite the sender address.\n\nThere is no need to declare a user \"trusted\" for sendmail to allow\nit to use the -f option.\n\n> That's not the current behaviour.  The \"From:\" in the email is set from the\n> committer information from the revision.  The sender address is set using the\n> local user account running sendmail; most email systems will ignore\n> the \"From:\" header and let you write what you want.  The sender field,\n> however is tightly controlled.\n\nThanks for clarifying.  However, in any case, the current behavior\nis too constraining.  I've needed to change it now in two totally\ndifferent environments, so I really doubt that this is an isolated\ncase.  FYI, the first case was to allow commit email to be sent from\nthe GNU coreutils git repository in a vserver on savannah.gnu.org.\nThe second was at work last night.\n\n>> the envelope sender to be the same admin address for all outgoing mail,\n>> since that's where reports of delivery problems are sent.  Besides, the\n>\n> Erm: tough.  What you're asking for requires root/trusted privileges on the\n> box for the user sending the email.\n\nNo.\nAs I tried to make clear, above, for the sendmail programs I use,\nsendmail -f works fine for unprivileged users.\n\n> If it didn't, what would there be to\n> stop any user sending emails that appeared to be from the admin?\n\nNothing.  We've always been able to do that, though when we do,\nwe also get an X-Authentication-Warning header.\n\n>> users in question don't even have \"real\" shell or email access on the\n>> server system, so receiving systems would not be able to authenticate them.\n>\n> I'm not sure you've got the right idea about email; the receiving system\n> doesn't have to authenticate the /user/ sending the email (if it did, then\n\nNot the *final* recipient, of course.\nSome *internal* MX servers are very careful about sender addresses\nin outbound mail, verifying them before forwarding the message on.\n\n...\nThanks for the explanation of how email works, but you may\nassume that I know a little more than the average hacker :-)\n"},{"id":"37825","messageId":"200703231615.28350.andyparkins@gmail.com","threadId":"7366","inReplyTo":"87lkho6ky8.fsf@rho.meyering.net","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-03-23T16:15:26Z","receivedAt":"2007-03-23T16:15:26Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2007 March 23 15:25, Jim Meyering wrote:\n> Andy Parkins <andyparkins@gmail.com> wrote:\n> > On Friday 2007 March 23 13:29, Jim Meyering wrote:\n> >> It works for me using the sendmail from sendmail, and I have tested\n> >> this with the one from postfix, too.\n> >\n> > Is your user set as a trusted user for sendmail though?\n>\n> No.  There is no need for that.\n>\n> > As a normal user wouldn't be allowed to do it.\n>\n> You mean with exim's sendmail?\n> sendmail -f alt-envelope-sender works just fine when run by a\n> non-privileged user when it's Sendmail's sendmail or the one from Postfix.\n> It's a shame if it doesn't work with exim's implementation.\n\nOkay; I went and found a sendmail manpage:\n\n\"-fname       Sets the name of the ``from'' person (i.e., the sender of the\n              mail).  -f can only be used by ``trusted'' users (normally\n              root,  daemon, and network) or if the person you are trying to\n              become is the same as the person you are.\"\n\nSeems the same as exim to me.  Perhaps your distribution sets it up to allow \nif for anyone?\n\n> case.  FYI, the first case was to allow commit email to be sent from\n> the GNU coreutils git repository in a vserver on savannah.gnu.org.\n> The second was at work last night.\n\n> Not the *final* recipient, of course.\n> Some *internal* MX servers are very careful about sender addresses\n> in outbound mail, verifying them before forwarding the message on.\n\nFair enough.\n\n> Thanks for the explanation of how email works, but you may\n> assume that I know a little more than the average hacker :-)\n\nMy apologies; I didn't mean to be patronising - I wrongly assumed you were \njust confused about who was authenticating whom.\n\nSo; in short: I don't have a good answer to offer you, and it seems that \"-f\" \nis working for you.  However, I'm still not convinced that this is the \ncorrect thing to do in the default hook.  My main gripe is still all \nthese \"trusted user\" paragraphs in the MTA manual pages.\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"37873","messageId":"87wt1651bj.fsf@rho.meyering.net","threadId":"7366","inReplyTo":"200703231615.28350.andyparkins@gmail.com","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-03-24T11:27:12Z","receivedAt":"2007-03-24T11:27:12Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"> On Friday 2007 March 23 15:25, Jim Meyering wrote:\n>> Andy Parkins <andyparkins@gmail.com> wrote:\n>> > On Friday 2007 March 23 13:29, Jim Meyering wrote:\n>> >> It works for me using the sendmail from sendmail, and I have tested\n>> >> this with the one from postfix, too.\n>> >\n>> > Is your user set as a trusted user for sendmail though?\n>>\n>> No.  There is no need for that.\n>>\n>> > As a normal user wouldn't be allowed to do it.\n>>\n>> You mean with exim's sendmail?\n>> sendmail -f alt-envelope-sender works just fine when run by a\n>> non-privileged user when it's Sendmail's sendmail or the one from Postfix.\n>> It's a shame if it doesn't work with exim's implementation.\n>\n> Okay; I went and found a sendmail manpage:\n>\n> \"-fname       Sets the name of the ``from'' person (i.e., the sender of the\n>               mail).  -f can only be used by ``trusted'' users (normally\n>               root,  daemon, and network) or if the person you are trying to\n>               become is the same as the person you are.\"\n>\n> Seems the same as exim to me.  Perhaps your distribution sets it up to allow\n> if for anyone?\n\nI suspect that the above is from older documentation.\nAs you'll see in the excerpts below, the \"can only be used\"\nis replaced with \"should...\", to permit using -f in cases like mine.\n\nThe documentation from sendmail-8.11.7/doc/op/op.me says this:\n\n-f addr   The envelope sender address is set to addr.  This\n          address  may  also  be used in the From: header if\n          that header is missing during initial  submission.\n          The envelope sender address is used as the recipi-\n          ent for delivery status notifications and may also\n          appear in a Return-Path: header.\n\nThen, in cf/README, they explain the trusted-users file is solely\nto avoid a warning:\n\nuse_ct_file     Read the file /etc/mail/trusted-users file to get the\n                names of users that will be ``trusted'', that is, able to\n                set their envelope from address using -f without generating\n                a warning message.  The actual filename can be overridden\n                by redefining confCT_FILE.\n\nA quick search found lots like this:\n  http://www.linuxmanpages.com/man8/sendmail.8.php\n\n    -fname\n        Sets the name of the ``from'' person (i.e., the envelope sender of\n        the mail). This address may also be used in the From: header if\n        that header is missing during initial submission. The envelope\n        sender address is used as the recipient for delivery status\n        notifications and may also appear in a Return-Path: header. -f\n        should only be used by ``trusted'' users (normally root, daemon,\n        and network) or if the person you are trying to become is the\n        same as the person you are. Otherwise, an X-Authentication-Warning\n        header will be added to the message.\n\nSo that was classic sendmail (8.11.7).  Here's the description of -f\nfor postfix's sendmail (man sendmail):\n\n       -f sender\n              Set the envelope sender  address.  This  is  the  address  where\n              delivery problems are sent to. With Postfix versions before 2.1,\n              the  Errors-To:  message  header  overrides  the  error   return\n              address.\n\nIn addition, I have tested this by sending myself a message\nvia printf '...' |sendmail -f nobody@nowhere.com -oi -t -v, and\nexamined the headers in the received messages.  The first I sent\nfrom a system running sendmail-8.11.7, the second from one running\nDebian/unstable's Postfix 2.3.8-2.  Both were sent by a \"regular\" (non-root)\nuser, and the envelope sender was the requested \"nobody@nowhere.com\"\nin each case.\n\n> So; in short: I don't have a good answer to offer you, and it seems that \"-f\"\n> is working for you.\n\nYes, it does work for me.  And it would work for anyone with\nsendmail or Postfix.  Whether it works for an exim-based\nsendmail is a question of policy, and the default in Debian-based\nsystems is to allow it:\n\n>From /etc/exim4/conf.d/main/02_exim4-config_options:\n\n  .ifndef MAIN_FORCE_SENDER\n  local_from_check = false\n  local_sender_retain = true\n  untrusted_set_sender = *\n  .endif\n\n> However, I'm still not convinced that this is the\n> correct thing to do in the default hook.  My main gripe is still all\n> these \"trusted user\" paragraphs in the MTA manual pages.\n\nThere is a legitimate need for this functionality, and -f does\nusually work, so how about a compromise:\n\n  Include support for using sendmail's \"-f envelope-sender\" option\n  in the default hook, but enable it only if/when hooks.envelopesender\n  is set in the config file.\n"},{"id":"37875","messageId":"200703241216.48177.andyparkins@gmail.com","threadId":"7366","inReplyTo":"87wt1651bj.fsf@rho.meyering.net","subject":"Re: [PATCH] hooks--update: new, required, config variable: hooks.envelopesender,","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-03-24T12:16:35Z","receivedAt":"2007-03-24T12:16:35Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Saturday 2007, March 24, Jim Meyering wrote:\n\n> There is a legitimate need for this functionality, and -f does\n> usually work, so how about a compromise:\n>\n>   Include support for using sendmail's \"-f envelope-sender\" option\n>   in the default hook, but enable it only if/when\n> hooks.envelopesender is set in the config file.\n\nPerfect.  Now that I can't think of any objection to.  \n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"37893","messageId":"87slbu2z2l.fsf_-_@rho.meyering.net","threadId":"7366","inReplyTo":"200703241216.48177.andyparkins@gmail.com","subject":"[PATCH] hooks--update: new, optional, config variable: hooks.envelopesender","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-03-24T19:58:42Z","receivedAt":"2007-03-24T19:58:42Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"This change adds a new, optional, config variable: hooks.envelopesender.\nWhen set, the \"update\" hook uses its value with sendmail's -f option.\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n templates/hooks--update |   12 +++++++++++-\n 1 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex 1a60773..02e2494 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -12,6 +12,11 @@\n #   This is the list that all pushes will go to; leave it blank to not send\n #   emails frequently.  The log email will list every log entry in full between\n #   the old ref value and the new ref value.\n+# hooks.envelopesender\n+#   Use this email address as the envelope sender (argument to sendmail's\n+#   -f option).  This is not the \"From:\" address.  This can be useful to\n+#   ensure that all delivery problem notifications go to the same, known-\n+#   working address.\n # hooks.announcelist\n #   This is the list that all pushes of annotated tags will go to.  Leave it\n #   blank to just use the mailinglist field.  The announce emails list the\n@@ -52,10 +57,15 @@ fi\n\n # --- Config\n projectdesc=$(cat $GIT_DIR/description)\n+envelope_sender=$(git-repo-config hooks.envelopesender)\n recipients=$(git-repo-config hooks.mailinglist)\n announcerecipients=$(git-repo-config hooks.announcelist)\n allowunannotated=$(git-repo-config --bool hooks.allowunannotated)\n\n+if [ -n \"$envelope_sender\" ]; then\n+\tenvelope_sender_option=\"-f '$envelope_sender'\"\n+fi\n+\n # check for no description\n if [ -z \"$projectdesc\" -o \"$projectdesc\" = \"Unnamed repository; edit this file to name it for gitweb\" ]; then\n \techo \"*** Project description file hasn't been set\" >&2\n@@ -285,7 +295,7 @@ $0 $1 \\\\\n   $3\n EOF\n #) | cat >&2\n-) | /usr/sbin/sendmail -t\n+) | eval /usr/sbin/sendmail $envelope_sender_option -t\n\n # --- Finished\n exit 0\n"}]}