Access/ssh-config: generate consistent ssh_config

* Prefer text/template over html/template to avoid unwanted HTML encoding
* Use templated "cfpipe-{{.Hostname}}"
* Fix IdentityFile suffix in "cfpipe" to use key generated by "ssh-gen"
This commit is contained in:
herver 2019-06-03 22:22:54 +02:00 committed by GitHub
parent babcd9fe2b
commit d51446d5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -3,10 +3,10 @@ package access
import (
"errors"
"fmt"
"html/template"
"net/url"
"os"
"strings"
"text/template"
"github.com/cloudflare/cloudflared/cmd/cloudflared/shell"
"github.com/cloudflare/cloudflared/cmd/cloudflared/token"
@ -31,12 +31,12 @@ Add this configuration block to your {{.Home}}/.ssh/config:
Host {{.Hostname}}
{{- if .ShortLivedCerts}}
ProxyCommand bash -c '{{.Cloudflared}} access ssh-gen --hostname %h; ssh -tt cfpipe >&2 <&1'
ProxyCommand bash -c '{{.Cloudflared}} access ssh-gen --hostname %h; ssh -tt cfpipe-{{.Hostname}} >&2 <&1'
Host cfpipe-{{.Hostname}}
HostName {{.Hostname}}
ProxyCommand {{.Cloudflared}} access ssh --hostname %h
IdentityFile ~/.cloudflared/{{.Hostname}}.me-cf_key
IdentityFile ~/.cloudflared/{{.Hostname}}-cf_key
CertificateFile ~/.cloudflared/{{.Hostname}}-cf_key-cert.pub
{{- else}}
ProxyCommand {{.Cloudflared}} access ssh --hostname %h