xinetd:挺有意思的一个东东

初识xinetd是在安装部署check_mk监控系统的时候。check_mk_agent必须安装一个xinetd程序,默认端口是6556.

xinetd即extended internet daemon,xinetd是新一代的网络守护进程服务程序,又叫超级Internet服务器。经常用来管理多种轻量级Internet服务。xinetd提供类似于inetd+tcp_wrapper的功能,但是更加强大和安全。

更详细的介绍可以参考https://www.cnblogs.com/lsgxeva/p/9280777.html

1. 安装xinetd

centos下安装xinetd的方式

yum -y install xinetd 

2. 创建一个服务脚本(这边使用一个显示当前访问xinetd端口的IP地址的脚本)

/root/tmp/my_test.sh

#!/bin/sh 
echo "Your ip addr is:"
netstat -tun | grep 9201 | grep ESTABLISHED | awk '{print $5}' | awk -F ':' '{print$1}'
chmod 755 /root/shell/my_test.sh  

3. 创建xinetd服务

vim /etc/xinetd.d/my_test 

扫描二维码关注公众号,回复: 9749865 查看本文章
service my_test
{ 
    flags           = REUSE 
    socket_type     = stream 
    #port            = 9201
    wait            = no 
    user            = root 
    server          = /root/tmp/my_test.sh
    #log_on_failure  += USERID 
    disable         = no 
    #only_from       = 192.168.5.0/24 
    #recommended to put the IPs that need to connect exclusively (security purposes) 
} 

4. 配置端口

默认依赖/etc/services,此时/etc/xinetd.d/my_test这个文件配置的port无效,所以不需要配置 
vi /etc/services 
my_test            9201/tcp 

后续可以写一些特别用途的脚本....

发布了22 篇原创文章 · 获赞 21 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_41565459/article/details/103720136