Skip to content

Commit

Permalink
ws: Don't capture stderr for Cockpit Client when debugging
Browse files Browse the repository at this point in the history
We capture the output of our ssh command in order to provide useful
error messages to the user of Cockpit client in case of failures.
Setting COCKPIT_DEBUG will result in a flood of messages to stderr,
however, and it's more useful to see those on the terminal than in the
login window with their formatting destroyed.

This makes it possible to do something like:

    flatpak run --env=COCKPIT_DEBUG=all org.cockpit_project.CockpitClient
  • Loading branch information
allisonkarlitskaya authored and martinpitt committed Jun 12, 2023
1 parent dd3ea02 commit 9ad3f39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ws/cockpitauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,12 @@ cockpit_session_launch (CockpitAuth *self,

/* We capture stderr only for Cockpit Client; we don't want to
* send log messages to potential remote attackers.
*
* Only do that if COCKPIT_DEBUG is off, though: otherwise the
* stderr is going to be too long to make sense of in the browser.
*/
capture_stderr = cockpit_conf_bool ("WebService", "X-For-CockpitClient", FALSE);
if (g_getenv("COCKPIT_DEBUG") == NULL)
capture_stderr = cockpit_conf_bool ("WebService", "X-For-CockpitClient", FALSE);

if (command == NULL && unix_path == NULL)
command = cockpit_ws_ssh_program;
Expand Down

0 comments on commit 9ad3f39

Please sign in to comment.