Skip to content

Commit df8ea1f

Browse files
committed
Fix SELinux permissions for ptmx
1 parent 6c8a9a1 commit df8ea1f

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

build_files/base/01-base-system.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,22 @@ if ! id -u greeter &>/dev/null; then
9797
useradd -r -M -s /usr/bin/nologin greeter
9898
fi
9999

100+
### SELinux Policy: Allow greeter to allocate PTYs and use io_uring
101+
# Install policy development tools (will be removed by cleanup)
102+
dnf5 -y install selinux-policy-devel
103+
104+
# Compile and install the greeter policy module
105+
SELINUX_DIR="/usr/share/hypercube/selinux"
106+
pushd "$SELINUX_DIR"
107+
make -f /usr/share/selinux/devel/Makefile hypercube-greeter.pp
108+
semodule -i hypercube-greeter.pp
109+
popd
110+
111+
# Clean up build artifacts (keep .te for reference)
112+
rm -f "$SELINUX_DIR"/*.pp "$SELINUX_DIR"/*.if "$SELINUX_DIR"/*.fc
113+
100114
### Enable services
115+
systemctl enable devpts-ptmxmode.service
101116
systemctl enable greetd.service
102117
systemctl enable NetworkManager.service
103118
systemctl enable bluetooth.service

system_files/shared/usr/lib/systemd/system/dev-pts.mount.d/ptmxmode.conf

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Fix devpts mount options for PTY allocation
3+
DefaultDependencies=no
4+
After=systemd-remount-fs.service
5+
Before=greetd.service
6+
7+
[Service]
8+
Type=oneshot
9+
ExecStart=/usr/bin/mount -o remount,mode=620,gid=5,ptmxmode=0666 devpts /dev/pts
10+
RemainAfterExit=yes
11+
12+
[Install]
13+
WantedBy=sysinit.target
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
policy_module(hypercube-greeter, 1.0)
2+
3+
require {
4+
type xdm_t;
5+
type ptmx_t;
6+
type io_uring_t;
7+
class chr_file { read write open getattr ioctl };
8+
class anon_inode { create };
9+
}
10+
11+
# Allow display manager (greetd/greeter) to allocate PTYs
12+
allow xdm_t ptmx_t:chr_file { read write open getattr ioctl };
13+
14+
# Allow display manager to use io_uring (used by ghostty)
15+
allow xdm_t io_uring_t:anon_inode { create };

0 commit comments

Comments
 (0)