-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update sockdir security #2731
Update sockdir security #2731
Conversation
61f65b1
to
6d1ad83
Compare
The sockdir is only used when sesman is active. The call g_mk_socket_path() is removed from os_calls and moved to sesman. We also change the permissions on this directory to 0755 rather than 01777 (01000 is the 'sticky bit', S_ISVTX). The behaviour of g_create_dir() has been modified to not set S_ISVTX on Linux directories. This is implementation-defined behaviour according to 1003.1, and is no longer required for the sockdir.
4736271
to
0971b3e
Compare
I'm bumping this up priority-wise as it's necessary to get the security of the PCSC socket sorted for #1825 If nobody's got time to look at it I'll merge in a week or so. I think the idea of what it's trying to do is fairly clear. |
fc59fd4
to
398ba41
Compare
The top level socket directory is now called XRDP_SOCKET_ROOT_PATH. Below that are user-specific directories referred to with the XRDP_SOCKET_PATH macro - this name is hard-coded into xorgxrdp and the audio modules as an environment variable. XRDP_SOCKET_PATH now looks like $XRDP_SOCKET_ROOT_PATH/<uid> XRDP_SOCKET_PATH is only writeable by the user, and readable by the user and the xrdp process.
Now we've made the XRDP_SOCKET_PATH only writeable by root, it's safe to move the sesman socket back into this directory. We no longer need a separate sesmanruntimedir
398ba41
to
c51ec2e
Compare
I will look into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks. I'll merge later today if I get the time. |
This is one of two updates which (in total) will support running xrdp as a non-privileged user without needing to patch it, as Debian/Ubuntu does at present.
The main purpose of this update is to remove the need to use the sticky bit on the socketdir and simplify the security in this area.
#2472 changed sesman to identify sessions by UID rather than username. This fixed #1823. As a result, sesman is now UID aware.
This lets us insert a UID-specific directory into the socketdir. Now users can't see each others xrdp sockets, resulting in a small security improvement.
Once we've done this, we can get rid of the sesmanruntimedir introduced by #2472, as the socketdir is no longer world-writeable. This moves all the sockets back into a single directory.
As an example, if I log on to my development box using display 11, I now get this under
/run/xrdp
:-At the moment the xrdp process is running as
root
, and can access sockets for user 1001 (testuser) by using group permissions.There are also some tidy-ups in here, like introducing
XRDP_SOCKETS_MAXPATH
for the maximum length of a socket path name, and simplifying the parsing of the sesman.ini[security]
section.Currently draft as more testing is required. Comments welcome.