ipn/ipnlocal: ignore empty SSH host key files

Change-Id: I332b0d7d01386111d0af4adf98c96c04d3d12fbb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-07-22 10:41:21 -07:00 committed by Brad Fitzpatrick
parent 227c6b2a53
commit ba91f57ddd
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@
package ipnlocal
import (
"bytes"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/elliptic"
@ -119,7 +120,7 @@ func (b *LocalBackend) getSystemSSH_HostKeys() (ret []ssh.Signer, err error) {
for _, typ := range keyTypes {
filename := "/etc/ssh/ssh_host_" + typ + "_key"
hostKey, err := ioutil.ReadFile(filename)
if os.IsNotExist(err) {
if os.IsNotExist(err) || len(bytes.TrimSpace(hostKey)) == 0 {
continue
}
if err != nil {