xinetd란

-> inetd가 관리하는 포트에 접속 요청이 들어오면 inetd는  tcpd 프로그램에 요청을 넘기고 tcpd는 hosts.{allow|deny} 파일 규칙에 따라 허락여부를 결정.

    허락된 요청에 대해 서버 프로세스가 시작된다.


쉽게말해 대회 때 nc나 클라이언트측 소켓 짤때 서버측 소켓 짤 필요없이 xinetd가 서버에서 통신해줌.



apt-get install xinetd


세팅


vi /etc/xinetd.conf



# Simple configuration file for xinetd

#

# Some defaults, and include /etc/xinetd.d/


defaults

{


# Please note that you need a log_type line to be able to use log_on_success

# and log_on_failure. The default is the following :

# log_type = SYSLOG daemon info


}

#Telnet Setting


service telnet{

        disable=no

        flag= REUSE

        socket_type=stream

        wait=no

        user=root

        server=/usr/sbin/in.telnetd

        log_on_failure+=USERID

}


includedir /etc/xinetd.d



vi /etc/services

맨 밑에


서비스명            포트번호/tcp


vi /etc/xinetd.d/서비스명


service 서비스명

{

        flags = REUSE

        socket_type = stream

        wait = no

        user = root//권한(관리자 권한으로 해놓으면 해커들에의해 권한이 따일수도)

        server = /tmp/test_file//실행될 파일의 경로

        disable = no

}


/etc/init.d/xinetd restart  //서비스 재시작



ex)




xinetd로 돌아가는 프로그램은 사용자의 입력을 그대로 받는다.


즉 scanf 든 gets 든 알아서 입력을 처리해줌





+ Recent posts