mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat: support --hostname-suffix flag on coder ssh (#17279)
Adds `hostname-suffix` flag to `coder ssh` command for use in SSH Config ProxyCommands. Also enforces that Coder server doesn't start the suffix with a dot. part of: #16828
This commit is contained in:
@ -620,6 +620,15 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
return xerrors.Errorf("parse ssh config options %q: %w", vals.SSHConfig.SSHConfigOptions.String(), err)
|
||||
}
|
||||
|
||||
// The workspace hostname suffix is always interpreted as implicitly beginning with a single dot, so it is
|
||||
// a config error to explicitly include the dot. This ensures that we always interpret the suffix as a
|
||||
// separate DNS label, and not just an ordinary string suffix. E.g. a suffix of 'coder' will match
|
||||
// 'en.coder' but not 'encoder'.
|
||||
if strings.HasPrefix(vals.WorkspaceHostnameSuffix.String(), ".") {
|
||||
return xerrors.Errorf("you must omit any leading . in workspace hostname suffix: %s",
|
||||
vals.WorkspaceHostnameSuffix.String())
|
||||
}
|
||||
|
||||
options := &coderd.Options{
|
||||
AccessURL: vals.AccessURL.Value(),
|
||||
AppHostname: appHostname,
|
||||
|
Reference in New Issue
Block a user