GUACAMOLE-527: Add error logging for known host checks.
This commit is contained in:
parent
9112c4f32f
commit
2f0c6dcfa3
@ -534,11 +534,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
|
|||||||
int fp_type;
|
int fp_type;
|
||||||
const char *fingerprint = libssh2_session_hostkey(session, &fp_len, &fp_type);
|
const char *fingerprint = libssh2_session_hostkey(session, &fp_len, &fp_type);
|
||||||
|
|
||||||
if (!fingerprint || strcmp(fingerprint, "") == 0) {
|
/* Check fingerprint against known hosts */
|
||||||
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
|
|
||||||
"Could not retrieve fingerprint of SSH server %s", hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct libssh2_knownhost *host;
|
struct libssh2_knownhost *host;
|
||||||
int kh_check = libssh2_knownhost_checkp(ssh_known_hosts, hostname, atoi(port),
|
int kh_check = libssh2_knownhost_checkp(ssh_known_hosts, hostname, atoi(port),
|
||||||
fingerprint, fp_len,
|
fingerprint, fp_len,
|
||||||
@ -552,15 +548,23 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
|
|||||||
"Host key match found.");
|
"Host key match found.");
|
||||||
break;
|
break;
|
||||||
case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND:
|
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,
|
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;
|
break;
|
||||||
case LIBSSH2_KNOWNHOST_CHECK_MISMATCH:
|
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,
|
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
|
||||||
"Host key does not match host entry.");
|
"Host key does not match host entry.");
|
||||||
break;
|
break;
|
||||||
case LIBSSH2_KNOWNHOST_CHECK_FAILURE:
|
case LIBSSH2_KNOWNHOST_CHECK_FAILURE:
|
||||||
default:
|
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,
|
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
|
||||||
"Host could not be checked against known hosts.");
|
"Host could not be checked against known hosts.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user