Enforce separation of users using UMASK 52/21652/13
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 11 Jun 2019 10:17:04 +0000 (12:17 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Wed, 19 Jun 2019 13:05:28 +0000 (13:05 +0000)
Users should not be able to read other user content.
Use Umask to enforce that.

Bug-AGL: SPEC-1016

Change-Id: Ibb61b7a6a7617117a499650c5bd70bdd5af3c328
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
meta-app-framework/recipes-core/base-files/base-files_%.bbappend
meta-app-framework/recipes-core/shadow/shadow_%.bbappend [new file with mode: 0644]

index 536ce80..1dddcd6 100644 (file)
@@ -2,8 +2,10 @@ RDEPENDS_${PN}_append_with-lsm-smack = " smack"
 PACKAGE_WRITE_DEPS_append_with-lsm-smack = " smack-native"
 
 do_install_append() {
-    install -d ${D}/${sysconfdir}/skel/app-data
-    install -d ${D}/${sysconfdir}/skel/.config
+    install -m 0700 -d ${D}/${sysconfdir}/skel
+    chmod -R 0700 ${D}/${sysconfdir}/skel
+    install -m 0700 -d ${D}/${sysconfdir}/skel/app-data
+    install -m 0700 -d ${D}/${sysconfdir}/skel/.config
     install -m 0755 -d ${D}/var
     if [ -d ${D}/usr/local ]; then
         mv ${D}/usr/local ${D}/var
diff --git a/meta-app-framework/recipes-core/shadow/shadow_%.bbappend b/meta-app-framework/recipes-core/shadow/shadow_%.bbappend
new file mode 100644 (file)
index 0000000..4f594d4
--- /dev/null
@@ -0,0 +1,6 @@
+
+do_install_append() {
+       sed -i '/^UMASK/s:^.*$:UMASK 077:' ${D}${sysconfdir}/login.defs
+}
+
+