[Bug 266532] x11/lightdm: Login sessions do not respect login.conf

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 22 Dec 2023 15:48:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266532

--- Comment #11 from Ivan Rozhuk <rozhuk.im@gmail.com> ---
This issue also actual for slim and probably other logon managers and tools
that do user logon.

As far I understand FreeBSD logon process a bit more complex than linux, at
least it requires additional syscalls to handle login classes.


To fix this I use "su -l ${USER}" in 2 wrapper scripts:
 1. logon_pre.sh: it save env to XDG_RUNTIME_DIR ("/var/run/user/`id -ur
${USER} | tr -d '\n'`") and run: /usr/bin/su -l "${USER}" -c "env
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} ${THIS_SCRIPT_DIR}/logon_post.sh ${@}"

 2. logon_post.sh: it save its own env, restore env from firs script, restore
its own env and run Xsession.

To use this you need:
1. save both scripts to /usr/local/etc/lightdm
2. chmod +x them
3. in file /usr/local/etc/lightdm/lightdm.conf replace:
session-wrapper=/usr/local/etc/lightdm/Xsession
with
session-wrapper=/usr/local/etc/lightdm/logon_pre.sh


Another cool hack:
xmir-command=/usr/bin/nice -n -15 /usr/local/bin/Xmir
xserver-command=/usr/bin/nice -n -15 /usr/local/bin/X
this increase xorg priority and fix some frizes.


For slim I use for a while:
login_cmd               /usr/bin/su -l ${USER} -c "env XAUTHORITY=${XAUTHORITY}
XDG_SESSION_COOKIE=${XDG_SESSION_COOKIE} DISPLAY=${DISPLAY} ~/.xinitrc
%session"

This is a bit insecure since XDG_SESSION_COOKIE visible via "ps axd".

Ti increase xorg priority:
default_xserver         /usr/bin/nice
xserver_arguments       -n -15 /usr/local/bin/X -nolisten tcp vt09


Hope lightdm and slim maintainers will assimilate these scripts and config
hacks into ports tree.

-- 
You are receiving this mail because:
You are the assignee for the bug.