diff options
author | Erlang/OTP <[email protected]> | 2017-10-02 15:55:05 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2017-10-02 15:55:05 +0200 |
commit | f28ff5122f81c4104af14b1717b4bb9a49f537b8 (patch) | |
tree | 57494704e4217b499d4b79fd686401f859c9fbd0 /lib/ssh/src | |
parent | 2257a0a2debf0a390e887e09c85bf14ba186f278 (diff) | |
parent | b8d031c4fbb91454f72a0882afe5289fe0fce933 (diff) | |
download | otp-f28ff5122f81c4104af14b1717b4bb9a49f537b8.tar.gz otp-f28ff5122f81c4104af14b1717b4bb9a49f537b8.tar.bz2 otp-f28ff5122f81c4104af14b1717b4bb9a49f537b8.zip |
Merge branch 'hans/ssh/adjust_for_peers_version/OTP-14638' into maint-20
* hans/ssh/adjust_for_peers_version/OTP-14638:
ssh: exclude aes_gcm if peer is OpenSSH 6.2 (known bug)
Diffstat (limited to 'lib/ssh/src')
-rw-r--r-- | lib/ssh/src/ssh_transport.erl | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl index c48c0800e4..0052347912 100644 --- a/lib/ssh/src/ssh_transport.erl +++ b/lib/ssh/src/ssh_transport.erl @@ -251,9 +251,9 @@ key_exchange_init_msg(Ssh0) -> {SshPacket, Ssh} = ssh_packet(Msg, Ssh0), {Msg, SshPacket, Ssh}. -kex_init(#ssh{role = Role, opts = Opts, available_host_keys = HostKeyAlgs}) -> +kex_init(#ssh{role = Role, opts = Opts, available_host_keys = HostKeyAlgs} = Ssh) -> Random = ssh_bits:random(16), - PrefAlgs = ?GET_OPT(preferred_algorithms, Opts), + PrefAlgs = adjust_algs_for_peer_version(Role, ?GET_OPT(preferred_algorithms, Opts), Ssh), kexinit_message(Role, Random, PrefAlgs, HostKeyAlgs, Opts). key_init(client, Ssh, Value) -> @@ -261,7 +261,22 @@ key_init(client, Ssh, Value) -> key_init(server, Ssh, Value) -> Ssh#ssh{s_keyinit = Value}. - +adjust_algs_for_peer_version(client, PrefAlgs, #ssh{s_version=V}) -> + adjust_algs_for_peer_version(V, PrefAlgs); +adjust_algs_for_peer_version(server, PrefAlgs, #ssh{c_version=V}) -> + adjust_algs_for_peer_version(V, PrefAlgs). +%% +adjust_algs_for_peer_version("SSH-2.0-OpenSSH_6.2"++_, PrefAlgs) -> + C0 = proplists:get_value(cipher, PrefAlgs, same([])), + C = [{D,L} || D <- [client2server, server2client], + L <- [[K || K <- proplists:get_value(D, C0, []), + K =/= '[email protected]', + K =/= '[email protected]']] + ], + lists:keyreplace(cipher, 1, PrefAlgs, {cipher,C}); +adjust_algs_for_peer_version(_, PrefAlgs) -> + PrefAlgs. + kexinit_message(Role, Random, Algs, HostKeyAlgs, Opts) -> #ssh_msg_kexinit{ cookie = Random, |