2018-01-10

CentOS 7 Security Check List (CentOS 7 보안점검)

CentOS 7 보안점검 체크리스트 수행

1.1. login 설정: 패스워드 없는 계정 login 미허용
more /etc/passwd 그리고 more /etc/shawdow
1.2. root 이외의 UID가 0인 계정 존재여부 확인: UID가 0인 계정 미사용
vi /etc/passwd or cat /etc/passwd
1.3. 불필요한 계정 존재 여부 확인: lp, uucp, nuucp 계정 삭제
cat /etc/passwd | grep lp
cat /etc/passwd | grep uucp
cat /etc/passwd | grep nuucp
ex> userdel lp
1.4 Shell 제한: daemon, bin, sys, adm, listen, nobody, nobody4, noaccess 계정 /bin/false 또는 /bin/nologin 설정
vi /etc/passwd
1.5. "passwd" file 권한 설정: 644
ls -al /etc/passwd
chmod 644 /etc/passwd
1.6. "group" file 권한 설정: 644
ls -al /etc/passwd
chmod 644 /etc/group
1.7. "shadow" file 권한 설정: 600
ls -al /etc/passwd
chmod 600 /etc/shadow
1.8. password 최소 길이 제한 설정: 9자리
vi /etc/security/pwquality.conf
minlen = 9 # Where we require a password length of a minimum of 9 characters
1.9. password 최대 사용기간 설정: max 90일
vi /etc/login.defs
PASS_MAX_DAYS   99999 => 90 ; 90일로 변경
1.10. password 설정 규칙적용: 문자, 숫자, 특수문자
vi /etc/security/pwquality.conf
ucredit = -1 # Where we require a least 1 upper case letter
lcredit = -1 # Where we require at least 1 lower case letter
dcredit = -1 # Where we require at least 1 number
ocredit = -1 # Where we require at least 1 non-alphanumeric character
2.1. 일반사용자의 su 명령어 제한
vi /etc/pam.d/su
#auth required pam_wheel.so use_uid
위의 라인의 주석을 제거하면 wheel 그룹의 사용자만 su 명령어를 실행할 수 있습니다.
2.2. root 계정 ssh 제한
vi /etc/pam.d/sshd
account    required     pam_access.so
위의 라인을 추가하고 아래의 명령어를 실행합니다.
vi /etc/security/access.conf
- : root : ALL
위에 해당하는 내용에 주석을 제거해 줍니다.
2.3. root 계정 ftp 제한
ftp를 사용하지 않음.
2.4. 익명 ftp(anonymous ftp) 제한

2.5. session time 설정
vi /etc/ssh/sshd_config
ClientAliveInterval 600
ClientAliveCountMax 0
vi /etc/profile.d/sessiontimeout.sh
TMOUT=600
export TMOUT=$TMOUT  # 10 minutes

2.6. Remote 명령어 제한: rlogin, rsh, rcp (shell, login, exec) 서비스를 미 사용

3.1. crontab 관련 file 권한 제한: other에 대한 쓰기권한 미부여
ls -al cron*
위의 명령어 실행 후, 모든 파일/디렉토리의 권한을 확인합니다.

3.2. PATH 환경변수 설정: PATH 환경변수에 '.'이나 '::' 항목이 맨 앞 또는 중간에 포함되지 않도록 설정
env 명령어 실행으로 현재 PATH 환경변수 확인

3.3. UMASK 설정: 022이상 설정

vi /etc/profile
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi


3.4. hosts file 권한 설정: other에 대한 쓰기권한 미부여
ls -al /etc/hosts

3.5. inetd.conf file 권한 설정: other에 대한 쓰기권한 미부여
ls -al /etc/inetd.conf
ls -al /etc/xinetd.d
위의 명령어로 해당파일이 있으면 권한을 변경합니다.

3.6. /etc/hosts.equip file 권한 설정: 600

3.7 부팅스크립트 파일권한 설정: other에 대한 쓰기권한 미부여
ls -al /etc/rc.local
ls -al /etc/profile
ls -al /etc/profile.d
ls -al /etc/rc.d

4. 기능관리
4.1. /etc/services file 권한 설정: other에 대한 쓰기권한 미부여
ls -al /etc/services
4.2. 기타 서비스 설정: echo, discard, tftp, finger, nntp, netbios,dgm, ldap, talk 비활성화

4.3. Banner 관리: 시스템 정보 제거
/etc/issue # 콘솔(로컬) 접속시도시 보여줄 메시지파일 (로그인 전)
/etc/issue.net # 원격지에서 접속시도시 보여줄 메시지파일 (로그인 전)
/etc/motd # 로컬접속, 원격접속 모두에 해당하며 로그인 성공 후 뵤여줄 메시지 파일 (로그인 후)
/etc/ssh/sshd_config
Banner /etc/issue.net # 추가해 줍니다.

5.2 su 로그기록 설정: other에 대한 쓰기권한 미부여
vi /etc/rsyslog.conf
authpriv.*                                              /var/log/secure

6.1. Samba 보안 취약성: 서비스 중지 또는 최신버젼 패치 적용

wget https://download.samba.org/pub/samba/stable/samba-4.7.4.tar.gz
tar -xvf samba-4.7.4.tar.gz

6.2. SSH 보안 취약성: 서비스 중지 또는 최신버전 패치 적용

 wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gz
 tar -xvf openssh-7.6p1.tar.gz
 configure -prefix=/usr
 make
 make install


댓글 없음:

댓글 쓰기