Linux网络服务_防火墙_守护进程xinted,客户端telnet
Linux网络服务_防火墙_守护进程xinted,客户端telnet
1.xinetd简单介绍
xinted(eXtended InterNET services daemon)
支持守护进程的用户都受tcpwarp控管
2.守护进程的启用
cd /etc/xinetd.d/
systemctl restart xinetd.service //启动xinted
chkconfig --list //查看守护进程支持的服务
[[email protected] xinetd.d]# ldd /usr/sbin/xinetd //查看是否受tcpwarp保护
iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd based services:
chargen-dgram: off
chargen-stream: off
daytime-dgram: off
daytime-stream: off
discard-dgram: off
discard-stream: off
echo-dgram: off
echo-stream: off
tcpmux-server: off
telnet: on
time-dgram: off
time-stream: off
netstat -antlupe | grep 23 //查看是否开启23接口,此时未开启
yum install telnet.x86_64 -y //安装客户端软件,此时自动启动
2.编写telnet配置文件
cd /etc/xinetd.d/
vim telnet //编写配置文件
[[email protected] xinetd.d]# netstat -antlupe | grep 23
tcp6 0 0 :::23 :::* LISTEN 0 84646 8010/xinetd
检测
[[email protected] xinetd.d]# vim /etc/hosts.deny
删除all:all
[[email protected] xinetd.d]# telnet localhost //可以通过守护进程访问localhost
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Kernel 3.10.0-123.el7.x86_64 on an x86_64
server103 login: student
Password:
X11 connection rejected because of wrong authentication.
(process:8117): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line `dbus-launch --autolaunch=946cb0e817ea4adb916183df8c4fc817 --binary-syntax --close-stderr': Child process exited with code 1
[[email protected] ~]$ //进入成功
3.编写主配置文件
vim /etc/xinetd.conf
23黑名单no_access = 172.25.254.20 //白名单和黑名单同时存在时,黑名单生效
24白名单only_from = 172.25.254.250 //只允许250访问
25最大负载max_load = 20 超过20%连接自动停止
26cps 同时b个连接时停止a秒,第一个数字时间,第二个数字个数。主要功能用来黑客denose攻击
cps = 3 2 并发量(能同时连接的ip的个数,停止多少秒)停止多少秒:如果4个人同时连接,那么都无法连接,2秒之后才能重新连;如果是两个人同时连,没有问题
27instances = 3 可以承受的对最大连接个数不超过2
28per_source = 2 同一个客户端、IP最多只能有两个连接
systemctl restart xinetd.service //重启服务
测试:
在多台客户端进行telnet 172.25.254.103
4.SELinux对于端口的影响
getenforce //查看SELinux状态
setenforce 0 | 1 //更改SELinux状态 ,1强制,0关闭
vim /etc/httpd/conf/httpd.conf //实验更改httpd端口为6666(默80)
systemctl restart httpd //selinux为强制时失败,httpd服务无法重启
ps aux | grep httpd ##查看进程,没有
netstat -antlupe | grep 6666 ##查看6666端口,没有
setenforce 0 ##关闭selinux
systemctl restart httpd ##重启成功
netstat -antlupe | grep 6666 //验证6666端口可以使用
setenforce 1 ##selinux改回强制,再次重启,失败
cat /var/log/messages ##查看日志
semanage port -l //查看所有端口
semanage port -l | grep http //查看httpd端口(1024以下系统使用)
semanage port -a -t http_port_t -p tcp 6666 //添加SELINUX端口设置
semanage port -l | grep httpd //查看httpd端口
systemctl restart httpd ##重启成功