This simple module allows call to bind() function only to uid/gid defined in a configfs tree.
Example:
Admin joe has loaded the uidbind module, then User sam (with uid 1017) tries bind() on port 8081:
sam@hell:~$ nc -l -p 8081 Can't grab 0.0.0.0:8081 with bind : Operation not permittedNow, Admin joe goes to /config/uidbind and...
root@hell:/config/uidbind: mkdir 8081 root@hell:/config/uidbind: cat 8081/uid 0 root@hell:/config/uidbind: echo 1017 >8081/uid root@hell:/config/uidbind: cat 8081/uid 1017
sam@hell:~$ nc -l -p 8081...now it works and sam is happy
root@hell:/config/uidbind: mkdir 8082 root@hell:/config/uidbind: mkdir 8082/192.168.1.2 root@hell:/config/uidbind: mkdir 8082/192.168.1.3 root@hell:/config/uidbind: echo 1017 > 8082/192.168.1.2/uid root@hell:/config/uidbind: echo 1026 > 8082/192.168.1.3/uid
root@hell:/config/uidbind: echo 0 > 8082/192.168.1.3/uid root@hell:/config/uidbind: echo 1026 > 8082/192.168.1.3/udp_uid
root@hell:/config/uidbind: mkdir 8083 root@hell:/config/uidbind: echo 1717 >8083/gid
root@hell:/config/uidbind: mkdir all root@hell:/config/uidbind: echo 1030 >all/udp_uid
root@hell:/config/uidbind: mkdir 8017 root@hell:/config/uidbind: echo 1030 >8017/uid root@hell:/config/uidbind: echo python >8017/comm
root@hell: modprobe configfs root@hell: mount -t configfs none /config