GUACAMOLE-2283: Runtime observability: add guacd process & thread naming.#674
Conversation
necouchman
left a comment
There was a problem hiding this comment.
Overall looks pretty good to me, and I think this is a very useful addition to the code. I do have a few comments - mainly related to doing a few more #define constants and documenting things, but also one related to compatibility of the code across non-Linux UNIX-like platforms.
cc61626 to
7935214
Compare
eugen-keeper
left a comment
There was a problem hiding this comment.
The formatted process titles expose connection metadata (username, host, port) in ps and /proc, where other local users may potentially see it. Do we consider that acceptable for typical guacd deployments?
I had concerns as well, especially for the username, as the other information is readily available to non-root users.. My thought is that because of the Guacamole deployment model, I added a comment to |
7935214 to
3acab76
Compare
This is probably okay - I would tend to agree that typical deployments are not going to grant just anyone access to the system running guacd (or a system running a set of containers that includes guacd). Curious what @mike-jumper @corentin-soriano @sschiffli think about this, particularly if there are any objections? |
If there are objections, I could show the UID instead of the username. Another possibility is showing the connection name. |
Yeah - or, here's another idea that occurred to me, if the goal is to aid in "runtime observability", what a socket opened by guacd that could be read from that contains information on the guacd process(es)? This could be one of the following variants:
I'm kind of channeling the way HAProxy provides a statistics socket that can be read from and will output the information in various formats. This seems like it might achieve some of the observability requirements, but has the advantage of being able to use filesystem permissions to limit who can read the data and interact with the socket. I'm throwing that out as an idea - I'm not saying it necessarily should completely replace what you're doing, here, I still think this PR, as-is, is useful, and provided there aren't any objections to this information being accessible to anyone logged into the guacd system, I'm still okay with it. I'm just throwing it out as an idea, perhaps for a future change or to address some of the potential concerns, here. |
3acab76 to
333dbe1
Compare
To mitigate this, I've obfuscated the username, Details in the overview. |
I think it's not good practice, but that might not justify blocking this pull request. The target's IP address and port are already visible via netstat with a non-privileged account so I think the biggest risk is in the leakage of the username and the username naming format. Server access should be restricted to administrators, but an unauthorized user who has gained access to a non-privileged shell by exploiting a vulnerability in another process will be able to access this data. |
I think this would be a great addition, though I believe this would be a separate issue: having a subset of the information a HAProxy-like socket interface is useful in debugging and analyze system performance and scalability issues in the context of the entire system. I like the single socket approach, though it provides limited information (connection ID, protocol, PID (of connection process), and start/up time. There is a bi-directional socker between the guacd and the connection process that could be extended to provide the rest of the information (username, host, port...). I'll file a Jira for this. |
Does the username obfuscation mitigation mitigate the security concernse? I just pushed this a few minutes ago & updated the overview. |
|
333dbe1 to
95b33d3
Compare
95b33d3 to
57d287f
Compare
Overview
Add runtime process and thread naming support to
guacd. Connection processes now expose descriptive names (e.g.,vnc user@host:5900) and threads expose meaningful names for easier debugging, profiling, and monitoring.This change adds process title and thread naming support to guacd through three new APIs:
-
guac_process_title_init(): captures the process's original argv/environ region at startup and prepares it for later process title updates.--
guac_process_title_set(): updates the process title shown by tools such as ps, top, and htop, and also updates the main thread's comm name so process-oriented views reflect the active connection.--
guac_thread_name_set(): assigns a descriptive name to the calling thread using the platform's thread naming facilities.guac_process_title_set()rewrites the argv/environ memory region captured at startup, replacing the original command line with a connection-specific title. Because Linux exposes this region through/proc/<pid>/cmdline, tools such as ps, top, and htop automatically display the updated title. The main thread's comm name is also updated to keep process-oriented views consistent.Child processes can use
guac_process_title_set()to expose connection-specific names, while threads created can useguac_thread_name_set()to publish names such asvnc-main,user-input, orrdp-audio. This improves observability when debugging, profiling, or monitoring runningguacdprocesses.Thread Names
Username Obfuscation
Showing the full username (e.g. vnc bbennett@host:5900) in the process title is discloses information that could be accessed by a non-admin user on the guacd server and could be used as a security exploit. Even though guacd is typically deployed on locked down systems with only admin access, the username is obfuscated to mitigate this potential security issue.
For example, vnc bbennett@host:5900, displays as vnc bb****tt@host:5900; short usernames, such as root, are completely obfuscated: **telnet **@127.0.0.1:23.
Example Output