Bug logging added firewall?

I am adding a firewall rule to accept connection from my docker container to a specific host port. It’s working. But why the log is showing accept port:0?

I’ve tried if adding an specific ip address to the same port, it will be showing correctly which port number being added in log. But if adding a local IP range to a specific port, it will show accept port:0

Apply this fix and try again:

sed -i.bak -e 's/\$port,/\$port_ext,/' -e 's/port=/port_ext=/' -e 's/\"\$port\"/\"\$port_ext\"/' /usr/local/hestia/bin/v-add-firewall-rule

so this defect is for adding IP range to firewall rule? Actually, when I check the iptables, it actually added correctly but just not reflecting properly from log

No, it’s just that the log isn’t showing the correct port being used.

I’ve created this PR:

Thanks, just to clarify the PR submitted seems only replacing port to port_ext inside IF statement. But your sed command in previous reply seems replacing ALL port to port_ext? which one should take?

Both, PR and sed do exactly the same.

Take a closer look to the sed patterns and you’ll see that it doesn’t change ALL port with port_ext.

o yes, I overlooked.

Just want to learn a bit more from your expertise. Why the if statement still use $port? where is that $port variable comes from, cannot see this from this script file

if [ -z "$port" ]; then
	port_ext="0"
fi

Yes, I’ve updated it right now. Run this sed to fix it:

sed -i.bak -e 's/\$port,/\$port_ext,/' -e 's/port=/port_ext=/' -e 's/\"\$port\"/\"\$port_ext\"/' /usr/local/hestia/bin/v-add-firewall-rule

thanks, so should be all using $port_ext instead of $port?

Yes, that’s correct.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.