helloSystem / LoginWindow

BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Implement functionality to actually start the session #1

Open probonopd opened 1 year ago

probonopd commented 1 year ago

Password checking is already implemented using PAM.

Still need to implement functionality to actually start the session.

Possible approaches:

Fallbacks

louies0623 commented 1 year ago

I think XDM can.

StripedSkies commented 1 year ago

I'm a noob, but can I ask why you don't fork and use setuid and setgid ?? You could also find free ttys and run with setsid https://unix.stackexchange.com/questions/170063/start-a-process-on-a-different-tty

probonopd commented 1 year ago

Would you know how to do that?

StripedSkies commented 1 year ago

After digging inside XDM's source code I think I finally got it, so long as it's okay to copy the idea and not the code: We call fork(), Setup a cleanup client function on the master, From now on, this is inside the slave: call setgid, setlogin, setuid and pass in environment variables from PAM, chdir() into user's home directory, set /dev/null as stdin, duplicate stderr into stdout (meaning they both output to the same place) execve() the session.

Again, can't promise anything but I'll try to make it happen. Apparently setsid() in FreeBSD refers to process groups rather than what it is on Linux so that won't work.

probonopd commented 1 year ago

Thanks @StripedSkies.

Again, can't promise anything but I'll try to make it happen.

That'd be great!

StripedSkies commented 1 year ago

How to test what I've done ? I've implemented a prototype I still need some help, But overall it should work (fingers crossed). I currently need help with setting up environment variables (like HOME, PATH, XDG_RUNTIME_DIR) And where to put desktop session files ?

probonopd commented 1 year ago

Cool!

How to test what I've done ?

You need to tell the system not to use slim anymore, but to use LoginWindow instead. Probably the easiest way (just for testing) is to make a copy of /usr/local/etc/rc.d/slim named hello, make the needed changes there, and then change /etc/rc.conf to have slim_enable="NO" and hello_enable="YES" (if you set rcvar=hello_enable in /usr/local/etc/rc.d/hello, among other changes).

And where to put desktop session files ?

/usr/local/share/xsessions/hello.desktop is the place, and this is the content:

[Desktop Entry]
Encoding=UTF-8
Type=XSession
Name=helloDesktop
Exec=/usr/local/bin/start-hello
TryExec=/usr/local/bin/start-hello
Icon=computer-hello

/usr/local/bin/start-hello can be seen at https://github.com/helloSystem/ISO/blob/experimental/overlays/uzip/hello/files/usr/local/bin/start-hello.

louies0623 commented 1 year ago

Maybe you can refer to CDE dtlogin which is also Xwindow.

louies0623 commented 1 year ago

@probonopd I think if there is no progress, maybe qt-lightdm-greeter can rely on.

probonopd commented 1 year ago

It runs in lightdm. lightdm has an interesting liblightdm-qt. Maybe we can use that to run our LoginWindow. The question is whether lightdm has any dependencies that we don't want (e.g., PolKit, etc.)

Unfortunately the x11/lightdm package on FreeBSD doesn't include the Qt part (pkg list lightdm). So it'd need to be packaged first.

louies0623 commented 12 months ago

So is PCDM more likely, although it is based on qt, it is just possible that it will need to branch.