Created
April 1, 2019 23:38
-
-
Save islander/9334e1de8b937bc9a8e4c4cfcd22a82e to your computer and use it in GitHub Desktop.
Open Asterisk in CentOS7 firewalld
This file contains hidden or 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
#!/bin/bash | |
PORTS=('5060/tcp' '5060/udp' '5061/tcp' '5061/udp' '4569/udp' '5038/tcp' '10000-20000/udp') | |
SERVICE_FILE="/etc/firewalld/services/asterisk.xml" | |
if [ ! -e "${SERVICE_FILE}" ]; then | |
firewall-cmd --permanent --new-service=asterisk | |
fi | |
for PORT in ${PORTS[@]}; do | |
firewall-cmd --permanent --service=asterisk --add-port=${PORT} | |
done | |
firewall-cmd --permanent --zone=public --add-service=asterisk | |
firewall-cmd --reload | |
firewall-cmd --list-all-zones |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment