my ($user, $pid) = getuserfromtcp $ip, $tcp; if ($user eq "luser" && ($tcp->{flags} & SYN) && # SYN !($tcp->{flags} & ACK) && # !ACK $msg->outdev_name) # outbound { syslog "warning", "Blocking outbound connection attempt by $user"; $ipq->set_verdict($msg->packet_id, NF_DROP); }
iptables -A OUTPUT -m owner \ --uid-owner luser -p tcp --syn -j DROP
The list of permitted users could be dynamic, stored in a database
We could go look in the user's home directory for a valid token
Possible to create a group for users with network access