Applicable scenario
- Product:
ZCF - Component:
Cloud - Versions:
4.8.x, 4.6.x - Operating system:
H84r - Deployment topology: dual management nodes
- Trigger: After a server hosts more than
100VMs, VNC ports increase from5900, with exposure extending beyond6000; range blocking and whitelist hardening are required.
Symptoms
- VNC ports increase from
5900with the VM count. - The range to restrict is:
5900 ~ 6050
- Customer access addresses
172.16.xmust be retained, and all relevant cluster nodes must also be allowed.
Determination method
- Before blocking, confirm that the IP list requiring access retention is complete.
- After blocking, check
iptables -nvxL -t mangle. - Check
ipset listto confirm that the whitelist is applied correctly.
Cause
This is not a single exposed port. As VM count increases, VNC ports expand linearly, creating potential exposure throughout 5900~6050. Apply a uniform script to restrict that range while retaining legitimate access for client and cluster nodes.
Resolution
- Preparation
- Risk level: low.
- Disable the global VM HA switch.
- Back up the databases on both management nodes.
- Confirm that all compute nodes, management nodes, relevant VPC addresses, and customer VNC client IP
172.16.xare included in the whitelist plan.
- Back up the database
- On the VIP node, run:
zstack-ctl dump_mysql --file-name zstack-db-backup-master
- On the other management node, run:
zstack-ctl dump_mysql --file-name zstack-db-backup-slave
- Expected result: A database rollback baseline is available.
- Configure VNC port restrictions with the safe script
- Upload the tool archive to the VIP management node:
safe_script_v4.6.tar.gz
- Expected result: The hardening script is ready.
- Extract and enter the directory:
tar -zxvf safe_script_v4.6.tar.gz
cd safe_script/
- Expected result: You are in the script directory.
- Run the script:
bash safe.sh
- Enter the management-node UI password when prompted.
- Expected result: The interactive hardening workflow starts.
- When configuring port restrictions, add the following addresses to the whitelist:
- All compute nodes
- All management nodes
- All VPC addresses
- Customer VNC client address:
172.16.200.12
- Expected result: The whitelist scope is complete and legitimate access is not blocked.
- Apply restriction rules for ports
5900~6050in the script.
- Expected result: The VNC risk-port range is restricted consistently.
- Verify and save
- Check rules:
iptables -nvxL -t mangle
- Expected result: The relevant ports are restricted in the
mangletable.
- Check the whitelist set:
ipset list <ZS-ALLOW-IP-*>
- Example:
ZS-ALLOW-IP-121791019234355435
- Expected result: Allowed IPs match the plan.
- Save configuration:
ipset save > /etc/sysconfig/ipset
service iptables save
- Expected result: Rules are persisted.
- Enable the global VM HA switch.
- Expected result: The platform returns to its normal operating policy.
Verification
- Ports
5900~6050are restricted. 172.16.xand whitelisted cluster nodes can still access required VNC services.- HA is enabled again.
Risks and rollback
- Risk: Failure to whitelist all compute nodes, management nodes, VPC addresses, and client addresses can cause firewall blocking and service exceptions.
- Risk level: low.
- Rollback: Log in to a management node and run the
safescript to restore rules.
