From: Mateusz Moscicki Date: Thu, 27 Apr 2023 11:14:41 +0000 (+0200) Subject: Check services in ISU directories X-Git-Tag: accepted/tizen/7.0/unified/20231213.120717~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96e1f126dc18cc146d2b05a89e2b4d3cfbb95010;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 (cherry picked from commit fb0d6f178adf203296cb2d71c7caec8efdb05c20) --- diff --git a/test/new_service_test/check_systemd_service.sh b/test/new_service_test/check_systemd_service.sh index b0f1ea3..32c18df 100755 --- a/test/new_service_test/check_systemd_service.sh +++ b/test/new_service_test/check_systemd_service.sh @@ -49,7 +49,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 1123370..877fe08 100644 --- a/test/new_service_test/check_systemd_socket.sh +++ b/test/new_service_test/check_systemd_socket.sh @@ -68,13 +68,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 f6b91ad..e040c70 100644 --- a/test/new_service_test/systemd_test_util +++ b/test/new_service_test/systemd_test_util @@ -11,6 +11,10 @@ systemd_service_list_csv="$cur_dir/systemd_service.csv" systemd_socket_list_csv="$cur_dir/systemd_socket.csv" systemd_service_list="$cur_dir/systemd_service.list" systemd_socket_list="$cur_dir/systemd_socket.list" +# 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