neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.59k stars 1.73k forks source link

Need client name / IP address after login for license, printer assignment, .env, etc #2627

Open sibelle-labs opened 1 year ago

sibelle-labs commented 1 year ago

Hello! In our environment, we need to know the IP address of the client that is doing the initial session setup. Our HW Clients: Thin Clients, Windows Clients with rdp, etc. Servers: Almalinux / xfce and of course xorgxrdp So far we have used a script under xinitrc.d and from it, for example, the name of the nearest printer from the client name / IP address, the license assignament, etc. After switching to xrdp and running xfreerdp on the clients (directly from rc.local) and from windows clients (with native rdp) we no longer have access to this information and are forced to hard-code such information in the user's .profile but again not reliably enough.

It would be cool if /etc/reconnectwm.sh also had access to the reconnecting client's IP address. In this case, we could even update this information in a file in the user's home directory.

Reading into log files is cumbersome (and the information isn't there anyway) xrdp-sesadmin is useless as it requires authentication even if you only need information about your own session

I've read that something has already been implemented in one place or another. Can I access the information as it stands, even if I use a workaround for it? The important thing in my environment would be if I had the IP address in the environment variables somewhere after logging in, for example. Thanks in advance, and grateful for hints.

matt335672 commented 1 year ago

Duplicate of #2415 (or at least very similar) and #1348.

@sibelle-labs - we're working on this, but it isn't there yet. Using the environment isn't a great idea in general, as a session variable can't be changed once it's set. Although it will work OK for your use-case, we will doubtless end up with users getting confused when the IP address of a reconnected client is not the same as the one which started the session.

I'm hoping to make this information available from xrdp-sesadmin. This utility isn't useful for v0.9.x as you need a username and password to use it, but in the devel stream this is not longer necessary. Eventually you'll be able to query xrdp-sesadmin for the initial client IP address, current client IP address, and current connection state.