1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Support ed25519 keys (#50)

Continue to support ecdsa keys, but don't generate them for new installs
This commit is contained in:
Steve Wills 2018-12-01 12:25:54 -05:00 committed by Nicolas Viennot
parent e4037b703c
commit 600835f606
2 changed files with 12 additions and 3 deletions

View File

@ -14,4 +14,4 @@ gen_key() {
} }
mkdir -p keys mkdir -p keys
gen_key rsa && gen_key ecdsa || exit 1 gen_key rsa && gen_key ed25519 || exit 1

View File

@ -326,6 +326,9 @@ static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int por
ssh_bind bind; ssh_bind bind;
char buffer[PATH_MAX]; char buffer[PATH_MAX];
int ssh_log_level; int ssh_log_level;
ssh_key rsakey = NULL;
ssh_key ecdsakey = NULL;
ssh_key ed25519key = NULL;
ssh_log_level = SSH_LOG_WARNING + max(log_get_level() - LOG_NOTICE, 0); ssh_log_level = SSH_LOG_WARNING + max(log_get_level() - LOG_NOTICE, 0);
@ -342,10 +345,16 @@ static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int por
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level); ssh_bind_options_set(bind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level);
sprintf(buffer, "%s/ssh_host_rsa_key", keys_dir); sprintf(buffer, "%s/ssh_host_rsa_key", keys_dir);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_RSAKEY, buffer); ssh_pki_import_privkey_file(buffer, NULL, NULL, NULL, &rsakey);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_IMPORT_KEY, rsakey);
sprintf(buffer, "%s/ssh_host_ed25519_key", keys_dir);
ssh_pki_import_privkey_file(buffer, NULL, NULL, NULL, &ed25519key);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_IMPORT_KEY, ed25519key);
sprintf(buffer, "%s/ssh_host_ecdsa_key", keys_dir); sprintf(buffer, "%s/ssh_host_ecdsa_key", keys_dir);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_ECDSAKEY, buffer); ssh_pki_import_privkey_file(buffer, NULL, NULL, NULL, &ecdsakey);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_IMPORT_KEY, ecdsakey);
if (ssh_bind_listen(bind) < 0) if (ssh_bind_listen(bind) < 0)
tmate_fatal("Error listening to socket: %s\n", ssh_get_error(bind)); tmate_fatal("Error listening to socket: %s\n", ssh_get_error(bind));