From 6091305bb3a1976647c75d622833b6d1f4268c63 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:33:01 -0800 Subject: [PATCH] SSH Quick Fixes (#385) * fix: allow ssh user to use numbers/capital letters Prior to this change, usernames could not start with numbers and could not contain capital letters at all. Note that the username can also start with capital letters. * fix: update ssh_config with IdentityFiles fix This adds the update that provides the ssh2 defaults for IdentityFiles. This will allow the usual defaults to be searched when none are explicitly provided. * fix: overwrite identity files instead of appending This change makes it so a waveterm configured identity file will overwrite the one in the config instead of attempting to append it. This matches the behavior of openssh. * style: use regular font for markdown user input This makes the Markdown User Input indistinct from user input without markdown. It changes the font and makes a couple small adjustments to the font size and line height. * fix: use font property instead of font-family The markdown css for User Input can be simplified with the font being set by the "font" property rather than the "font-family" property. --- go.work.sum | 4 ++-- public/themes/default.css | 2 +- src/app/common/modals/userinput.less | 4 ++++ wavesrv/go.mod | 2 +- wavesrv/pkg/cmdrunner/cmdrunner.go | 2 +- wavesrv/pkg/remote/sshclient.go | 10 ++++++++-- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/go.work.sum b/go.work.sum index 4eb46940..0117a52a 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,9 +1,9 @@ github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 h1:3/gm/JTX9bX8CpzTgIlrtYpB3EVBDxyg/GY/QdcIEZw= github.com/google/go-github/v57 v57.0.0 h1:L+Y3UPTY8ALM8x+TV0lg+IEBI+upibemtBD8Q9u7zHs= -github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8= -github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/wavetermdev/ssh_config v0.0.0-20240306041034-17e2087ebde2 h1:onqZrJVap1sm15AiIGTfWzdr6cEF0KdtddeuuOVhzyY= +github.com/wavetermdev/ssh_config v0.0.0-20240306041034-17e2087ebde2/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/public/themes/default.css b/public/themes/default.css index b810819a..00321f1d 100644 --- a/public/themes/default.css +++ b/public/themes/default.css @@ -17,7 +17,7 @@ */ /* base fonts */ - --base-font: normal 15px "Lato", sans-serif; + --base-font: normal 15px / normal "Lato", sans-serif; --title-font-size: 18px; --input-bg-color: #171717; diff --git a/src/app/common/modals/userinput.less b/src/app/common/modals/userinput.less index 71f70f4d..f86c11ca 100644 --- a/src/app/common/modals/userinput.less +++ b/src/app/common/modals/userinput.less @@ -11,3 +11,7 @@ } } } + +.markdown { + font: var(--base-font); +} diff --git a/wavesrv/go.mod b/wavesrv/go.mod index 99c6a4b0..252b64f2 100644 --- a/wavesrv/go.mod +++ b/wavesrv/go.mod @@ -34,4 +34,4 @@ require ( replace github.com/wavetermdev/waveterm/waveshell => ../waveshell -replace github.com/kevinburke/ssh_config => github.com/wavetermdev/ssh_config v0.0.0-20240109090616-36c8da3d7376 +replace github.com/kevinburke/ssh_config => github.com/wavetermdev/ssh_config v0.0.0-20240306041034-17e2087ebde2 diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 17700fd7..6351b358 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -124,7 +124,7 @@ var SetVarScopes = []SetVarScope{ {ScopeName: "remote", VarNames: []string{}}, } -var userHostRe = regexp.MustCompile(`^(sudo@)?([a-z][a-z0-9._@\\-]*)@([a-z0-9][a-z0-9.-]*)(?::([0-9]+))?$`) +var userHostRe = regexp.MustCompile(`^(sudo@)?([a-zA-Z0-9][a-zA-Z0-9._@\\-]*)@([a-z0-9][a-z0-9.-]*)(?::([0-9]+))?$`) var remoteAliasRe = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9._-]*$") var genericNameRe = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_ .()<>,/\"'\\[\\]{}=+$@!*-]*$") var rendererRe = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_.:-]*$") diff --git a/wavesrv/pkg/remote/sshclient.go b/wavesrv/pkg/remote/sshclient.go index 5118e27e..ed770ca2 100644 --- a/wavesrv/pkg/remote/sshclient.go +++ b/wavesrv/pkg/remote/sshclient.go @@ -612,8 +612,14 @@ func combineSshKeywords(opts *sstore.SSHOpts, configKeywords *SshKeywords) (*Ssh sshKeywords.Port = "22" } - sshKeywords.IdentityFile = []string{opts.SSHIdentity} - sshKeywords.IdentityFile = append(sshKeywords.IdentityFile, configKeywords.IdentityFile...) + // this is more complicated than it needs to be since we are already storing the identity + // file for remotes, even if they come from the ssh config. it should be simplified with + // future rework to the connection user interface + if opts.SSHIdentity == "" || (len(configKeywords.IdentityFile) > 0 && configKeywords.IdentityFile[0] == opts.SSHIdentity) { + sshKeywords.IdentityFile = configKeywords.IdentityFile + } else { + sshKeywords.IdentityFile = []string{opts.SSHIdentity} + } // these are not officially supported in the waveterm frontend but can be configured // in ssh config files