kinvolk / fanotify-mon

MIT License
0 stars 2 forks source link

fanotify PoC

This PoC aims to take a container rootfs and only allows access to files in it if they're signed with a particular public key.

For now it prints hashes of files accessed

Usage

sudo ./fanotify-poc ROOTFS_PATH

Caveats

Fanotify doesn't work across mount namespaces so this only works for files accessed from outside the container.

Testing go binary

kubectl run --image nginx -l enforce.k8s.io=deny-third-party-execution nginx
touch newfile
ls

rm -rf /usr/bin/touch
cat <<EOF > /usr/bin/touch
#!/bin/bash

echo this is a new touch
EOF

chmod +x /usr/bin/touch
touch file