
win2003 서버 구성

(200.200.200.144의 80번 포트로 들어오면 이리로 보내라.) (2003 웹서버 80번 포트로)
# iptables -t nat -A PREROUTING -d 200.200.200.144 -p tcp --dport 80 -j DNAT --to-destination 10.10.145.30:80

# iptables -t nat -A PREROUTING -d 200.200.200.144 -p tcp --dport 3389 -j DNAT --to-destination 10.10.145.10:3389 (xp주소-원격포트)
이제 윈10에서 200.200.200.144로 원격 접속(mstsc)을 시도하면, xp서버 (10.10.145.10) 으로 연결된다.

# iptables -t nat -A PREROUTING -d 200.200.200.144 -p tcp --dport 22000 -j DNAT --to-destination 10.10.145.20:22 (centOS - ssh포트)

"inven" 문구가 들어간 사이트에 접속이 안되게끔.
# iptables
-t filter
-A FORWARD
-m string --string "inven" --algo kmp
-j DROP

접속 거부된 것을 로그로 보여주기
# iptables -t filter
-I FORWARD 1
-m string --string "inven" --algo kmp
-j LOG --log-prefix "deny inven:"
# cat /var/log/messages

"daum" 접속 안되게 16진수로 해보기.
# iptables
-t filter
-A FORWARD
-m string --hex-string "|6461756D|" --algo kmp
-j DROP
접속 거부된 것을 로그로 보여주기
# iptables -t filter
-I FORWARD 1
-m string --hex-string "|6461756D|" --algo kmp
-j LOG --log-prefix "deny daum:"
# cat /var/log/messages

시나리오>
해당 서버에서 icmp가 분당 5회 이상 탐지되면 12초마다 카운트가 1씩 증가
패킷 1개씩 허용
24초 후에 다시 보내면 2개 허용 가능.
60초 후에 다시 보내면 5개 모두 허용 가능.
# iptables -P INPUT DROP
# iptables -t filter -I INPUT -p icmp -m limit --limit 5/m --limit-burst 5 -j LPG ~~
# iptables -t filter -I INPUT -p icmp -m limit --limit 5/m --limit-burst 5 -j ACCEPT ~~
해당 서버에서 icmp 가 분당 5회 이상 탐지되면 12초마다 카운트가 1씩 증가
패킷 1개씩 거부
24초 후에 2개 거부 60초 후에는 5개 모두 거부
# iptables -P INPUT ACCEPT
# iptables -t filter -I INPUT -p icmp -m limit --limit 5/m --limit-burst 5 -j LOG ~~
# iptables -t filter -I INPUT -p icmp -m limit --limit 5/m --limit-burst 5 -j DROP
SSH 접속 3개 이상 못하게 막기
# iptables -t filter -A INPUT -d 200.200.200.145 -p tcp --dport 22 -m connlimit --connlimit-above 3 -j DROP
'INFOSEC > LINUX' 카테고리의 다른 글
shell (0) | 2019.10.16 |
---|---|
DNS - linux (0) | 2019.10.14 |
iptables 실습 - linux router 이용 (0) | 2019.10.11 |
iptables (0) | 2019.10.10 |
DHCP - Relay Agent ( Helper Address ) (0) | 2019.09.30 |