firewall setting / host deny | |||
| |||
[질문] firewall 에서 외부 login 설정 방법?? ================================================================================= firewall 를 사용 않하면 외부에서 telnet 으로 linux 로접속이 됩니다. 그런데 firewall을 사용 하면 접속이 않됩니다. 설정 하는것좀 알려주세여~ 참고로 제 firewall 올려 놓을께여~ #!/bin/sh # # firewall-masq This script sets up firewall rules for a machine # acting as a masquerading gateway # # Copyright (C) 2000 Roaring Penguin Software Inc. This software may # be distributed under the terms of the GNU General Public License, version # 2 or any later version. # Interface to Internet EXTIF=ppp+ ANY=0.0.0.0/0 ipchains -P input ACCEPT ipchains -P output ACCEPT ipchains -P forward DENY ipchains -F forward ipchains -F input ipchains -F output # Deny TCP and UDP packets to privileged ports ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p udp -j DENY ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p tcp -j DENY # Do masquerading ipchains -A forward -j MASQ echo 1 > /proc/sys/net/ipv4/ip_forward ================================================================================= ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p tcp -j DENY -A input : input 체인에 rule을 add 하겠다는 뜻입니다. -l : rule에 맞는 패킷에 대한 기록을 log 하겠다는 뜻입니다. -i $EXTIF : $EXTIF=ppp+ 로 되어 있으니 ppp0,ppp1,ppp2,ppp3... 등의 장치를 통해 입출력되는 패킷을 갈구겠다는 뜻입니다. -d $ANY : $ANY=0.0.0.0/0 으로 되어 있으니 destination이 어딘가에 상관없이 모든 패킷을 갈구겠다는 뜻입니다. 0:1023 : 포트 0~1023 을 사용해서 들락날락 하는 패킷을 갈구겠다는 뜻입니다. -p tcp : tcp protocol을 이용하는 패킷들을 갈구겠다는 뜻입니다. -j DENY : 위의 rule에 부합되는 모든 패킷을 DENY로 jump시키겠다는 뜻입니다. 모든 패킷들은 input 체인을 거칩니다. 밖에서 안으로 들어오든, 안에서 밖으로 나가든. <- 틀렸습니다. input체인은 들어오는 패킷만 통과합니다. 천사쪼미(조미옥)님의 지적입니다. telnet은 tcp를 이용하고 목적지 주소의 포트 23번을 향해 달립니다. 포트 0~1023 은 각종 프로그램들에게 예약된 포트번호이며, 상대편으로 접속을 했을 경우 이쪽편에서 열리는 포트는 1024 이상의 포트번호가 됩니다. ================================================================================= telnet 같은 데몬을 막으실 거라면 /etc/hosts.deny 에 등록을 하는 것도 좋습니다. howto 문서는 다음 위치에 있습니다. http://kldp.org/Translations/IPCHAINS-HOWTO 그럼 이만. ================================================================================= 예 file. For example: /etc/hosts.allow: ALL: LOCAL @some_netgroup ALL: .foobar.edu EXCEPT terminalserver.foobar.edu The first rule permits access from hosts in the local domain (no `.?in the host name) and from members of the some_netgroup netgroup. The second rule permits access from all hosts in the foobar.edu domain (notice the lead ing dot), with the exception of terminalserver.foobar.edu. MOSTLY OPEN Here, access is granted by default; only explicitly speci fied hosts are refused service. The default policy (access granted) makes the allow file redundant so that it can be omitted. The explicitly non- authorized hosts are listed in the deny file. For example: /etc/hosts.deny: ALL: some.host.name, .some.domain ALL EXCEPT: localhost, .dguardian, .kurapa.com ================================================================================= hosts.deny의 예(telnet의 접근 제한) [habaek@linux /etc]$cat hosts.deny in.telnetd: ALL EXCEPT LOCAL : [habaek@linux /etc]$ hosts.allow의 예(telnet으로 접속할 수 있는 주소) [habaek@linux /etc]$ cat host.allow in.telnetd : 203.249.98. 210.125.178. 203.249.96. [habaek@linux /etc]$ 예) /etc/hosts.deny: ALL: ALL /etc/hosts.allow: ALL: LOCAL @some_netgroup ALL: .foobar.edu EXCEPT test.foobar.edu | |||
| |||
| |||
Login for comment |
OTHER POSTS IN THE SAME CATEGORY 지정날짜에 이미지 보여주기 혹은 감추기 |