fix problems of script caused by * and multiple spaces

This commit is contained in:
guoxiaoqi 2020-02-19 14:48:54 +08:00
parent 364f27af46
commit 6c0586fc3a
2 changed files with 17 additions and 14 deletions

View File

@ -175,7 +175,7 @@ function fn_exit()
if [ $s -eq 0 ]; then
local new_initrd=$WORKD`basename $GZ_F`".secure"
pushd $ROOTFS
tar -cf "$ROOTFS/$TMPTARGET" *
tar -cf "$ROOTFS/$TMPTARGET" -- *
gzip <"$ROOTFS/$TMPTARGET" > $new_initrd
fn_info "hardened initrd is $new_initrd"
popd
@ -693,7 +693,7 @@ function fn_harden_rootfs()
# do configuration traversal, with comments and lines starting with blankspace ignored
grep -v '^#' $SCONF| grep -v '^$'| grep -Ev '^[[:space:]]+'| while read line
do
f1=`echo $line | awk -F$FIELD_SEP '{print $1}'`
f1=`echo "$line" | awk -F$FIELD_SEP '{print $1}'`
if [ $EXECID -ne 0 ] && [ "$EXECID" -ne "$f1" ];then
continue
fi
@ -731,11 +731,11 @@ function fn_harden_rootfs()
f5=${arr[4]}
f6=${arr[5]}
else
f2=`echo $line | awk -F$FIELD_SEP '{print $2}'`
f3=`echo $line | awk -F$FIELD_SEP '{print $3}'`
f4=`echo $line | awk -F$FIELD_SEP '{print $4}'`
f5=`echo $line | awk -F$FIELD_SEP '{print $5}'`
f6=`echo $line | awk -F$FIELD_SEP '{print $6}'`
f2=`echo "$line" | awk -F$FIELD_SEP '{print $2}'`
f3=`echo "$line" | awk -F$FIELD_SEP '{print $3}'`
f4=`echo "$line" | awk -F$FIELD_SEP '{print $4}'`
f5=`echo "$line" | awk -F$FIELD_SEP '{print $5}'`
f6=`echo "$line" | awk -F$FIELD_SEP '{print $6}'`
fi
case "$f2" in
@ -794,7 +794,7 @@ function fn_harden_usr_conf()
# do configuration traversal, with comments and lines starting with blankspace ignored
grep -v '^#' $USR_SCONF| grep -v '^$'| grep -Ev '^[[:space:]]+'| while read line
do
f1=`echo $line | awk -F$FIELD_SEP '{print $1}'`
f1=`echo "$line" | awk -F$FIELD_SEP '{print $1}'`
if [ $EXECID -ne 0 ] && [ "$EXECID" -ne "$f1" ];then
continue
fi
@ -833,11 +833,11 @@ IFS=$PRE_IFS
f5=${arr[4]}
f6=${arr[5]}
else
f2=`echo $line | awk -F$FIELD_SEP '{print $2}'`
f3=`echo $line | awk -F$FIELD_SEP '{print $3}'`
f4=`echo $line | awk -F$FIELD_SEP '{print $4}'`
f5=`echo $line | awk -F$FIELD_SEP '{print $5}'`
f6=`echo $line | awk -F$FIELD_SEP '{print $6}'`
f2=`echo "$line" | awk -F$FIELD_SEP '{print $2}'`
f3=`echo "$line" | awk -F$FIELD_SEP '{print $3}'`
f4=`echo "$line" | awk -F$FIELD_SEP '{print $4}'`
f5=`echo "$line" | awk -F$FIELD_SEP '{print $5}'`
f6=`echo "$line" | awk -F$FIELD_SEP '{print $6}'`
fi
case "$f2" in

View File

@ -1,7 +1,7 @@
Summary: openEuler Security Tool
Name : security-tool
Version: 2.0
Release: 1.41
Release: 1.42
Source0: %{name}-%{version}.tar.bz2
Source1: security
Source2: security.conf
@ -124,6 +124,9 @@ fi
%attr(0500,root,root) %{_sbindir}/security-tool.sh
%changelog
* Wed Jan 22 2020 openEuler Buildteam <buildteam@openEuler.org> - 2.0-1.41
- Fix problems of script caused by "*" and multiple spaces
* Wed Jan 22 2020 openEuler Buildteam <buildteam@openEuler.org> - 2.0-1.41
- Fix the problem of dbus-daemon-launch-helper's group