Applicable scenario
- Product:
ZCF - Component:
Cloud - Versions:
4.8.x, 4.5.x - Deployment topology: dual management nodes
- Trigger: Multiple sensitive ports require access restrictions to meet vulnerability-scan remediation requirements.
Symptoms
- Multiple common service ports are externally exposed.
- These ports must be limited to cluster-internal access.
- Ports
22and5000must also allow specified PC access.
Determination method
- Before the change, confirm platform health and resource connection state.
- After the change, check rules and whitelists in
iptables -nvL -t mangleandipset list. - Check that platform services have no exception.
Cause
This is a vulnerability-scan security-hardening scenario. Firewall policies are required to restrict multiple sensitive ports while retaining whitelist access for certain ports.
Resolution
- Preparation
- Risk level: low.
- Log in to ZStack Cloud and confirm the environment is normal.
- Disable HA and back up databases on both management nodes.
- Prepare
safe_script_4.5.x.tar.gz.
- Ports to restrict
330690909091910010010888880818080707050005900-59091112512322
- Procedure
- Back up databases on both management nodes:
zstack-ctl dump_mysql --file-name zstack-db-backup-master
zstack-ctl dump_mysql --file-name zstack-db-backup-slave
- Expected result: Database backup is complete.
- Extract and run the script:
tar zxvf safe_script_v4.5.tar.gz
cd safe_script/
bash safe.sh
- Expected result: The scripted port-hardening workflow opens.
- Enter the management-node
adminpassword.
- Expected result: You have permission to apply rules.
- In the script, select:
3: Restrict physical-host ports1: Configure rules- Expected result: Port-restriction configuration opens.
- Enter the ports to restrict:
3306,9090,9091,9100,10010,8888,8081,8080,7070,5000,5900-5909,111,25,123,22
- Configure specified PC whitelist access for
22and5000. - Expected result: Port restriction rules are applied.
- Enter allowed IP addresses.
- The script automatically identifies cluster-host IPs.
- Multiple allowed IPs can also be specified manually.
- Expected result: Cluster access and whitelisted PC access are allowed correctly.
- Check that the rules take effect:
iptables -nvL -t mangle
ipset list ZS-XXXX
- Expected result: Rules and allowed-IP sets take effect.
- After confirming the environment is normal, re-enable global HA.
- Expected result: The platform resumes normal operation.
Verification
iptablesrules are applied.- The
ipsetwhitelist contains correct cluster IPs and specified PC IPs. - Cloud-platform resource state and service connections are normal.
Risks and rollback
- Risk: Incorrect whitelist IPs can affect SSH, management access, or other critical services.
- Risk level: low.
- Rollback:
bash safe.sh
Then select:
3Restrict physical ports2Restore rule configuration
