MCPcopy
hub / github.com/cloudflare/cloudflared / sshConfig

Function sshConfig

cmd/cloudflared/access/cmd.go:412–428  ·  view source on GitHub ↗

sshConfig prints an example SSH config to stdout

(c *cli.Context)

Source from the content-addressed store, hash-verified

410
411// sshConfig prints an example SSH config to stdout
412func sshConfig(c *cli.Context) error {
413 genCertBool := c.Bool(sshGenCertFlag)
414 hostname := c.String(sshHostnameFlag)
415 if hostname == "" {
416 hostname = "[your hostname]"
417 }
418
419 type config struct {
420 Home string
421 ShortLivedCerts bool
422 Hostname string
423 Cloudflared string
424 }
425
426 t := template.Must(template.New("sshConfig").Parse(sshConfigTemplate))
427 return t.Execute(os.Stdout, config{Home: os.Getenv("HOME"), ShortLivedCerts: genCertBool, Hostname: hostname, Cloudflared: cloudflaredPath()})
428}
429
430// sshGen generates a short lived certificate for provided hostname
431func sshGen(c *cli.Context) error {

Callers

nothing calls this directly

Calls 4

cloudflaredPathFunction · 0.85
BoolMethod · 0.80
ExecuteMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected