You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/06/26 00:25:37 UTC

[15/21] guacamole-server git commit: GUACAMOLE-527: Add error logging for known host checks.

GUACAMOLE-527: Add error logging for known host checks.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/2f0c6dcf
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/2f0c6dcf
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/2f0c6dcf

Branch: refs/heads/staging/1.0.0
Commit: 2f0c6dcfa3647960fa2b64c149b410a395edb6a9
Parents: 9112c4f
Author: Nick Couchman <vn...@apache.org>
Authored: Thu Apr 5 11:26:50 2018 -0400
Committer: Nick Couchman <ni...@cotyinc.com>
Committed: Mon Jun 25 08:31:37 2018 -0400

----------------------------------------------------------------------
 src/common-ssh/ssh.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/2f0c6dcf/src/common-ssh/ssh.c
----------------------------------------------------------------------
diff --git a/src/common-ssh/ssh.c b/src/common-ssh/ssh.c
index 0eb9fa1..ee60ccf 100644
--- a/src/common-ssh/ssh.c
+++ b/src/common-ssh/ssh.c
@@ -534,11 +534,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
     int fp_type;
     const char *fingerprint = libssh2_session_hostkey(session, &fp_len, &fp_type);
 
-    if (!fingerprint || strcmp(fingerprint, "") == 0) {
-        guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
-                "Could not retrieve fingerprint of SSH server %s", hostname);
-    }
-
+    /* Check fingerprint against known hosts */
     struct libssh2_knownhost *host;
     int kh_check = libssh2_knownhost_checkp(ssh_known_hosts, hostname, atoi(port),
                                          fingerprint, fp_len,
@@ -552,15 +548,23 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
                 "Host key match found.");
             break;
         case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND:
+            guac_client_log(client, GUAC_LOG_ERROR,
+                "Host key not found in known hosts entries for %s.", hostname);
             guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
-                "Host key not found in known hosts file.");
+                "Host key not found in known hosts entries.");
             break;
         case LIBSSH2_KNOWNHOST_CHECK_MISMATCH:
+            guac_client_log(client, GUAC_LOG_ERROR,
+                "Host entry found, but host key does not match for %s",
+                hostname);
             guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
                 "Host key does not match host entry.");
             break;
         case LIBSSH2_KNOWNHOST_CHECK_FAILURE:
         default:
+            guac_client_log(client, GUAC_LOG_ERROR,
+                "Error checking host key against known hosts for %s",
+                hostname);
             guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
                 "Host could not be checked against known hosts.");
     }