Created
July 31, 2022 11:28
-
-
Save Miladbr/6710b9255d15be115d41599b138342f9 to your computer and use it in GitHub Desktop.
Persist an esxi firewall rule for outgoing syslog traffic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Append below lines in /etc/rc.local.d/local.sh. | |
# Change host_address and host_port according to your syslog server configuartion. | |
/bin/cat > /etc/vmware/firewall/persistsyslog.xml << EOF | |
<!-- remote syslog configuration --> | |
<ConfigRoot> | |
<service> | |
<id>persistsyslog</id> | |
<rule id='0000'> | |
<direction>outbound</direction> | |
<protocol>udp</protocol> | |
<porttype>dst</porttype> | |
<port>host_port</port> | |
</rule> | |
<enabled>false</enabled> | |
<required>false</required> | |
</service> | |
</ConfigRoot> | |
EOF | |
/sbin/esxcli network firewall refresh | |
/sbin/esxcli network firewall unload | |
/sbin/esxcli network firewall load | |
/sbin/esxcli network firewall ruleset set -e true -r persistsyslog | |
/sbin/esxcli network firewall ruleset set -e false -r syslog | |
/sbin/esxcli system syslog config set --loghost udp://host_address:host_port | |
/sbin/esxcli system syslog reload | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment