From owner-freebsd-questions@FreeBSD.ORG Sat Oct 24 09:16:49 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88FF6106566B for ; Sat, 24 Oct 2009 09:16:49 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0D68FC18 for ; Sat, 24 Oct 2009 09:16:48 +0000 (UTC) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n9O9GgNq042352; Sat, 24 Oct 2009 10:16:43 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n9O9GgNq042352 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1256375803; bh=xhrCOMdRL364yf8fyr/7k3jyMQshMyAIDz9QbC+dvbc=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4AE2C5F4.20109@infracaninophile.co.uk>|Date:=20Sat ,=2024=20Oct=202009=2010:16:36=20+0100|From:=20Matthew=20Seaman=20 |Organization:=20Infracaninophile |User-Agent:=20Thunderbird=202.0.0.23=20(X11/20090823)|MIME-Versio n:=201.0|To:=20Kelly=20Martin=20|CC:=20Free BSD=20Questions=20|Subject:=20Re:=2 0changing=20cron's=20From:=20address=20in=20emails|References:=20< 1338880b0910240008h5d5e7846q8ccf184728d9e036@mail.gmail.com>|In-Re ply-To:=20<1338880b0910240008h5d5e7846q8ccf184728d9e036@mail.gmail .com>|X-Enigmail-Version:=200.95.6|Content-Type:=20multipart/signe d=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp- signature"=3B=0D=0A=20boundary=3D"------------enigF5F4C721D6A84281 256A3C65"; b=WfJTOPNIFa+YWbsxoiF0pjC1SF40yCDP3xKcRYgo18RJW2hnpCFyRrmw3zW7l+Ztq GawNWE+X+hyvKbI3pUUM+rYm8wCp7/6fHqrlSQitRj2JVjZEI/FivqPlboeifddiTl IPh2vP2aHRVgx8O4pkkacRriPiUBa4QYUc1pQedI= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4AE2C5F4.20109@infracaninophile.co.uk> Date: Sat, 24 Oct 2009 10:16:36 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Kelly Martin References: <1338880b0910240008h5d5e7846q8ccf184728d9e036@mail.gmail.com> In-Reply-To: <1338880b0910240008h5d5e7846q8ccf184728d9e036@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigF5F4C721D6A84281256A3C65" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: FreeBSD Questions Subject: Re: changing cron's From: address in emails X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Oct 2009 09:16:49 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF5F4C721D6A84281256A3C65 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Kelly Martin wrote: > Greetings, here's a simple question for the FreeBSD gurus out there. I > have several servers running cron scripts daily for me, and they all > send me e-mail with their output. Regardless of which server it is, > each of these e-mails have the From: address looking exactly the same. > They all say they are from the "Cron Daemon". Fine, but I'd like to > know more clearly which server the cron output is from. >=20 > How can I change the From: address of these emails to "Myserver Cron > Daemon" instead? I know cron runs as the user, so it's not immediately > obvious to me how to change the From: field. Already the subject line > says something like "Cron ..." but this doesn't stand > out enough for my tired eyes. Hmmm... that's actually quite tricky. There's no facility within cron(8) for changing the address it sends /from/, and as the bit you want to change is technically a comment on the From: line, and not the actual sender address (the bit in the ) all the address rewriting-fu in sendmail won't really help. Besides, root@... is listed as a member of the 'Exposed User' class: that is, addresses that should be exempt from address rewriting, so you'ld also have to modify that. Do you control the mail server where you read your e-mail? Can you use eg. procmail(1) as a delivery agent? You should be able to match e-mails= from Cron and rewrite headers, or deliver cron e-mails into per-machine mailboxes. Something like this: :0 h * From:.*Cron &1 | /usr/sbin/sendmail -oi -t echo "From: Sender Name echo "To: echo "Subject: e-mail from cron job" echo "" Then everything you print out in the script will be captured as the body of the e-mail and sent to the specified recipient. You might get some=20 warnings about forgery in the mail headers if the userid the script runs as is not the same as the 'From:' address. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigF5F4C721D6A84281256A3C65 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkrixfoACgkQ8Mjk52CukIzcbgCfftS2TJdmxZmk13UmF6c4Qydl Gh8An2JbP9562n+KzVPAnk4td+JmYCsA =l97P -----END PGP SIGNATURE----- --------------enigF5F4C721D6A84281256A3C65--