Cockpit 是一个基于 Web 的GUI服务器管理工具,可用于 CentOS8 和 Redhat8 系统,属于默认的服务器管理工具,通过光盘YUM源就可以安装了。
系统管理员可以通过此工具监控和管理系统日志、网络、服务、软件更新等等。
备注:无需安装Apache、Nginx这些软件。
系统版本信息:
安装Cockpit:
[root@centos8 ~]# dnf -y install cockpit
启动Cockpit:
[root@centos8 ~]# systemctl start cockpit.socket
[root@centos8 ~]# systemctl enable cockpit.socket
查看Firewalld的当前配置信息:
firewall-cmd --zone=public --list-all
注释:cockpit dhcpv6-client ssh 是默认就有的,默认就可以被访问。
客户端通过Web进行访问:(建议使用Firefox浏览器)
https://192.168.168.154:9090
使用管理员用户root登录:
可以在这里使用网页终端管理服务器:
只允许某个IP地址远程登录Cockpit
先在防火墙中删除 cockpit
[root@centos8 ~]# firewall-cmd --permanent --zone=public --remove-service=cockpit
success
插入防火墙规则:( 只允许IP地址(192.168.168.161)访问本机的TCP 9090 端口 )
[root@centos8 ~]# firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.168.161" port protocol="tcp" port="9090" accept'
success
[root@centos8 ~]# firewall-cmd --reload
success
查看Firewalld的当前配置信息:
[root@centos8 ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens160
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="192.168.168.161" port port="9090" protocol="tcp" accept
Firewalld的配置文件:
[root@centos8 ~]# cat /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
<service name="ssh"/>
<service name="dhcpv6-client"/>
<rule family="ipv4">
<source address="192.168.168.161"/>
<port port="9090" protocol="tcp"/>
<accept/>
</rule>
</zone>
###
删除防火墙规则的方法:
[root@centos8 ~]# firewall-cmd --permanent --zone=public --remove-rich-rule='rule family="ipv4" source address="192.168.168.161" port port="9090" protocol="tcp" accept'
success
[root@centos8 ~]# firewall-cmd --reload
success
相关文章:
CentOS8防火墙(firewalld) |