[esw1] -포트 미러링
config t
monitor session 1 source interface fastethernet 1/0 - 14
monitor session 1 destination interface fastethernet 1/15
end
show monitor session 1
[r1]
config t
hostname r1
interface fastethernet0/0
ip address 100.100.100.254 255.255.255.0
no shutdown
exit
interface serial1/0
ip address 1.1.1.1 255.255.255.252
no shutdown
router rip
version 2
network 100.100.100.0
network 1.1.1.0
[r2]
config t
hostname r2
interface fastethernet0/0
ip address 125.246.95.254 255.255.255.0
no shutdown
exit
interface serial1/0
ip address 1.1.1.2 255.255.255.252
no shutdown
router rip
version 2
network 125.246.95.0
network 1.1.1.0
[kali]
100.100.100.1 255.255.255.0 100.100.100.254 125.246.95.152(server를 알 수 없으므로 방화벽으로 감)
2. (라우터)
access-list 차단
[r2]
config t
access-list 100 deny icmp host 100.100.100.1 host 125.246.95.152 echo
access-list 100 permit ip any any
interface serial1/0
ip access-group 100 in
exit
exit
< - >
show access-lists
config t
no access-list 100 (차단 해제)
=> 이런 경우 utm 사용자라면 웹으로 통해 접속 가능한지 확인이 가능하다! Bootstrap Example
미션3: 외부에서 UTM에 접속하는 것을 차단해보자!
1. 방화벽에서 차단
    관리 > webadmin> 허용된 네트워크를 any에서 inside (network)로 변경
    => kali에서 125.246.95.152:4444 접속 안됨
2. 라우터에서 차단
    위와 동일
nikto -host st.kr > /var/www/html > var/log/apache2
tail -f access.log (nikto -host 공격이 들어오면 로그가 남는다.)
nikto -host dvwa.st.kr > /home/dvwa/public_html
dvwa.st.kr > /home/dvwa/public_html/logs/access.log
=> 이런 경우 탐지시스템이 없으면 미리 알기 어려우므로 스노트(snort)룰등을 활용하면 좋을 것이다.
Bootstrap Example
2-2. 백업서버에 저장된 공격 로그 확인하기/공격 사용자 ip 차단하기
[3server]
su
apt -y install putty-tools
apt -y install mailutils
apt -y install samba-common smbclient cifs-utils(725p. samba > 리눅스 윈도우 공유 가능)
[win7]
c드라이브에 로그 디렉토리 생성
로그 파일 가져오기
pscp -P 22 master@10.0.2.15:access.log c:\log
    no such file or directory
pscp -P 22 master@10.0.2.15:/var/log/apache2/access.log c:\log
(실행 후 c드라이브에 로그 디렉토리에 access.log 가져와진 것을 확인할 수 있다.
    -> editplus로 열기)
/var/www/html의 경우 index.html만이 존재 하므로 취약성이 낮다.
단, /var/www/html에 로그가 대량 쌓여있으면 scan공격이 들어온 것으로 추정할 수 있다.
=> 공격로그를 확인한 경우 어떻게 해결할까?
1. 관리자에게 알린다
2. 스노트 룰을 이용해 탐지한다
3. 웹페이지에 접근하는 ip를 차단한다!!!
    교재 665p 1-8 응용
cd /etc/apache2/sites-available/hosting.conf
< VirtualHost *:80>
    DocumentRoot /var/www/html
    ServerName st.kr
    ServerAdmin st@st.kr
    Errorlog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined
< /VirtualHost>
< Directory /var/www/html/>
    Options
    AllowOverride
    Order by
    Allow from all
    Deny from 100.100.100.1
< /Directory>