Closed balupton closed 6 years ago
Caused seem to be these:
IFS=','
did not seem to work on the machines, so switched to tr ',' '\n'
while read -r port
does not read the last line unless you also have || [ -n "$port" ]
--zone=internal
seemed to not expose to other local machines, change to --zone=public
(perhaps as it was the active or default zone), more experimentation here is warrantedPrevious code:
while IFS=',' read -r port; do
echo "configuring local $port/tcp"
sudo firewall-cmd --zone=internal --add-port="$port/tcp" --permanent
done <../data/input/ports_local_tcp
while IFS=',' read -r port; do
echo "configuring local $port/udp"
sudo firewall-cmd --zone=internal --add-port="$port/udp" --permanent
done <../data/input/ports_local_udp
sudo firewall-cmd --reload
Resolved code:
tr ',' '\n' < ../data/input/ports_local_tcp | while read -r port || [ -n "$port" ]; do
echo "configuring local $port/tcp"
sudo firewall-cmd --zone=public --add-port="$port/tcp" --permanent
done
tr ',' '\n' < ../data/input/ports_local_udp | while read -r port || [ -n "$port" ]; do
echo "configuring local $port/udp"
sudo firewall-cmd --zone=public --add-port="$port/udp" --permanent
done
sudo firewall-cmd --reload
Code for debugging zones:
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --list-all-zones
sudo firewall-cmd --get-default-zone