From 5280e0a3ef68935f848aa4092a3172e92bcebf74 Mon Sep 17 00:00:00 2001 From: Samson-W Date: Fri, 27 Sep 2019 17:19:11 +0800 Subject: [PATCH] Update how_to_creating_and_making_an_AMI_public.mkd and modify bin/hardening.sh --- bin/hardening.sh | 10 +++++----- .../how_to_creating_and_making_an_AMI_public.mkd | 15 ++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/hardening.sh b/bin/hardening.sh index ba72e92..6635e1f 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -211,16 +211,16 @@ if [ $FINAL_G_CONFIG -eq 1 ]; then USERSNAME=$(cat /etc/passwd | awk -F':' '{if($3>=1000 && $3<65534) {print $1}}') for USER in $USERSNAME; do RESETCONTIN="n" - read -p "Will password of $USER be reset, are you sure to continue?(Y/n)" RESETCONTIN - if [ "$RESETCONTIN" == "Y" ]; then - sudo -u $USER passwd + read -p "Will password of $USER be reset, are you sure to continue?(y/N)" RESETCONTIN + if [ "$RESETCONTIN" == "y" ]; then + passwd $USER else continue fi done RESETCONTIN="n" - read -p "Will password of root be reset, are you sure to continue?(Y/n)" RESETCONTIN - if [ "$RESETCONTIN" == "Y" ]; then + read -p "Will password of root be reset, are you sure to continue?(y/N)" RESETCONTIN + if [ "$RESETCONTIN" == "y" ]; then passwd fi diff --git a/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd b/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd index 4476cfc..3fed1ae 100644 --- a/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd +++ b/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd @@ -89,7 +89,6 @@ admin@ip:/opt/harbian-audit-master$ sudo reboot ##### Third apply(after reboot) Apply need to apply three times items: ``` -admin@ip:/opt/harbian-audit-master$ sudo ./bin/hardening.sh --apply --only 4.5 admin@ip:/opt/harbian-audit-master$ sudo sed -i 's/^status=.*/status=enabled/' etc/conf.d/8.4.1_install_aide.cfg admin@ip:/opt/harbian-audit-master$ sudo sed -i 's/^status=.*/status=enabled/' etc/conf.d/8.4.2_aide_cron.cfg admin@ip:/opt/harbian-audit-master$ sudo ./bin/hardening.sh --apply --only 8.4.1 @@ -116,14 +115,9 @@ $ sudo rm /opt/harbian-audit-master/tmp/backups/* $ sudo rm /opt/harbian-audit-master/etc/conf.d/*.cfg ``` -#### Final apply -Reset password for all users and reinit aide database: -``` -admin@ip:/opt/harbian-audit-master$ sudo ./bin/hardening.sh --final -``` #### Uninstall ``` -$ sudo apt-get purge --autoremove unzip +$ sudo apt-get purge --autoremove unzip -y ``` #### Clear the current log: @@ -145,6 +139,13 @@ $ sudo -s # echo > /var/log/tallylog # echo > /var/log/lastlog # echo > /var/log/wtmp +# echo > /var/log/sudo.log +``` + +#### Final apply +Reset password for all users and reinit aide database: +``` +admin@ip:/opt/harbian-audit-master$ sudo ./bin/hardening.sh --final ``` #### Clear bash hostory