概要
でCA認証をしていたのですが、ある日急にsshできなくなったので原因を調査したところOpenSSH側のバグでした。
環境
- OpenSSH 7.8p1
- macOS Mojave 10.14.1
調査方法
まずhost側のログを出すようにしました。/etc/ssh/sshd_config
に以下の設定をして再起動します。
LogLevel VERBOSE
これによってssh時に以下のように弾かれていることがわかりました。
$ tail /var/log/auth.log sshd[4193]: Connection from xxx.xxx.xxx.xxx port 51242 on yyy.yyy.yyy.yyy port 22 sshd[4193]: Failed publickey for ubuntu from xxx.xxx.xxx.xxx port 51242 ssh2: RSA SHA256:0JRI...28 sshd[4193]: Connection closed by xxx.xxx.xxx.xxx port 51242 [preauth]
しかしこれだけでは原因は分かりませんでした。
次にclient側のログを詳細にしてみました。-v
オプションを付けます。
$ ssh -v yyy.yyy.yyy.yyy OpenSSH_7.8p1, LibreSSL 2.7.3 ... debug1: send_pubkey_test: no mutual signature algorithm debug1: No more authentication methods to try. yyy.yyy.yyy.yyy: Permission denied (publickey).
するとsend_pubkey_test: no mutual signature algorithm
という何やら怪しげな文言が出てきました。
これを検索してみると冒頭のバグの記事が出てきました。
原因
どうやら
- clientのOpenSSHが7.8
- CA認証である
- 鍵のタイプがRSA
上記全てに当てはまると今回のようにsshできなくなるようです。
解決方法
上記のどれかを満たさなければいいので、
- 7.7以前に戻す or 7.9p1以降にする
- CA認証をやめる
- 鍵タイプをECDSAなどにする
のどれか1つをやれば回避できます。
僕の場合はOpenSSH 7.9p1に更新したところ解決しました。