From owner-svn-src-head@freebsd.org Tue Aug 21 23:12:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADB4710826DE; Tue, 21 Aug 2018 23:12:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 616FE73170; Tue, 21 Aug 2018 23:12:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4270D2A1D; Tue, 21 Aug 2018 23:12:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7LNClPw036011; Tue, 21 Aug 2018 23:12:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7LNCkvO036009; Tue, 21 Aug 2018 23:12:46 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201808212312.w7LNCkvO036009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 21 Aug 2018 23:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338165 - head/usr.sbin/newsyslog X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.sbin/newsyslog X-SVN-Commit-Revision: 338165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Aug 2018 23:12:47 -0000 Author: cem Date: Tue Aug 21 23:12:46 2018 New Revision: 338165 URL: https://svnweb.freebsd.org/changeset/base/338165 Log: newsyslog(8): Reject configurations that specify setuid or executable logs Prevent some classes of foot-shooting that may result in permissions problems. Reviewed by: dab, delphij, vangyzen (earlier version) Relnotes: yes (behavior change) Sponsored by: Dell EMC Isilon Differential Revision: D16831 Modified: head/usr.sbin/newsyslog/newsyslog.c head/usr.sbin/newsyslog/newsyslog.conf.5 Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Tue Aug 21 23:11:26 2018 (r338164) +++ head/usr.sbin/newsyslog/newsyslog.c Tue Aug 21 23:12:46 2018 (r338165) @@ -1193,6 +1193,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl if (!sscanf(q, "%o", &working->permissions)) errx(1, "error in config file; bad permissions:\n%s", errline); + if ((working->permissions & ~DEFFILEMODE) != 0) { + warnx("File mode bits 0%o changed to 0%o in line:\n%s", + working->permissions, + working->permissions & DEFFILEMODE, errline); + working->permissions &= DEFFILEMODE; + } q = parse = missing_field(sob(parse + 1), errline); parse = son(parse); Modified: head/usr.sbin/newsyslog/newsyslog.conf.5 ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.conf.5 Tue Aug 21 23:11:26 2018 (r338164) +++ head/usr.sbin/newsyslog/newsyslog.conf.5 Tue Aug 21 23:12:46 2018 (r338165) @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd January 15, 2018 +.Dd August 21, 2018 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -96,6 +96,11 @@ or .Pa /etc/group . .It Ar mode Specify the file mode of the log file and archives. +Valid mode bits are +.Dv 0666 . +(That is, read and write permissions for the rotated log may be specified for +the owner, group, and others.) +All other mode bits are ignored. .It Ar count Specify the maximum number of archive files which may exist. This does not consider the current log file.