5.3. 强化网络服务

系统管理员在 Red Hat Enterprise Linux 8 服务器上部署红帽 Ceph 存储集群。SELinux 默认是开启的,防火墙会阻止除 SSH 服务端口 22 之外的所有入站流量;但是,您需要确定系统确实是这样配置的,以确定没有打开未验证的端口或没有启用不需要的服务。

在每个服务器节点上,执行以下操作:

  1. 启动 firewalld 服务,启用它在引导时运行并确保它正在运行:

    # systemctl enable firewalld
    # systemctl start firewalld
    # systemctl status firewalld
  2. 获取所有开放端口的清单。

    # firewall-cmd --list-all

    在新安装中,sources: 部分应为空,表示没有打开任何端口。services 部分应指示 ssh 表示 SSH 服务(以及端口 22)和 dhcpv6-client 已启用。

    sources:
    services: ssh dhcpv6-client
  3. 确保 SELinux 正在运行并设置为 Enforcing

    # getenforce
    Enforcing

    如果 SELinux 为 Permissive,则将其设置为 Enforcing 模式。

    # setenforce 1

    如果 SELinux 没有运行,请启用它。请参阅红帽客户门户网站中的 为 Red Hat Enterprise Linux 产品文档中的 配置基本系统设置指南中的 使用 SELinux 指南

每个 Ceph 守护进程使用一个或多个端口与 Red Hat Ceph Storage 集群中的其他守护进程通信。在某些情况下,您可以更改默认端口设置。管理员通常仅更改使用 Ceph 对象网关或 ceph-radosgw 守护进程的默认端口。

表 5.1. Ceph 端口

TCP/UDP 端口Daemon配置选项

8080

ceph-radosgw

rgw_frontends

6789, 3300

ceph-mon

N/A

6800-7300

ceph-osd

ms_bind_port_min to ms_bind_port_max

6800-7300

ceph-mgr

ms_bind_port_min to ms_bind_port_max

6800

ceph-mds

N/A

Ceph Storage 集群守护进程包括 ceph-monceph-mgrceph-osd。这些守护进程及其主机组成了 Ceph 集群安全区,该区域应使用自己的子网来强化目的。

Ceph 客户端包括 ceph-radosgwceph-mdsceph-fuselibcephfsrbdlibrbdlibrados。这些守护进程及其主机组成存储访问安全区,该区应使用自己的子网来强化目的。

在 Ceph Storage Cluster zone 主机上,请考虑仅启用运行 Ceph 客户端的主机来连接 Ceph Storage Cluster 守护进程。例如:

# firewall-cmd --zone=<zone-name> --add-rich-rule="rule family="ipv4" \
source address="<ip-address>/<netmask>" port protocol="tcp" \
port="<port-number>" accept"

<zone-name> 替换为区名称,<ipaddress> 替换为 IP 地址,<netmask> 替换为 CIDR 标记中的子网掩码,将 <port-number> 替换为端口号或范围。使用 --permanent 标志重复该过程,以便更改在重新引导后仍然有效。例如:

# firewall-cmd --zone=<zone-name> --add-rich-rule="rule family="ipv4" \
source address="<ip-address>/<netmask>" port protocol="tcp" \
port="<port-number>" accept" --permanent