ubuntu@WSL でSSH接続でエラーが出る

NW機器へのSSH接続時に暗号化ネゴの失敗でつながらないときの対処法。

ubuntu:~$ ssh -l cisco 192.168.1.200
Unable to negotiate with 192.168.1.200 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

暗号化方式チェック。

ubuntu:~$ ssh -Q cipher
3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
rijndael-cbc@lysator.liu.se
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com

サポートはしている。有効化されていないのか。
ちなみにオプション -c で暗号化指定すると行ける。

Cisco側では以下メッセージが出ていた。

 client chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com 
server aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

やはりクライアントのオファーにcbcが入っていない・・・。

/etc/ssh/ssh_config を編集。

Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc # ここを追記
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes

確認。

ubuntu:~$ ssh -l cisco 192.168.1.200

Password:

これでいけるようになったけど, デフォルトで有効化されているものを確認するにはどうしたらいいのだ。

OpenSSHのリリースノート見たら, 7.5からCBCはデフォルトで無効化されていた。
ubuntuのapt-get upgrade で上げたからかな?