Skip to content

feat: Add user scoped git ssh keys #834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 6, 2022
Prev Previous commit
Next Next commit
tie up cli
  • Loading branch information
f0ssel committed Apr 4, 2022
commit e3c095024ca77f5a19daecf1d1f71f73a5545905
11 changes: 11 additions & 0 deletions cli/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/coder/coder/coderd"
"github.com/coder/coder/coderd/database"
"github.com/coder/coder/coderd/database/databasefake"
"github.com/coder/coder/coderd/gitsshkey"
"github.com/coder/coder/coderd/tunnel"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/provisioner/terraform"
Expand All @@ -57,6 +58,7 @@ func start() *cobra.Command {
useTunnel bool
traceDatadog bool
secureAuthCookie bool
sshKeygenAlgorithmRaw string
)
root := &cobra.Command{
Use: "start",
Expand Down Expand Up @@ -126,6 +128,12 @@ func start() *cobra.Command {
if err != nil {
return xerrors.Errorf("parse access url %q: %w", accessURL, err)
}

sshKeygenAlgorithm, err := gitsshkey.ParseSSHKeygenAlgorithm(sshKeygenAlgorithmRaw)
if err != nil {
return xerrors.Errorf("parse ssh keygen algorithm %s: %w", sshKeygenAlgorithmRaw, err)
}

logger := slog.Make(sloghuman.Sink(os.Stderr))
options := &coderd.Options{
AccessURL: accessURLParsed,
Expand All @@ -134,6 +142,7 @@ func start() *cobra.Command {
Pubsub: database.NewPubsubInMemory(),
GoogleTokenValidator: validator,
SecureAuthCookie: secureAuthCookie,
SSHKeygenAlgorithm: sshKeygenAlgorithm,
}

if !dev {
Expand Down Expand Up @@ -337,6 +346,8 @@ func start() *cobra.Command {
_ = root.Flags().MarkHidden("tunnel")
cliflag.BoolVarP(root.Flags(), &traceDatadog, "trace-datadog", "", "CODER_TRACE_DATADOG", false, "Send tracing data to a datadog agent")
cliflag.BoolVarP(root.Flags(), &secureAuthCookie, "secure-auth-cookie", "", "CODER_SECURE_AUTH_COOKIE", false, "Specifies if the 'Secure' property is set on browser session cookies")
cliflag.StringVarP(root.Flags(), &sshKeygenAlgorithmRaw, "ssh-keygen-algorithm", "", "CODER_SSH_KEYGEN_ALGORITHM", "ed25519", "Specifies the algorithm to user for generating ssh keys. "+
`Accepted values are "ed25519", "ecdsa", or "rsa4096"`)

return root
}
Expand Down