Environment:
- OS: CentOS 8 (generic/centos8 Vagrant box)
- Virtualization: VMware-Workstation 16.1.0 build-17198959
Steps to reproduce:
- Create a devices new policy
cd /sys/fs/cgroup/devices
mkdir custom_poc
- Verify which device is being used as tty (multiple methods):
- Using tty: - root@centos8# tty /dev/pts/0
- Getting the process STDIN: - ls -l /proc/$$/fd/{0,1,2} lrwx------. 1 root root 64 Mar 5 11:25 /proc/2446/fd/0 -> /dev/pts/0 lrwx------. 1 root root 64 Mar 5 11:25 /proc/2446/fd/1 -> /dev/pts/0 lrwx------. 1 root root 64 Mar 5 11:25 /proc/2446/fd/2 -> /dev/pts/0
- Add tty device to devices.deny:
- Check device major and minor numbers: - ls -l /dev/pts/0 crw--w----. 1 vagrant tty 136, 0 Mar 5 11:28 /dev/pts/0
- Deny access: - root@centos8# echo 'c 136:0 w' > /sys/fs/cgroup/devices/custom_poc/devices.deny root@centos8# echo $$ > tasks root@centos8# echo 'a' > /dev/pts/0 -bash: /dev/pts/0: Operation not permitted
- However, my Bash terminal works just fine even after removing access to STDIN device. Here is the output of a simple whoami: - root@centos8# whoami root

