The subject of this thread are application firewalls, like Little Snitch or
https://github.com/evilsocket/opensnitch.
To be fair I haven't looked at the state of Linux app firewalls in years, maybe there's something better available, but *tables is not it.