linux ʹÓÃxinetd
²Î¿¼£º
LinuxÏÂsyslogÈÕÖ¾º¯ÊýʹÓá¡£ºhttp://blog.csdn.net/telehiker/archive/2007/10/18/1830575.aspx
xinetd ʹÓÃÖ¸ÄÏÖÐÎÄ£ºhttp://www.dbanotes.net/OpenSource/Using_xinetd.html
xinetd ¹ÙÍø£º¡¡http://www.xinetd.org
xinetd ¸ú·þÎñͨÐÅʹÓá¡stdin/stderr ÊäÈëºÍÊä³ö£º
ʹÓá¡£ã±àдµÄÒ»¸öÀý×Ó£ºhelloword.c
#include <stdio.h>
#include <syslog.h>
#define MAX_INPUT 256
int main(void)
{
char input[MAX_INPUT+1] ;
if ( fgets(input, MAX_INPUT, stdin) != NULL ) {
//printf ("%s",input);
syslog(LOG_INFO,"hel - %s\n",input);
fprintf (stdout,input);
}
return 0;
}
1.±àÒëºó·ÅÔÚ/usr/bin/helloword
2.±àдÅäÖÃÎļþ£ºnano -w /etc/xinetd.d/helloword
service helloword
{
disable = no
wait = no
socket_type = stream
flags = IPv6
port = 3000
user = root
group = root
server = /usr/bin/helloword
#server_args =
}
3.ÅäÖ÷þÎñÆ÷ÉÏʹÓõĶ˿ڣº
nano -w /etc/services Ôö¼Ó2ÐУº
helloc 3000/tcp
helloc 3000/udp
4.ÖØÐÂÆô¶¯xinetd £¬ÊÇ·þÎñÉúЧ¡£
5.ÅäÖÃÈÕÖ¾£ºnano -w /etc/metalog :
Xinetd :
program_regex = "^xinetd"
program_regex = "^helloword"
logdir = "/var/log/xinetd"
break = 1
6.²âÊÔ£º
tg flashpolicyd_v0.6 # perl -e 'printf "hello\n",0' | nc 127.0.0.1 3000
hello
×÷ÕߣºJose Nazario
ÒëÕߣºFenng
ÈÕÆÚ£º25-Oct-2004
³ö´¦£ºhttp://www.dbanotes.net
°æ±¾£º@2001/11/27 Version 0.01 @2003/05/23 Version 1.00
JoseÃèÊöÁËÈçºÎ×ÅÊÖÅäÖõ÷Õûxinetd¡£
xinetdÈ¡´úÁËinetd£¬²¢ÇÒÌṩÁË·ÃÎÊ¿ØÖÆ¡¢¼ÓÇ¿µÄÈÕÖ¾ºÍ×ÊÔ´¹ÜÀí¹¦ÄÜ¡£xinetdÒѾ³ÉΪRed Hat 7 ºÍ Mandrake 7.2µÄInternet±ê×¼³¬¼¶ÊØ»¤½ø³Ì¡£ÕâÆªÎÄÕ½«Òýµ¼ÄãÈçºÎÓ¦ÓÃһЩËüµÄÌØÐÔ£¬ÕâÐ©ÌØÐÔ»ùÓÚxinetd 2.1.8.8 pre3°æ±¾¡£
µ¼ÑÔ
xinetdµÄ×î³õµÄ×÷Õߣ¨Pan
Ïà¹ØÎĵµ£º
linuxϽøÐÐÓ²ÅÌ·ÖÇø£¬½øÐиñʽ»¯´¦Àí£¬²¢½øÐйÒÔØÊ¹ÓÃ
ʵÑé»·¾³£º
HPZ400¹¤×÷Õ¾ £º 500GÓ²ÅÌ
ÓÉÓÚ±¾»úÊÇԤװµÄSUSE Linux Enterprise Desktop 11 (x86_64)
³ö³§Ê±£¬½öÔÚÓ²ÅÌÉÏ·ÖÁËÒ»¸ö38GµÄext3Îļþϵͳ£¬ºÍÒ»¸ö2GµÄswap·ÖÇø£¬ËùÒÔ¶ÔÓÚÆäËüµÄ¿ÕÏзÖÇø£¬ÒªÊµÏÖʹÓ㬾ÍÒª½øÐиñ
´¦Àí¡£
¿ÉÓõķÖÇø¹¤¾ßÓУºfdis ......
ÔÚLinuxÄں˴úÂëÖУ¬ÓÐÒ»¸öÐźŴ¦Àí°ó¶¨Æ÷º¯Êýsignal£¬Ëüµ½ÔÐͶ¨ÒåÈçÏ£¬Í¨¹ýman 2 signal¿ÉÒԲ鿴ÆäÔÐÍ¡£
#include <signal.h>
typedef void (*sighandler_t)(int); (1)
sighandler_t signal(int signum,sighandler_t handler); (2)
µÚÒ»¾äÊǰüº¬Í·Îļþ£¬µÚ¶þ¾äÊÇÀàÐͶ¨Ò ......
×ܽ᣺1¡¢80X86ʹÓÃС¶Ë·¨£¬ÍøÂç×Ö½ÚÐòʹÓôó¶Ë·¨¡£
2¡¢¶þ½øÖƵÄÍøÂç±à³ÌÖУ¬´«ËÍÊý¾Ý£¬×îºÃÒÔunsigned char, unsigned short, unsigned int
À´´¦Àí£¬ unsign ......