mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
ipnlocal: log failure to get ssh host keys
When reporting ssh host keys to control, log a warning if we're unable to get the SSH host keys. Updates tailscale/escalations#21 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
parent
9744ad47e3
commit
fad6bae764
@ -4125,7 +4125,11 @@ func (b *LocalBackend) applyPrefsToHostinfoLocked(hi *tailcfg.Hostinfo, prefs ip
|
|||||||
// TODO(bradfitz): this is called with b.mu held. Not ideal.
|
// TODO(bradfitz): this is called with b.mu held. Not ideal.
|
||||||
// If the filesystem gets wedged or something we could block for
|
// If the filesystem gets wedged or something we could block for
|
||||||
// a long time. But probably fine.
|
// a long time. But probably fine.
|
||||||
sshHostKeys = b.getSSHHostKeyPublicStrings()
|
var err error
|
||||||
|
sshHostKeys, err = b.getSSHHostKeyPublicStrings()
|
||||||
|
if err != nil {
|
||||||
|
b.logf("warning: unable to get SSH host keys, SSH will appear as disabled for this node: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hi.SSH_HostKeys = sshHostKeys
|
hi.SSH_HostKeys = sshHostKeys
|
||||||
|
|
||||||
|
@ -210,12 +210,16 @@ func (b *LocalBackend) getSystemSSH_HostKeys() (ret map[string]ssh.Signer) {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) getSSHHostKeyPublicStrings() (ret []string) {
|
func (b *LocalBackend) getSSHHostKeyPublicStrings() ([]string, error) {
|
||||||
signers, _ := b.GetSSH_HostKeys()
|
signers, err := b.GetSSH_HostKeys()
|
||||||
for _, signer := range signers {
|
if err != nil {
|
||||||
ret = append(ret, strings.TrimSpace(string(ssh.MarshalAuthorizedKey(signer.PublicKey()))))
|
return nil, err
|
||||||
}
|
}
|
||||||
return ret
|
var keyStrings []string
|
||||||
|
for _, signer := range signers {
|
||||||
|
keyStrings = append(keyStrings, strings.TrimSpace(string(ssh.MarshalAuthorizedKey(signer.PublicKey()))))
|
||||||
|
}
|
||||||
|
return keyStrings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// tailscaleSSHEnabled reports whether Tailscale SSH is currently enabled based
|
// tailscaleSSHEnabled reports whether Tailscale SSH is currently enabled based
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *LocalBackend) getSSHHostKeyPublicStrings() []string {
|
func (b *LocalBackend) getSSHHostKeyPublicStrings() ([]string, error) {
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) getSSHUsernames(*tailcfg.C2NSSHUsernamesRequest) (*tailcfg.C2NSSHUsernamesResponse, error) {
|
func (b *LocalBackend) getSSHUsernames(*tailcfg.C2NSSHUsernamesRequest) (*tailcfg.C2NSSHUsernamesResponse, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user