블로그 이미지
공부하는 것을 정리해서 올려둔 블로그입니다.
신사과

Notice

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
  • 389,050total
  • 17today
  • 19yesterday
2018.05.09 05:04 프로그래밍/스크립트
[주요통신기반시설] 1.2~4 패스워드 보안 설정





쉘 스크립트 소스



#!/bin/bash


######## 1.2 password ##########


max_days=`grep "^PASS_MAX_DAYS" /etc/login.defs | awk '{print $2}'`

min_days=`grep "^PASS_MAX_DAYS" /etc/login.defs | awk '{print $2}'`

min_len=`grep "^PASS_MIN_LEN" /etc/login.defs | awk '{print $2}'`


echo "Max days " $max_days

echo "Min days " $min_days

echo "Min len  " $min_len



####### 1.3 passowrd ###########


password_deny=`grep deny= /etc/pam.d/system-auth | awk '{print $4}' | awk -F = '{print $2}'`


if [ -z  "`grep deny= /etc/pam.d/system-auth`" ];

then

echo "Danger_no login deny time" 2>&1

else

echo "Deny time : "$password_deny " in Login" 2>&1

fi



##### 1.4 password_protect ###########


if [ -z "cat /etc/passwd | grep root | awk -F: '{print $2}' | sed -n '1p' = x" ];

then

echo "Danger"


else

if test -r /etc/shadow

then

echo "shadow file Ok!"

else

echo "No shadow File Danger!!"


fi

fi





posted by 신사과

댓글을 달아 주세요