| 25 |
|
|
| 26 |
static const char SSH_HOST_RSA_KEY_FILE[] = "../conf/ssh_host_rsa_key"; |
static const char SSH_HOST_RSA_KEY_FILE[] = "../conf/ssh_host_rsa_key"; |
| 27 |
static const char SSH_HOST_ED25519_KEY_FILE[] = "../conf/ssh_host_ed25519_key"; |
static const char SSH_HOST_ED25519_KEY_FILE[] = "../conf/ssh_host_ed25519_key"; |
| 28 |
|
static const char SSH_HOST_ECDSA_KEY_FILE[] = "../conf/ssh_host_ecdsa_key"; |
| 29 |
|
|
| 30 |
static const char USER[] = "test"; |
static const char USER[] = "test"; |
| 31 |
static const char PASSWORD[] = "123456"; |
static const char PASSWORD[] = "123456"; |
| 128 |
|
|
| 129 |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_RSA_KEY_FILE) < 0) |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_RSA_KEY_FILE) < 0) |
| 130 |
{ |
{ |
| 131 |
log_error("Error setting SSH RSA key: %s\n", SSH_HOST_RSA_KEY_FILE); |
log_error("Error loading SSH RSA key: %s\n", SSH_HOST_RSA_KEY_FILE); |
| 132 |
} |
} |
| 133 |
else |
else |
| 134 |
{ |
{ |
| 136 |
} |
} |
| 137 |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_ED25519_KEY_FILE) < 0) |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_ED25519_KEY_FILE) < 0) |
| 138 |
{ |
{ |
| 139 |
log_error("Error setting SSH ED25519 key: %s\n", SSH_HOST_ED25519_KEY_FILE); |
log_error("Error loading SSH ED25519 key: %s\n", SSH_HOST_ED25519_KEY_FILE); |
| 140 |
|
} |
| 141 |
|
else |
| 142 |
|
{ |
| 143 |
|
ssh_key_valid = 1; |
| 144 |
|
} |
| 145 |
|
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, SSH_HOST_ECDSA_KEY_FILE) < 0) |
| 146 |
|
{ |
| 147 |
|
log_error("Error loading SSH ECDSA key: %s\n", SSH_HOST_ECDSA_KEY_FILE); |
| 148 |
} |
} |
| 149 |
else |
else |
| 150 |
{ |
{ |
| 160 |
|
|
| 161 |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostaddr) < 0 || |
if (ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, hostaddr) < 0 || |
| 162 |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port) < 0 || |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT, &port) < 0 || |
| 163 |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS, "ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-ed25519") < 0 || |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS, "+ssh-ed25519,ecdsa-sha2-nistp256,ssh-rsa") < 0 || |
| 164 |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level) < 0) |
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level) < 0) |
| 165 |
{ |
{ |
| 166 |
log_error("Error setting SSH bind options: %s\n", ssh_get_error(sshbind)); |
log_error("Error setting SSH bind options: %s\n", ssh_get_error(sshbind)); |