telnet

운영자 | 기사입력 2005/02/21 [09:08]
>
필자의 다른기사 보기 인쇄하기 메일로 보내기 글자 크게 글자 작게
telnet
 
운영자   기사입력  2005/02/21 [09:08]

telnet

(수정일 2001년 6월26일 ,오류,오타,질문은 메일로 [email protected])

 
텔넷은 6.2 버젼까지는 inetd 방식으로 작동을 하였으며   리눅스7.0 부터 xinetd 방식을 사용한다.

일반적으로 서버 타입은 standalone 과 inet 방식으로 나누어 지는데
standalone 방식은 웹서버등 사용이 많은 곳에서 사용을 하며
프로그램 실행시 독립적인 프로세스가 실행이 되어 메모리에 상주하고 있으며  
inetd 는 기본 적으로 inetd 서버만 실행되어 있다가 특정 데몬을 요청하면
그제서야 그 프로세스가 실행되는 방식이다.

장단점은 standalone 방식은 응답 속도가 빠르면 있지만 필요없을 때에도 이 프로세스가
실행이 되어서 시스템을 많이 사용하며
inet 은 응답은 stangalone 보다는 느리지만 시스템 사용률이 적다는 장단점이 있다.

 
리눅스 6.2 에서 inetd 설정 파일 

/etc/inetd.conf


#time dgram udp wait root internal
#
# These are standard services.
#
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
# 6.2 버전에서는 ftp standslone 방식으로 대부분 사용한다 그래서 
# ftp 도 막아야 한다.
telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
# 기본적으로 telnet 서버가 작동을 하고 있으며
# 기타 pop3 정도 만 설정을 풀어 주고 나머지는 모두 주석(#) 처리
# 하는 것이 좋다.


inet 재시작

/etc/rc.d/init.d/inet restart



텔넷 접속시 공지 사항 설정


/etc/issue.net

파일을 에 공지 사항을 추가하면 되고 기타
기타 식별 정보


%t - 현재 tty를 보여준다.

%h - 시스템 노드명(FQDN)을 보여준다.

%D - NIS 도메인명을 보여준다.

%d - 현재 시간과 날짜를 보여준다.

%s - 운영체제의 이름을 보여준다.

%m - 기계(하드웨어) 유형을 보여준다.

%r - 운영체제 릴리즈를 보여준다.

%v - 운영체제 버전을 보여준다.




== 접속시


1 - 현재 tty를 보여준다.

aaaaa - 시스템 노드명(FQDN)을 보여준다.

- NIS 도메인명을 보여준다.

11:05 on Saturday, 16 June 2001 - 현재 시간과 날짜를 보여준다.

Linux - 운영체제의 이름을 보여준다.

i686 - 기계(하드웨어) 유형을 보여준다.

2.2.17-8wl2 - 운영체제 릴리즈를 보여준다.

#1 Sun Jan 14 22:01:31 KST 2001 - 운영체제 버전을 보여준다.



기타 재부팅 issue.net 파일은 /etc/redhat-release
이 파일로 변경이 되므로 이 파일도 변경을 하는 것이 좋다.


유저 접속 제한 하기

특정 유저의 접속을 막는 것은 쉘을 없게 하는 것이다.

/etc/passwd 파일에 보면

byun:x:500:500::/home/byun:/bin/bash

맨마지막에 나타나 있는 것이 쉘인데 쉘을 /bin/false
로 변경을 하면 이 유저는 telnet, ftp 접속은 안되면 메일만 접속이 가능하다.

telnet 만 접속을 막고 ftp은 접속 가능

/etc/shells

파일에
/bin/false
을 추가하면 됨
(잘 사용하지 않음)



호스트 접속 제한 하기 (TCP_WRAPER )
(inetd 방식으로 작동하는 데몬만 적용)


/etc/hosts.allow
/etc/hosts.deny

이 두개의 파일을 이용하여 호스트 단위의 접속을 제한 할 수 있다.
기본적 정책은 hosts.deny 에 모든 호스트 접속을 막고
hosts.allow 파일에 접속 할 수 있는 호스트를 등록한다.


hosts.deny

in.telnetd:ALL


hosts.allow
in.telnetd:192.168.0.6






리눅스 7.0 부터는 inet 대신 xinet 을 사용하며 inet 설치 되지 않는다


xinetd 는 inet 보다 좀더 세부적으로 접속 제어 및(ineted +tcpd)

현제(2001.0614) xinetd releases prior to 2.1.8.8p3 and 2.1.8.9pre6 have a bug
에 버그가 있으는 업그레이드 하길 바라면 http://www.xinetd.org/
에서 세부적인 자료와 파일을 다운 받을 수 있다.


* 호스트 단위 접속 제한
* 시간별 접속 제한 기능
* IPv6 지원
* 유저별 접속시 다른 베너 가능
* dos


access control for TCP, UDP and RPC services (the latter ones aren't well supported yet).
access control based on time segments
full logging, either for connection success or failure
efficient containment against Denial of Services (DoS) attacks (attacks which attempt to freeze a machine by saturating its resources) :
limitation on the number of servers of the same type to run at a time
limitation on the total number of servers
limitation on the size of the log files.
binding of a service to a specific interface: this allows you, for instance, to make services available to your private network but not to the outside world.
can be used as a proxy to other systems. Quite useful in combination with ip_masquerading (or Network Address Translation - NAT) in order to reach the internal network.




기본 구조
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}


xinet 에 의해 실행되는 데몬
chkconfig --list
xinetd based services:
amandaidx: 끔
chargen: 끔
chargen-udp: 끔
daytime: 끔
daytime-udp: 끔
echo: 끔
echo-udp: 끔
time: 끔
time-udp: 끔
amidxtape: 끔
comsat: 끔
finger: 켬
imap: 끔
imaps: 끔
ipop2: 끔
ipop3: 켬
pop3s: 끔
eklogin: 끔
gssftp: 끔
klogin: 끔
krb5-telnet: 끔
kshell: 끔
linuxconf-web: 끔
proftpd: 켬
rexec: 끔
rlogin: 켬
rsh: 켬
swat: 끔
ntalk: 끔
talk: 끔
telnet: 켬
tftp: 끔


telnet 사용 안함

/etc/xinetd.conf 
defaults
{
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST RECORD
disabled = telnet
# telnet 사용 안함


includedir /etc/xinetd.d


}
 


/etc/xinetd.d/telnet

service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = yes
# 텔넷 정지
only_from = 192.168.0.1 192.168.0.2
# 접속 호스트 지정 아무 내용이 없으면 모든 호스트 접근을 막는다.
instances = 1
# 동시 접속자 수
access_times =1:00 -1:20 12:00-13:00
# 접속 가능한 시간대

}



xinet 서버 재시작
/etc/rc.d/init.d/xinetd restart

트위터 트위터 페이스북 페이스북 카카오톡 카카오톡
기사입력: 2005/02/21 [09:08]  최종편집: ⓒ iwav
 
 
많이 본 기사