« owner
This module attempts to match various characteristics of the packet creator, for locally-generated packets. It is only valid in the OUTPUT chain, and even this some packets (such as ICMP ping responses) may have no owner, and hence never match.
--uid-owner userid
Matches if the packet was created by a process with the given effective user id.
--gid-owner groupid
Matches if the packet was created by a process with the given effective group id.
--pid-owner processid
Matches if the packet was created by a process with the given process id.
--sid-owner sessionid
Matches if the packet was created by a process in the given session group.
--cmd-owner name
Matches if the packet was created by a process with the given command name. (this option is present only if iptables was compiled under a kernel supporting this feature)
NOTE: pid, sid and command matching are broken on SMP »
On peut donc filtrer le trafic sortant sur l'uid et le gid du processus qui a créé une socket. Intéressant pour marquer les paquets pour ensuite faire de la QoS avec tc sur les protocoles qui ouvrent des trilliards de connexions sur des ports différents genre torrent, par exemple. L'ennui, c'est que sur un desktop, la plupart du temps, les programmes sont exécutés avec l'uid/gid de l'utilisateur courant, pas avec un utilisateur dédié... Oui, on peut lancer sudo -u <user> <programme> mais il faut que l'user ait un shell et tout donc boarf...
Mon Nov 30 18:39:41 2015 - permalink -
-
http://linux.die.net/man/8/iptables