From: Mateusz Moscicki Date: Thu, 27 Apr 2023 11:14:41 +0000 (+0200) Subject: Check services in ISU directories X-Git-Tag: accepted/tizen/6.0/unified/20231215.094401~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db282e727993844baa40a3f9d623d0752c0609c4;p=platform%2Fcore%2Fsecurity%2Fsecurity-config.git Check services in ISU directories This patch adds verification of service files provided under the ISU (Individual Service Upgrade) mechanism. Change-Id: I86afe2cc5c99169c79976298498377a51b3182d6 --- diff --git a/test/new_service_test/check_systemd_service.sh b/test/new_service_test/check_systemd_service.sh index 3e81edc..ab19ed9 100755 --- a/test/new_service_test/check_systemd_service.sh +++ b/test/new_service_test/check_systemd_service.sh @@ -50,7 +50,7 @@ function check_prefix_in_exec # function to find and check service file in systemd directory (system session) function find_system_service { - for line in `find "$system_unit_dir" -type f -name "*service" 2> /dev/null` + for line in `find "$system_unit_dir" $isu_system_unit_dir -type f -name "*service" 2> /dev/null` do uid="$(cat $line | grep "User=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')" gid="$(cat $line | grep "Group=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')" diff --git a/test/new_service_test/check_systemd_socket.sh b/test/new_service_test/check_systemd_socket.sh index c074a61..f37ddc0 100644 --- a/test/new_service_test/check_systemd_socket.sh +++ b/test/new_service_test/check_systemd_socket.sh @@ -69,13 +69,13 @@ function check_multi_socket_case # function to find and check service file in systemd directory function find_system_socket { - for line in `find "$system_unit_dir" -type f -name "*.socket" 2> /dev/null` + for line in `find "$system_unit_dir" $isu_system_unit_dir -type f -name "*.socket" 2> /dev/null` do # check # of [Socket] if [ "$(cat $line | grep '\[Socket\]' | wc -l)" != "1" ] then check_multi_socket_case $line - else + else SocketUser="$(cat $line | grep "SocketUser=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')" SocketGroup="$(cat $line | grep "SocketGroup=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')" SocketMode="$(cat $line | grep "SocketMode=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')" diff --git a/test/new_service_test/systemd_test_util b/test/new_service_test/systemd_test_util index eea3aaa..65d40a0 100644 --- a/test/new_service_test/systemd_test_util +++ b/test/new_service_test/systemd_test_util @@ -7,6 +7,10 @@ cur_dir="/usr/share/security-config/test/new_service_test" not_permitted_unit_path="/opt/share/security-config/not_permitted_service/" system_unit_dir="/usr/lib/systemd/system/" dbus_service_dir="/usr/share/dbus-1/system-services/" +# asterisk represents configuration subdirectories for ISU packages +# their names must directly correspond to the package names +# (e.g., dlog for the dlog package, deviced for the deviced package etc.) +isu_system_unit_dir="/etc/isu/*/system-services/" # function to move service file to another directory. This socket cannot be used. # $1 : file path, $2 : file name