#!/bin/sh mkdir /store/firewall # Copy the service.xml firewall rules to a central storage # so they can survive reboot cp /etc/vmware/firewall/service.xml /store/firewall # Remove end tag so rule addition works as expected sed -i "s/<\/ConfigRoot>//" /store/firewall/service.xml # Add rule for vnc connections echo " vnc inbound tcp dst 5900 5964 true false " >> /store/firewall/service.xml # Copy updated service.xml firewall rules to expected location # Refresh the firewall rules cp /store/firewall/service.xml /etc/vmware/firewall/service.xml esxcli network firewall refresh # Add steps to profile.local to repeat these steps on reboot echo " cp /store/firewall/service.xml /etc/vmware/firewall/service.xml esxcli network firewall refresh" >> /etc/rc.local