Skip to contentSkip to conversation

MaxUmask: enforce a maximum umask value

PATCH In review Ian Jackson 2 participants 2 messages Oct 17, 2017 – Oct 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MaxUmask: enforce a maximum umask value

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.

---
 Osstest.pm           | 8 ++++++++
 Osstest/Executive.pm | 1 +
 2 files changed, 9 insertions(+)
Osstest.pm +8 -0
index 34b5b6d..ceb62ca 100644
@@ -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 {
Osstest/Executive.pm +1 -0
index 635e5dd..1d706df 100644
@@ -108,6 +108,7 @@ augmentconfigdefaults(
     Repos => "$ENV{'HOME'}/repos",
     BisectionRevisonGraphSize => '600x300',
     ExecutiveDbOwningRoleRegexp => 'osstest',
+    MaxUmask => '007',
 );
 
 augmentconfigdefaults(
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Ian Jackson

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel