xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH] MaxUmask: enforce a maximum umask value
Date: Tue, 17 Oct 2017 12:10:38 +0100	[thread overview]
Message-ID: <1508238638-2599-1-git-send-email-ian.jackson@eu.citrix.com> (raw)

On some operating systems, the default umask is not 002 as it should
be (for the sensible setup with personal groups).

If a user with an 022 or 077 umask invokes osstest in Executive mode,
they end up creating directories in $c{Logs} which are writeable only
by them, and that can stop the whole system because the service user
cannot expire them.

Prevent this from happening.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest.pm           | 8 ++++++++
 Osstest/Executive.pm | 1 +
 2 files changed, 9 insertions(+)

diff --git a/Osstest.pm b/Osstest.pm
index 34b5b6d..ceb62ca 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -254,6 +254,14 @@ sub readglobalconfig () {
     }
 
     $c{Stash} //= $c{Logs};
+
+    if ($c{MaxUmask}) {
+	my $bad = umask() & ~oct $c{MaxUmask};
+	die sprintf(
+ "bad umask %03o: contains bits %03o, not permitted by MaxUmask %03o\n",
+		    umask(), $bad, $c{MaxUmask})
+	    if $bad;
+    }
 }
 
 sub augmentconfigdefaults {
diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 635e5dd..1d706df 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -108,6 +108,7 @@ augmentconfigdefaults(
     Repos => "$ENV{'HOME'}/repos",
     BisectionRevisonGraphSize => '600x300',
     ExecutiveDbOwningRoleRegexp => 'osstest',
+    MaxUmask => '007',
 );
 
 augmentconfigdefaults(
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-10-17 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 11:10 Ian Jackson [this message]
2017-10-18 12:03 ` [OSSTEST PATCH] MaxUmask: enforce a maximum umask value Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508238638-2599-1-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).