A program I'm writing binds to several 0.0.0.0:0 (UDP) ports , and as such, the port I need open is nondeterministic. However, once obtained, I need to ensure the local firewall allows all traffic to and from that port.
IPTables is preferred in this use case, as it underlies higher-level firewalls like UFW, which will allow me to write only one version of a command for all linux distros.
This command will be called from the program executable. The windows version of this command allows me to merely specify the executable path, and viola. However, the linux version is not as trivial unless I specify each individual port I need opened. I'd prefer to allow traffic for an executable instead of individual ports. How can this be done? Or, what method would you use?