Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement functionality to actually start the session #1

Open
probonopd opened this issue Dec 7, 2022 · 11 comments
Open

Implement functionality to actually start the session #1

probonopd opened this issue Dec 7, 2022 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@probonopd
Copy link
Member

probonopd commented Dec 7, 2022

Password checking is already implemented using PAM.

Still need to implement functionality to actually start the session.

Possible approaches:

  • Use xdm but change out its greeter with our LoginWindow code. License seems compatible. https://gitlab.freedesktop.org/xorg/app/xdm
  • Write something from scratch so that we can keep this under the BSD-2-Clause license
  • Find existing cli tools that we can use to do the job and just call them (some combination of login and xsession?)

Fallbacks

@probonopd probonopd added the help wanted Extra attention is needed label Dec 7, 2022
@louies0623
Copy link

louies0623 commented Dec 27, 2022

I think XDM can.

@StripedSkies
Copy link

StripedSkies commented Jan 8, 2023

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
Copy link
Member Author

Would you know how to do that?

@StripedSkies
Copy link

StripedSkies commented Jan 8, 2023

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
Copy link
Member Author

Thanks @StripedSkies.

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

That'd be great!

@StripedSkies
Copy link

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
Copy link
Member Author

probonopd commented Jan 11, 2023

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

This comment was marked as outdated.

@louies0623
Copy link

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

@probonopd
Copy link
Member Author

probonopd commented Aug 10, 2023

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
Copy link

louies0623 commented Sep 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants