shell: Refactor iptables scripts

This also allows reusing the same rules-scripts with different backend
wrappers.