diff --git a/security-tool.sh b/security-tool.sh index c6bc4e7003aa0149c5db584202432f0a88c75a83..75676e0c055213be22236d49b1d63a15e8e2fbfb 100644 --- a/security-tool.sh +++ b/security-tool.sh @@ -662,6 +662,7 @@ function fn_handle_umask() #============================================================================= # Function Name: fn_handle_ln +# Description : delete the content in the specified file # Returns : 0 on success, otherwise on fail #============================================================================= function fn_handle_ln() @@ -675,6 +676,27 @@ function fn_handle_ln() return $? } +#============================================================================= +# Function Name: fn_handle_ufs +# Returns : 0 on success, otherwise on fail +#============================================================================= +function fn_handle_ufs(){ + fn_test_params_num 3 + + file_name=$1 + string=$2 + if [ -n "$3" ];then + string=$2"@"$3 + fi + + if [ -f "$file_name" ] ; then + # 删除文件中的指定字符串 + sed -i "s/$string//g" "$file_name" + fi + + return $? +} + #============================================================================= # Function Name: fn_harden_rootfs @@ -759,6 +781,10 @@ function fn_harden_rootfs() fn_handle_ln "$f3" "$f4" "$f5" status=$? ;; + ufs) + fn_handle_ln "$f3" "$f4" "$f5" + status=$? + ;; *) fn_handle_command "$f2" "$f3" status=$? @@ -861,6 +887,10 @@ IFS=$PRE_IFS fn_handle_ln "$f3" "$f4" "$f5" status=$? ;; + ufs) + fn_handle_ln "$f3" "$f4" "$f5" + status=$? + ;; *) fn_handle_command "$f2" "$f3" status=$? diff --git a/security-tool.spec b/security-tool.spec index 71bb65be73cc0240b5ad1c97969dfc8ff4e36d8e..39b4048fa08101f6ba90eb0e23836f2b9b3fd904 100644 --- a/security-tool.spec +++ b/security-tool.spec @@ -1,7 +1,7 @@ Summary: openEuler Security Tool Name : security-tool Version: 2.0 -Release: 1.51 +Release: 1.52 Source0: %{name}-%{version}.tar.bz2 Source1: security Source2: security.conf @@ -120,6 +120,9 @@ fi %attr(0500,root,root) %{_sbindir}/security-tool.sh %changelog +* Mon May 15 2023 qinzhiben - 2.0-1.52 +- add method of deleting the content in the specified file + * Tue Dec 27 2022 zhengxiaoxiao - 2.0-1.51 - add requires findutils