Title: Use motd for all output in `coder ssh [--stdio]` commands · Issue #4927 · coder/coder · GitHub
Open Graph Title: Use motd for all output in `coder ssh [--stdio]` commands · Issue #4927 · coder/coder
X Title: Use motd for all output in `coder ssh [--stdio]` commands · Issue #4927 · coder/coder
Description: We have multiple scenarios in which we print output during SSH commands (both ssh coder... and coder ssh ...): CLI/server version mismatch (currently prints to stderr even when non-tty) License issues (currently prints to stderr even whe...
Open Graph Description: We have multiple scenarios in which we print output during SSH commands (both ssh coder... and coder ssh ...): CLI/server version mismatch (currently prints to stderr even when non-tty) License iss...
X Description: We have multiple scenarios in which we print output during SSH commands (both ssh coder... and coder ssh ...): CLI/server version mismatch (currently prints to stderr even when non-tty) License iss...
Opengraph URL: https://github.com/coder/coder/issues/4927
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use motd for all output in `coder ssh [--stdio]` commands ","articleBody":"We have multiple scenarios in which we print output during SSH commands (both `ssh coder...` and `coder ssh ...`):\r\n\r\n- CLI/server version mismatch (currently prints to stderr even when non-tty)\r\n- License issues (currently prints to stderr even when non-tty)\r\n- Workspace out of date (#4926)\r\n\r\nThis is not ideal since we must not get in the way of using SSH normally. Things like:\r\n\r\n```sh\r\nout=$(ssh coder.workspace ls)\r\nerr=$(ssh coder.workspace ls 2>&1 1>/dev/null)\r\n```\r\n\r\nshould work without dirtying the output.\r\n\r\nThe ideal way to do this would be to utilize [motd](https://github.com/openssh/openssh-portable/blob/25bd659cc72268f2858c5415740c442ee950049f/session.c#L784) for all SSH messaging. This would, however, mean that messages are delayed until connection is established. Which would be problematic if we want to inform the users that the cli version is mismatched and we can't establish a connection because of it.\r\n\r\nUltimately we may want to have both methods, reserving the non-motd output for critical messages.\r\n\r\nAt minimum, we should comb over how we are printing these messages and ensure they’re hidden in non-tty cases.\r\n\r\n_Edit: This issue was originally created with the incorrect assumption that banner translates to motd, banner is in fact the message shown before authentication, motd is shown just before the login shell._\r\n\r\n---\r\n\r\n~~I think printing to stderr is a good first step, but in the future I think it would be a good idea to start using [`BannerCallback`](https://pkg.go.dev/golang.org/x/crypto/ssh#BannerCallback) instead.~~\r\n\r\n~~At least on systems with `/etc/motd` and OpenSSH, messages don't appear in non-interactive modes like `ssh host ls`. I believe this should (automatically) be the case when using `BannerCallback` too.~~\r\n\r\n~~But to do that, we'd also need to fix all other occurrences of printing to stdout in the `coder ssh [--stdio]` command.~~\r\n\r\n_Originally posted by @mafredri in https://github.com/coder/coder/pull/4926#pullrequestreview-1170249191_\r\n ","author":{"url":"https://github.com/mafredri","@type":"Person","name":"mafredri"},"datePublished":"2022-11-07T13:13:37Z","url":"https://github.com/coder/coder/issues/4927"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c232cc6-e56a-97da-59e7-e9fd9033e501 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A016:215B92:23EF728:2FD53EF:6B019759 |
| html-safe-nonce | 0b7b8710e89a2ac51cd4696ee21393f2038d0ad2d032688f59d039714fe09feb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDE2OjIxNUI5MjoyM0VGNzI4OjJGRDUzRUY6NkIwMTk3NTkiLCJ2aXNpdG9yX2lkIjoiMzI5MjM4NTQ5MjY4Mjc3NDM2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dac8eb1cbb2350b28978cc14fdbf0f2a9b7dac4b58e5ff5c1416f8bfa5c4f7cd |
| hovercard-subject-tag | issue:1438348706 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/4927/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fd9944f3117d7fc124798365133f397edabdeb6e6bd199edce6cc860a98236c/coder/coder/issues/4927 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fd9944f3117d7fc124798365133f397edabdeb6e6bd199edce6cc860a98236c/coder/coder/issues/4927 |
| og:image:alt | We have multiple scenarios in which we print output during SSH commands (both ssh coder... and coder ssh ...): CLI/server version mismatch (currently prints to stderr even when non-tty) License iss... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mafredri |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width