xenocara/app/xenodm/config/TakeConsole
matthieu 08a235a628 chown before chmod
This prevents a malicious user logging out from calling
chmod while still owning /dev/console and thus by-passing
the '622' mode that is set here.

Issue reported by Tim Chase. Thanks.


Merged from xdm upstreams
2017-10-04 18:28:59 +00:00

12 lines
392 B
Bash

#!/bin/sh
# Reassign ownership of the console to root, this should disallow
# assignment of console output to any random users's xterm
# $OpenBSD: TakeConsole,v 1.2 2017/10/04 18:28:59 matthieu Exp $
#
chown root /dev/console
chmod 622 /dev/console
if [ -c /dev/drm0 ]; then
chown root /dev/drm0
fi
/usr/X11R6/bin/sessreg -d -l $DISPLAY -u /var/run/utmp -x /etc/X11/xenodm/Xservers $USER