This script needs to be run while image is being created or updated.
(After in-house applications are installed.)
We could consider it to be run in security-config service, but it will
increase the 1st boot time.
Change-Id: I5a11dd720ea46ae69b1acc6be09305c74fb39292
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/set_capability DESTINATION /usr/share/security-config)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/mdm_blacklist DESTINATION /usr/share/security-config)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/update_privacy_mount_list.sh DESTINATION /usr/share/security-config)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/change_permission DESTINATION /usr/share/security-config)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/security-config.conf DESTINATION /usr/lib/tmpfiles.d/)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/90_user-content-permissions.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/91_user-dbspace-permissions.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d)
--- /dev/null
+#!/bin/bash
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# Requested by sooyeon.kim@samsung.com (.voice) and dalton.lee@samsung.com (.multiassistant)
+dir_list=(".voice" ".multiassistant")
+for item in "${dir_list[@]}"
+do
+ if [ -e "/etc/skel/share/$item" ]
+ then
+ find /etc/skel/share/$item -print0 | xargs -0 chown app_fw:app_fw
+ find /etc/skel/share/$item -print0 | xargs -0 chsmack -a 'User::App::Shared'
+ find /etc/skel/share/$item -type d -print0 | xargs -0 chsmack -t
+ fi
+
+ for line in `find /opt/usr/home -maxdepth 1 -type d`
+ do
+ if [ -e "$line/share/$item" ]; then
+ user=$(echo $line | cut -d"/" -f5)
+ if getent passwd $user
+ then
+ find "$line/share/$item" -print0 | xargs -0 chown $user:users
+ find "$line/share/$item" -print0 | xargs -0 chsmack -a 'User::App::Shared'
+ find "$line/share/$item" -type d -print0 | xargs -0 chsmack -t
+ fi
+ fi
+ done
+done
+
+# change permission to /opt/var/lib/misc
+# This is needed to retrieve CAP_DAC_OVERRIDE from mobileap-agent & dnsmasq.
+if [ -e /opt/var/lib/misc ]
+then
+ chown root:system_share /opt/var/lib/misc
+ chmod 0775 /opt/var/lib/misc
+fi
fi
-# TODO: MOVE TO OTHER SCRIPT OR REMOVE
-# Requested by sooyeon.kim@samsung.com (.voice) and dalton.lee@samsung.com (.multiassistant)
-dir_list=(".voice" ".multiassistant")
-for item in "${dir_list[@]}"
-do
- if [ -e "/etc/skel/share/$item" ]
- then
- find /etc/skel/share/$item -print0 | xargs -0 chown app_fw:app_fw
- find /etc/skel/share/$item -print0 | xargs -0 chsmack -a 'User::App::Shared'
- find /etc/skel/share/$item -type d -print0 | xargs -0 chsmack -t
- fi
-
- for line in `find /opt/usr/home -maxdepth 1 -type d`
- do
- if [ -e "$line/share/$item" ]; then
- user=$(echo $line | cut -d"/" -f5);
- find "$line/share/$item" -print0 | xargs -0 chown $user:users
- find "$line/share/$item" -print0 | xargs -0 chsmack -a 'User::App::Shared'
- find "$line/share/$item" -type d -print0 | xargs -0 chsmack -t
- fi
- done
-done
-
-# change permission to /opt/var/lib/misc
-# This is needed to retrieve CAP_DAC_OVERRIDE from mobileap-agent & dnsmasq.
-if [ -e /opt/var/lib/misc ]
-then
- chown root:system_share /opt/var/lib/misc
- chmod 0775 /opt/var/lib/misc
-fi
-
-# This is not related with the capability, but place here to run in generic-security.post
+# These are not related with the capability, but place here to run in generic-security.post
# It would be better to run this separately in generic-security.post future.
+/usr/share/security-config/change_permission
if [ -e /usr/share/security-config/update_privacy_mount_list.sh ] && [ -e /usr/share/security-manager/policy/privilege-mount.list ] && [ ! -e /opt/share/askuser_disable ]
then
/usr/share/security-config/update_privacy_mount_list.sh
%attr(755,root,root) /usr/share/security-config/set_label
%attr(755,root,root) /usr/share/security-config/set_capability
%attr(755,root,root) /usr/share/security-config/mdm_blacklist
+%attr(755,root,root) /usr/share/security-config/change_permission
%attr(700,root,root) /usr/share/security-config/update_privacy_mount_list.sh
%attr(644,root,root) /usr/lib/tmpfiles.d/security-config.conf
%attr(755,root,root) %{SECURITY_TEST_DIR}/image_test.sh
. /etc/tizen-platform.conf
# Init security-configuration
-/usr/share/security-config/group_id_setting
/usr/share/security-config/set_label
-/usr/share/security-config/set_capability
+/usr/share/security-config/change_permission
+
+# Delete a flag file to run smack_default_labeling
+if [ -e /opt/share/security-config/.smack_pre_labeling ]
+then
+ rm /opt/share/security-config/.smack_pre_labeling
+fi
# Migration of cynara DB
# CYNARA_VERSION=$(rpm -qf /usr/bin/cynara | cut -d "-" -f2)