Extend x0vncserver to create Xdesktop on demand

53 views
Skip to first unread message

gsch...@gnu-log.net

unread,
Sep 7, 2019, 7:46:43 AM9/7/19
to TigerVNC Developer Discussion
Hello,

I wrote a code to have a vncserver that is able to handle multiple user at once on headerless server. To do this, I forked x0vncserver to spawnvncserver and I extended VNCServerST and VNCSConnectionST. The current code is a draft, I have voluntarily kept only minimal changes, thus the code is durty. I would like to discuss about my implementation to improve it.

If you are interested to include my work to the mainstream I will be happy to help to cleanup it to fit the project requirement, but I'm also fine to maintain it in my own branch in my github repository. In both case I'm interested in advises and review :)

The spawnserver differ for x0vncserver because it start a new Xserver for each user that connect to the server and do not terminate the session on user connection loss. If the user reconnect, he recover his session.

The most important change to x0vncserver is that I wait for user authentication before starting a Xdesktop for that user, this looks fairly trivial but the current code is not designed to work with several Xdesktop. To start Xdesktop I use Xorg with dummy driver using a custom xorg configuration. The Xserver is started using su - username to drop root right for the user session, that also mean that the spawnvncserver must be run with root right. Moreover, the display name is choose from screen :10, the server keep in track user display name, the server expect :10 and above are free when he start.

In the side change, I did rewrote Xdesktop to use xcb instead of Xlib, because Xlib abort/exit on server connection loss <freetroll>Wahou nice Xlib ...</freetroll>. During the rewrite I have to strip down few features to save time and I used cairo to acquire the Xserver framebuffer and xkbcommon to track the keyboard state. This change may also be interesting alone.

You can find my changes here [1].

My first thought is to split VNCServerST in two part, on called VNCScreen and the other one VNCServer, in the case of x0vncserver they can be both used together and in my spawn server I will be able to have several VNCScreen and have only one VNCserver.

I still missing a proper handle of X session termination, the code does not include required xorg configuration, I do not know how to handle it with cmake. And I do not enforce vncserver authentification thus it's recommended to use it with " -PAMService system-auth -SecurityTypes TLSPLain -PlainUsers user1,user2 " command line.

Thank you by advance for your help.

Best regards.


Pierre Ossman

unread,
Oct 4, 2019, 7:36:20 AM10/4/19
to gsch...@gnu-log.net, TigerVNC Developer Discussion
On 07/09/2019 13:46, gsch...@gnu-log.net wrote:
>
> If you are interested to include my work to the mainstream I will be happy
> to help to cleanup it to fit the project requirement, but I'm also fine to
> maintain it in my own branch in my github repository. In both case I'm
> interested in advises and review :)
>

The idea of automatically starting sessions for users is definitely
interesting. Unfortunately using startx and su --login doesn't really
work on modern systems. You have to spawn sessions via systemd and do a
lot of fancy setup.

We've started work on getting vncserver working that way here:

https://github.com/TigerVNC/tigervnc/pull/838

If you want to you can have a look at that and see if you can get
something similar working.

Regards
--
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46-13-214600

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

gsch...@gnu-log.net

unread,
Oct 13, 2019, 4:35:20 AM10/13/19
to TigerVNC Developer Discussion


Le vendredi 4 octobre 2019 13:36:20 UTC+2, Pierre Ossman a écrit :

The idea of automatically starting sessions for users is definitely
interesting. Unfortunately using startx and su --login doesn't really
work on modern systems. You have to spawn sessions via systemd and do a
lot of fancy setup.


Thanks you for feedback I will have a look :)
Reply all
Reply to author
Forward
0 new messages