aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-10-10 21:58:46 +0200
committerHans Nilsson <[email protected]>2017-10-30 11:59:23 +0100
commit9fc2073320b27f003764c2d78541a41e306a7f2a (patch)
tree5803fb763b40ead2c658bcb702c3a617a338cbd3 /lib/ssh/src/ssh.erl
parent70114aab0eeed0ba10f5ee7497362dcb62d9d892 (diff)
downloadotp-9fc2073320b27f003764c2d78541a41e306a7f2a.tar.gz
otp-9fc2073320b27f003764c2d78541a41e306a7f2a.tar.bz2
otp-9fc2073320b27f003764c2d78541a41e306a7f2a.zip
ssh: Server checks host key files at start and at accept
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r--lib/ssh/src/ssh.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index 1a5d48baca..032d87bdad 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -188,6 +188,7 @@ daemon(Port) ->
daemon(Socket, UserOptions) when is_port(Socket) ->
try
#{} = Options = ssh_options:handle_options(server, UserOptions),
+
case valid_socket_to_use(Socket, ?GET_OPT(transport,Options)) of
ok ->
{ok, {IP,Port}} = inet:sockname(Socket),
@@ -461,6 +462,9 @@ open_listen_socket(_Host0, Port0, Options0) ->
%%%----------------------------------------------------------------
finalize_start(Host, Port, Profile, Options0, F) ->
try
+ %% throws error:Error if no usable hostkey is found
+ ssh_connection_handler:available_hkey_algorithms(server, Options0),
+
sshd_sup:start_child(Host, Port, Profile, Options0)
of
{error, {already_started, _}} ->
@@ -470,6 +474,8 @@ finalize_start(Host, Port, Profile, Options0, F) ->
Result = {ok,_} ->
F(Options0, Result)
catch
+ error:{shutdown,Err} ->
+ {error,Err};
exit:{noproc, _} ->
{error, ssh_not_started}
end.