Skip to content

Commit

Permalink
ssh UPDATE add new private key identities
Browse files Browse the repository at this point in the history
Added support for new privkey identities - PKCS8 and OpenSSH, which are
missing in the ietf-netconf-server model. Renamed config_new to
config_new_ssh.
  • Loading branch information
roman committed May 5, 2023
1 parent d978d2d commit 4391a5a
Show file tree
Hide file tree
Showing 14 changed files with 679 additions and 476 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ set(libsrc
src/session_client.c
src/session_server.c
src/server_config.c
src/config_new.c)
src/config_new_ssh.c)

if(ENABLE_SSH)
list(APPEND libsrc
Expand Down
6 changes: 3 additions & 3 deletions examples/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ init(struct ly_ctx **context, struct nc_pollsession **ps, const char *path, NC_T

/* this is where the YANG configuration data gets generated,
* start by creating hostkey configuration data */
rc = nc_server_config_ssh_new_hostkey(hostkey_path, NULL, *context, "endpt", "hostkey", &config);
rc = nc_server_config_new_ssh_hostkey(hostkey_path, NULL, *context, "endpt", "hostkey", &config);
if (rc) {
ERR_MSG_CLEANUP("Error creating new hostkey configuration data.\n");
}

/* create address and port configuration data */
rc = nc_server_config_ssh_new_address_port(SSH_ADDRESS, SSH_PORT, *context, "endpt", &config);
rc = nc_server_config_new_ssh_address_port(SSH_ADDRESS, SSH_PORT, *context, "endpt", &config);
if (rc) {
ERR_MSG_CLEANUP("Error creating new address and port configuration data.\n");
}

/* create client authentication configuration data */
rc = nc_server_config_ssh_new_client_auth_password(SSH_PASSWORD, *context, "endpt", SSH_USERNAME, &config);
rc = nc_server_config_new_ssh_client_auth_password(SSH_PASSWORD, *context, "endpt", SSH_USERNAME, &config);
if (rc) {
ERR_MSG_CLEANUP("Error creating client authentication configuration data.\n");
}
Expand Down
66 changes: 66 additions & 0 deletions modules/libnetconf2-netconf-server.yang
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,73 @@ module libnetconf2-netconf-server {
}
}

/*
identity ed25519-private-key-format {
base ct:private-key-format;
description
"This identity would indicate that the
private key is encoded in a ED25519PrivateKey
format. However no such format is currently
standardized or even exists.
If you wish to use a private key that uses
an ED25519 algorithm, you need to pick either
the private-key-info-format or
openssh-private-key-format identity.";
}
*/

identity private-key-info-format {
base ct:private-key-format;
description
"Indicates that the private key is encoded
as a PrivateKeyInfo structure (from RFC 5208).
The expected header of the private key:
-----BEGIN PRIVATE KEY-----
The expected footer of the private key:
-----END PRIVATE KEY-----
Supported private key algorithms to use with
this format are: RSA, EC and ED25519.
Commonly used public key format for this
type of private key is represented by the
SubjectPublicKeyInfo identity.";

reference
"RFC 5208: PKCS #8: Private-Key Information
Syntax Specification Version 1.2";
}

identity openssh-private-key-format {
base ct:private-key-format;
description
"Indicates that the private key is encoded
in the OpenSSH format.
The expected header of the private key:
-----BEGIN OPENSSH PRIVATE KEY-----
The expected footer of the private key:
-----END OPENSSH PRIVATE KEY-----
Supported private key algorithms to use with
this format are: RSA, EC and ED25519.
Commonly used public key format for this
type of private key is either the
SSH2 public key format (from RFC 4716)
or the Public key format defined in RFC 4253,
Section 6.6.";

reference
"The OpenSSH Private Key Format:
https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
RFC 4716:
The Secure Shell (SSH) Public Key File Format
RFC 4253:
The Secure Shell (SSH) Transport Layer Protocol";
}
}
56 changes: 0 additions & 56 deletions src/config_new.h

This file was deleted.

Loading

0 comments on commit 4391a5a

Please sign in to comment.