]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
MaxUmask: enforce a maximum umask value
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 17 Oct 2017 11:08:31 +0000 (12:08 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 17 Oct 2017 11:08:31 +0000 (12:08 +0100)
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
Osstest/Executive.pm

index 34b5b6d52dab8f9f909ac15e08295f785e66b91d..ceb62ca50bc40be5925997edb64a3db8c20d3c80 100644 (file)
@@ -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 {
index 635e5dde9f9338e76a26c5f4f7abaefaaea3992c..1d706dfd83b1341db25fc1078b1afea9dcb89185 100644 (file)
@@ -108,6 +108,7 @@ augmentconfigdefaults(
     Repos => "$ENV{'HOME'}/repos",
     BisectionRevisonGraphSize => '600x300',
     ExecutiveDbOwningRoleRegexp => 'osstest',
+    MaxUmask => '007',
 );
 
 augmentconfigdefaults(