From owner-svn-src-head@freebsd.org Tue Sep 3 14:06:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCF8BDD19A; Tue, 3 Sep 2019 14:06:55 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7zz44Twz4Q31; Tue, 3 Sep 2019 14:06:55 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id A37801AD84; Tue, 3 Sep 2019 14:06:21 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 76668D8CC; Mon, 15 Apr 2019 19:26:36 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 279B18F752; Mon, 15 Apr 2019 19:26:36 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 16E72D8CA; Mon, 15 Apr 2019 19:26:36 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 91F46D8C7 for ; Mon, 15 Apr 2019 19:26:33 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 310078F74D for ; Mon, 15 Apr 2019 19:26:32 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1555356385; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=RovXHPtX2EBTpHR+WLf/ZLFi7FuhzV61sb3sQzaLE11IsXdSbQGc0U/bOWqF01/Exq42T1jA7VMNI eCsNW8KU3EfJRKrL4f6tezwLrzWYMh941We2gh0NhuuvXss4FTAnOA9X4FcQtHekBkscOLjWozwcU2 IoxdA3/5+2wILS9zJ2to2ZLblof8bzHSyfa0SmFtQaEjAg0kvJALuYnd2HfVJOIUjD6SnYSwkA80NI YsQpzdL4Jj/TusiRjCo6ewB5tCcJ4akE1BZ/2/Lf3WlN1MOhAgfMW/VxFQOyAic7fDVY0p2LCUIjjg ATREhuN3c6gnjEyKPgxZQ7pbCxEaxuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=6BGyUiTjdkbuNqFq/TaItP4XPq3mKjVsS68RHxYHZOU=; b=qMznv9r9SVW0IU5OmFafdOHSxznWd2P1pVh7tN3C8yN2pRGHTsJNFEzvnjqtoHG1XPzWDLKoh3HeA rYyAib82NxNd5IwCGTe8Fd8IxfTEVuY6Bu7H4kBv/ATmg4x7VYiFKU9t7ZpscfvPV+qNDWd2TauVMK aTqH3OYeKRyCPCS+J7OW6YUJ3L6zX9uBs39sm9+/7wLZj9w900CEyIz2Ck/QKuAURDUETVMAuu0uKJ iHhRCRmPtbP1ctUJvO74jOObr+9O5dPypC01l4VOF26Z3TL7OlhespvgmKsa8iZ4Xur6jv+DhVeoAc bZqX/LK95QB9jLdvaYnTSYm96MTsZBw== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=6BGyUiTjdkbuNqFq/TaItP4XPq3mKjVsS68RHxYHZOU=; b=d5+N68dzUowS8eDoNY1j8AptOJfdmCUGfoyf8x/PdYaQyFuoGzq+kbofN77W+tHdrrSxFITpNulko OYGJNy58TB4z2D/9HHer4vQzyRkgGc5NPNlnIgV2hmdSUceaqpvlorJUvJHrIcY7GmZq2vP5UdjtbZ vwURjVF+fQwrDyKTzJoDSZLz1v5Wi8uIxS9q1tyrOLQ5WGghiWtceqkD1OYVb1hSe5rhtzk16pvEtz XjmA32BKw3i0wd0Bew+/o2skc5jSwvVLBZF/IcOT1u7To5Rq5FQ/GpIBX/UZPIBOt7O/WPoiEBdE2T O5NzOg2H1EKJm0mbnQjG9cXa/DsQBzQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 5946b379-5fb4-11e9-908b-352056dbf2de X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 5946b379-5fb4-11e9-908b-352056dbf2de; Mon, 15 Apr 2019 19:26:22 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x3FJQK1h040045; Mon, 15 Apr 2019 13:26:20 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r346252 - in head/usr.sbin/cron: cron crontab From: Ian Lepore To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201904151853.x3FIrSXI019502@repo.freebsd.org> References: <201904151853.x3FIrSXI019502@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 279B18F752 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:57 -0000 X-Original-Date: Mon, 15 Apr 2019 13:26:20 -0600 X-List-Received-Date: Tue, 03 Sep 2019 14:06:57 -0000 On Mon, 2019-04-15 at 18:53 +0000, Kyle Evans wrote: > Author: kevans > Date: Mon Apr 15 18:53:28 2019 > New Revision: 346252 > URL: https://svnweb.freebsd.org/changeset/base/346252 > > Log: > cron(8): Add MAILFROM ability for crontabs > > This changes the sender mail address in a similar fashion to how MAILTO may > change the recipient. The default from address remains unchanged. > > MFC after: 1 week > > Modified: > head/usr.sbin/cron/cron/cron.8 > head/usr.sbin/cron/cron/do_command.c > head/usr.sbin/cron/crontab/crontab.5 > Is this going to allow normal users to spoof the From: using private crontabs? That sounds mildly dangerous. -- Ian > Modified: head/usr.sbin/cron/cron/cron.8 > ===================================================================== > ========= > --- head/usr.sbin/cron/cron/cron.8 Mon Apr 15 18:49:04 2019 (r346 > 251) > +++ head/usr.sbin/cron/cron/cron.8 Mon Apr 15 18:53:28 2019 (r346 > 252) > @@ -17,7 +17,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 19, 2017 > +.Dd April 15, 2019 > .Dt CRON 8 > .Os > .Sh NAME > @@ -79,6 +79,9 @@ commands, any output is mailed to the owner of the > cro > named in the > .Ev MAILTO > environment variable in the crontab, if such exists). > +The from address of this mail may be set with the > +.Ev MAILFROM > +environment variable. > .Pp > Additionally, > .Nm > > Modified: head/usr.sbin/cron/cron/do_command.c > ===================================================================== > ========= > --- head/usr.sbin/cron/cron/do_command.c Mon Apr 15 18:49:04 > 2019 (r346251) > +++ head/usr.sbin/cron/cron/do_command.c Mon Apr 15 18:53:28 > 2019 (r346252) > @@ -93,7 +93,7 @@ child_process(e, u) > { > int stdin_pipe[2], stdout_pipe[2]; > register char *input_data; > - char *usernm, *mailto; > + char *usernm, *mailto, *mailfrom; > int children = 0; > # if defined(LOGIN_CAP) > struct passwd *pwd; > @@ -111,6 +111,7 @@ child_process(e, u) > */ > usernm = env_get("LOGNAME", e->envp); > mailto = env_get("MAILTO", e->envp); > + mailfrom = env_get("MAILFROM", e->envp); > > #ifdef PAM > /* use PAM to see if the user's account is available, > @@ -503,8 +504,12 @@ child_process(e, u) > warn("%s", MAILCMD); > (void) _exit(ERROR_EXIT); > } > - fprintf(mail, "From: Cron Daemon > <%s@%s>\n", > - usernm, hostname); > + if (mailfrom == NULL || *mailfrom == > '\0') > + fprintf(mail, "From: Cron > Daemon <%s@%s>\n", > + usernm, hostname); > + else > + fprintf(mail, "From: Cron > Daemon <%s>\n", > + mailfrom); > fprintf(mail, "To: %s\n", mailto); > fprintf(mail, "Subject: Cron <%s@%s> > %s\n", > usernm, first_word(hostname, > "."), > > Modified: head/usr.sbin/cron/crontab/crontab.5 > ===================================================================== > ========= > --- head/usr.sbin/cron/crontab/crontab.5 Mon Apr 15 18:49:04 > 2019 (r346251) > +++ head/usr.sbin/cron/crontab/crontab.5 Mon Apr 15 18:53:28 > 2019 (r346252) > @@ -17,7 +17,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd June 6, 2018 > +.Dd April 15, 2019 > .Dt CRONTAB 5 > .Os > .Sh NAME > @@ -116,6 +116,9 @@ If > .Ev MAILTO > is defined (and non-empty), mail is > sent to the user so named. > +If > +.Ev MAILFROM > +is defined (and non-empty), its value will be used as the from > address. > .Ev MAILTO > may also be used to direct mail to multiple recipients > by separating recipient users with a comma. >