summaryrefslogtreecommitdiff
path: root/sysui
diff options
context:
space:
mode:
authorRene Engelhard <rene@debian.org>2018-06-13 21:37:12 +0200
committerRene Engelhard <rene@debian.org>2018-08-10 09:09:43 +0200
commitd0841a1828dad5d9aa1ce92b234092e9b1180d31 (patch)
treec7d7014748c4bd6b6fd0248d403fe8b0af257c4f /sysui
parent2963e0c69949c2c5d0c57a1960ac0406edfc2311 (diff)
test apparmor profile parsing (see tdf#114915)
idea taken from https://salsa.debian.org/apparmor-team/apparmor-profiles-extra/commit/7fbcc4788d0e94764eeeff2f080796601241f986#546c1096cd506dbb01a47ed87a636a8e94d83b8c Change-Id: I7e5bda9224d69530af4d30422c2fd3d60c9929d6 Reviewed-on: https://gerrit.libreoffice.org/55770 Tested-by: Jenkins Tested-by: Rene Engelhard <rene@debian.org> Reviewed-by: Olivier Tilloy <olivier.tilloy@canonical.com> Reviewed-by: Rene Engelhard <rene@debian.org>
Diffstat (limited to 'sysui')
-rwxr-xr-xsysui/desktop/share/apparmor.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/sysui/desktop/share/apparmor.sh b/sysui/desktop/share/apparmor.sh
index 253fe87cf78d..c801f0f3b217 100755
--- a/sysui/desktop/share/apparmor.sh
+++ b/sysui/desktop/share/apparmor.sh
@@ -19,16 +19,17 @@ INST_ROOT=$1 #Where libreoffice program folder can be found
PROFILESFROM=$2 #Where the profile files are
INSTALLTO=$3 #Where should the apparmor profiles (For manual use should be /etc/apparmor.d)
RESTART=$4 #Should we restart apparmor using service?
+CHECK=$5 #Check parsing of the new profile?
#Example uses:
#Ubuntu 16.04 with stock LibreOffice:
-# sudo ./sysui/desktop/share/apparmor.sh /usr/lib/libreoffice/ sysui/desktop/apparmor/ /etc/apparmor.d/ true
+# sudo ./sysui/desktop/share/apparmor.sh /usr/lib/libreoffice/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true
#Ubuntu 16.04, with built debs from LibreOffice git
-# sudo ./sysui/desktop/share/apparmor.sh /opt/libreofficedev5.2/ sysui/desktop/apparmor/ /etc/apparmor.d/ true
+# sudo ./sysui/desktop/share/apparmor.sh /opt/libreofficedev5.2/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true
#Ubuntu 16.04, running from git!
-# sudo ./sysui/desktop/share/apparmor.sh /mnt/store/git/libo/instdir/ sysui/desktop/apparmor/ /etc/apparmor.d/ true
+# sudo ./sysui/desktop/share/apparmor.sh /mnt/store/git/libo/instdir/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true
#Need to convert / to . for profile names
INST_ROOT_FORMAT=${INST_ROOT/\//}
@@ -43,7 +44,11 @@ do
tourl=$INSTALLTO$INST_ROOT_FORMAT${filename##*/}
sed "s/INSTDIR-/$INST_ROOT_SED/g" "$filename" > "$tourl"
echo "$tourl"
-
+ if [ "$CHECK" = "true" ]; then
+ # check profile parsing
+ echo "Checking $tourl profile."
+ /sbin/apparmor_parser --add --skip-cache --skip-kernel-load $tourl
+ fi
done
if [ "$RESTART" = true ] ; then