%attr(755,root,root) /opt/share/security-config/test/path_check_test/*
%attr(755,root,root) /opt/share/security-config/test/smack_basic_test/*
%attr(755,root,root) /opt/share/security-config/test/security_mount_option_test/*
+%attr(755,root,root) /opt/share/security-config/test/relro_stack_canary_test/*
%attr(755,root,root) /usr/share/upgrade/scripts/201.security_upgrade.sh
%attr(755,root,root) %{_sysconfdir}/gumd/useradd.d/90_user-content-permissions.post
%attr(755,root,root) %{_sysconfdir}/gumd/useradd.d/91_user-dbspace-permissions.post
--- /dev/null
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+utl_path="/opt/share/security-config/test/utils"
+relro_result_file="/opt/share/security-config/result/new_service.result"
+stack_canary_result_file="/opt/share/security-config/result/new_service.result"
+relro_log_file="/opt/share/security-config/log/relro.log"
+stack_canary_log_file="/opt/share/security-config/log/stack_canary.log"
+tmp_file="/opt/share/security-config/log/tmp_file"
+
+# Clean log files
+if [ -e "$relro_log_file" ]
+then
+ rm $relro_log_file
+fi
+
+if [ -e "$stack_canary_log_file" ]
+then
+ rm $stack_canary_log_file
+fi
+
+# Rename file util
+file_cmd=`find $utl_path -name file.*`
+if [ "$file_cmd" != "" ]; then
+ /bin/mv $file_cmd $utl_path/file
+fi
+
+# Rename readelf util
+readelf_cmd=`find $utl_path -name readelf.*`
+if [ "$readelf_cmd" != "" ]; then
+ /bin/mv $readelf_cmd $utl_path/readelf
+fi
+
+# Filter ELF executables and pass those to readelf
+/usr/bin/find /usr /etc /opt -type f -executable 2>/dev/null | xargs $utl_path/readelf -ls 2>&1 | grep -e "GNU_RELRO" -e "__stack_chk_fail" -e "File:" -e "Error:" > $tmp_file
+echo "File: Dummy" >> $tmp_file
+
+last_file_path=""
+relro_check=true
+stack_canary_check=true
+while read line
+do
+ if [[ "$line" == *"File:"* ]] # If it is file...
+ then
+ if [ $relro_check = false ] # check relro was OK in the previous file
+ then
+ echo $last_file_path >> $relro_log_file
+ fi
+ if [ $stack_canary_check = false ] # check stack canary was OK in the previous file
+ then
+ echo $last_file_path >> $stack_canary_log_file
+ fi
+ last_file_path=$line
+ relro_check=false
+ stack_canary_check=false
+ elif [[ "$line" == *"GNU_RELRO"* ]] # If it is relro...
+ then
+ relro_check=true
+ elif [[ "$line" == *"__stack_chk_fail"* ]] # If it is stack_canary...
+ then
+ stack_canary_check=true
+ elif [[ "$line" == *"Error"* ]]
+ then
+ relro_check=true
+ stack_canary_check=true
+ fi
+done < $tmp_file
+
+rm $tmp_file
+
+if [ ! -e $relro_log_file ]
+then
+ echo "YES" > $relro_result_file
+else
+ echo "NO" > $relro_result_file
+fi
+
+if [ ! -e $stack_canary_log_file ]
+then
+ echo "YES" > $stack_canary_result_file
+else
+ echo "NO" > $stack_canary_result_file
+fi