roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 1 | /** |
roman | e028ef9 | 2023-02-24 16:33:08 +0100 | [diff] [blame] | 2 | * @file server_config.h |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 3 | * @author Roman Janota <janota@cesnet.cz> |
| 4 | * @brief libnetconf2 server configuration |
| 5 | * |
| 6 | * @copyright |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 7 | * Copyright (c) 2023 CESNET, z.s.p.o. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 8 | * |
| 9 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 10 | * You may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * https://opensource.org/licenses/BSD-3-Clause |
| 14 | */ |
| 15 | |
| 16 | #ifndef NC_CONFIG_SERVER_H_ |
| 17 | #define NC_CONFIG_SERVER_H_ |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 23 | #include <stdarg.h> |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 24 | #include <stdint.h> |
| 25 | |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 26 | #include <libyang/libyang.h> |
| 27 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 28 | #include "session.h" |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 29 | |
| 30 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 31 | * @defgroup server_config Server Configuration |
| 32 | * @ingroup server |
| 33 | * |
| 34 | * @brief Server-side configuration creation and application |
| 35 | * @{ |
| 36 | */ |
| 37 | |
| 38 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 39 | * @} Server Configuration |
| 40 | */ |
| 41 | |
| 42 | /** |
| 43 | * @defgroup server_config_functions Server Configuration Functions |
| 44 | * @ingroup server_config |
| 45 | * |
| 46 | * @brief Server-side configuration functions |
| 47 | * @{ |
| 48 | */ |
| 49 | |
| 50 | /** |
| 51 | * @brief Implements all the required modules and their features in the context. |
| 52 | * Needs to be called before any other configuration functions. |
| 53 | * |
| 54 | * If ctx is : |
| 55 | * - NULL: a new context will be created and if the call is successful you have to free it, |
| 56 | * - non NULL: modules will simply be implemented. |
| 57 | * |
| 58 | * Implemented modules: ietf-netconf-server, ietf-x509-cert-to-name, ietf-crypto-types, |
| 59 | * ietf-tcp-common, ietf-ssh-common, iana-ssh-encryption-algs, iana-ssh-key-exchange-algs, |
| 60 | * iana-ssh-mac-algs, iana-ssh-public-key-algs, ietf-keystore, ietf-ssh-server, ietf-truststore, |
| 61 | * ietf-tls-server and libnetconf2-netconf-server. |
| 62 | * |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 63 | * @param[in, out] ctx Optional context in which the modules will be implemented. Created if *ctx is null. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 64 | * @return 0 on success, 1 on error. |
| 65 | */ |
| 66 | int nc_server_config_load_modules(struct ly_ctx **ctx); |
| 67 | |
| 68 | /** |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 69 | * @brief Configure server based on the given diff. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 70 | * |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 71 | * Context must already have implemented the required modules, see ::nc_server_config_load_modules(). |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 72 | * |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 73 | * @param[in] diff YANG diff belonging to either ietf-netconf-server, ietf-keystore or ietf-truststore modules. |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 74 | * The top level node HAS to have an operation (create, replace, delete or none). |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 75 | * @return 0 on success, 1 on error. |
| 76 | */ |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 77 | int nc_server_config_setup_diff(const struct lyd_node *diff); |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 78 | |
| 79 | /** |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 80 | * @brief Configure server based on the given data. |
| 81 | * |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 82 | * Behaves as if all the nodes in data had the replace operation. That means that the current configuration will be deleted |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 83 | * and just the given data will be applied. |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 84 | * Context must already have implemented the required modules, see ::nc_server_config_load_modules(). |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 85 | * |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 86 | * @param[in] data YANG data belonging to either ietf-netconf-server, ietf-keystore or ietf-truststore modules. |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 87 | * This data __must be valid__. No node can have an operation attribute. |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 88 | * @return 0 on success, 1 on error. |
| 89 | */ |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 90 | int nc_server_config_setup_data(const struct lyd_node *data); |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 91 | |
| 92 | /** |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 93 | * @brief Configure server based on the given data stored in a file. |
| 94 | * |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 95 | * Wrapper around ::nc_server_config_setup_data() hiding work with parsing the data. |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 96 | * Context must already have implemented the required modules, see ::nc_server_config_load_modules(). |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 97 | * |
| 98 | * @param[in] ctx libyang context. |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 99 | * @param[in] path Path to a file with ietf-netconf-server, ietf-keystore or ietf-truststore YANG data. |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 100 | * This data __must be valid__. No node can have an operation attribute. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 101 | * @return 0 on success, 1 on error. |
| 102 | */ |
| 103 | int nc_server_config_setup_path(const struct ly_ctx *ctx, const char *path); |
| 104 | |
roman | 2eab474 | 2023-06-06 10:00:26 +0200 | [diff] [blame] | 105 | #ifdef NC_ENABLED_SSH_TLS |
| 106 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 107 | /** |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 108 | * @brief Creates new YANG configuration data nodes for address and port. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 109 | * |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 110 | * @param[in] ctx libyang context. |
| 111 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 112 | * If an endpoint with this identifier already exists, its contents might be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 113 | * @param[in] transport Either SSH or TLS transport for the given endpoint. |
| 114 | * @param[in] address New listening address. |
| 115 | * @param[in] port New listening port. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 116 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 117 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 118 | * @return 0 on success, non-zero otherwise. |
roman | 45cec4e | 2023-02-17 10:21:39 +0100 | [diff] [blame] | 119 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 120 | int nc_server_config_add_address_port(const struct ly_ctx *ctx, const char *endpt_name, NC_TRANSPORT_IMPL transport, |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 121 | const char *address, uint16_t port, struct lyd_node **config); |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 122 | |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 123 | #endif /* NC_ENABLED_SSH_TLS */ |
| 124 | |
| 125 | /** |
| 126 | * @brief Deletes an endpoint from the YANG data. |
| 127 | * |
| 128 | * @param[in] endpt_name Optional identifier of an endpoint to be deleted. |
| 129 | * If NULL, all of the endpoints will be deleted. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 130 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 131 | * @return 0 on success, non-zero otherwise. |
| 132 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 133 | int nc_server_config_del_endpt(const char *endpt_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 134 | |
| 135 | #ifdef NC_ENABLED_SSH_TLS |
| 136 | |
| 137 | /** |
| 138 | * @brief Creates new YANG data nodes for an asymmetric key in the keystore. |
| 139 | * |
| 140 | * @param[in] ctx libyang context. |
roman | 1314591 | 2023-08-17 15:36:54 +0200 | [diff] [blame] | 141 | * @param[in] ti Transport in which the key pair will be used. Either SSH or TLS. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 142 | * @param[in] asym_key_name Identifier of the asymmetric key pair. |
| 143 | * This identifier is used to reference the key pair. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 144 | * @param[in] privkey_path Path to a private key file. |
| 145 | * @param[in] pubkey_path Optional path a public key file. |
| 146 | * If not supplied, it will be generated from the private key. |
| 147 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 148 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 149 | * @return 0 on success, non-zero otherwise. |
| 150 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 151 | int nc_server_config_add_keystore_asym_key(const struct ly_ctx *ctx, NC_TRANSPORT_IMPL ti, const char *asym_key_name, |
roman | 1314591 | 2023-08-17 15:36:54 +0200 | [diff] [blame] | 152 | const char *privkey_path, const char *pubkey_path, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * @brief Deletes a keystore's asymmetric key from the YANG data. |
| 156 | * |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 157 | * @param[in] asym_key_name Optional identifier of the asymmetric key to be deleted. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 158 | * If NULL, all of the asymmetric keys in the keystore will be deleted. |
| 159 | * @param[in,out] config Configuration YANG data tree. |
| 160 | * @return 0 on success, non-zero otherwise. |
| 161 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 162 | int nc_server_config_del_keystore_asym_key(const char *asym_key_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 163 | |
| 164 | /** |
| 165 | * @brief Creates new YANG data nodes for a certificate in the keystore. |
| 166 | * |
roman | 6430c15 | 2023-10-12 11:28:47 +0200 | [diff] [blame] | 167 | * A certificate can not exist without its asymmetric key, so you must create an asymmetric key |
| 168 | * with the same identifier you pass to this function. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 169 | * |
| 170 | * @param[in] ctx libyang context. |
| 171 | * @param[in] asym_key_name Arbitrary identifier of the asymmetric key. |
| 172 | * If an asymmetric key pair with this name already exists, its contents will be changed. |
| 173 | * @param[in] cert_name Arbitrary identifier of the key pair's certificate. |
| 174 | * If a certificate with this name already exists, its contents will be changed. |
| 175 | * @param[in] cert_path Path to the PEM encoded certificate file. |
| 176 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 177 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 178 | * @return 0 on success, non-zero otherwise. |
| 179 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 180 | int nc_server_config_add_keystore_cert(const struct ly_ctx *ctx, const char *asym_key_name, const char *cert_name, |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 181 | const char *cert_path, struct lyd_node **config); |
| 182 | |
| 183 | /** |
| 184 | * @brief Deletes a keystore's certificate from the YANG data. |
| 185 | * |
| 186 | * @param[in] asym_key_name Identifier of an existing asymmetric key pair. |
| 187 | * @param[in] cert_name Optional identifier of a certificate to be deleted. |
| 188 | * If NULL, all of the certificates belonging to the asymmetric key pair will be deleted. |
| 189 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 190 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 191 | * @return 0 on success, non-zero otherwise. |
| 192 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 193 | int nc_server_config_del_keystore_cert(const char *asym_key_name, const char *cert_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 194 | |
| 195 | /** |
| 196 | * @brief Creates new YANG data nodes for a public key in the truststore. |
| 197 | * |
| 198 | * @param[in] ctx libyang context. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 199 | * @param[in] pub_bag_name Arbitrary identifier of the public key bag. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 200 | * This name is used to reference the public keys in the bag. |
| 201 | * If a public key bag with this name already exists, its contents will be changed. |
| 202 | * @param[in] pubkey_name Arbitrary identifier of the public key. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 203 | * If a public key with this name already exists in the given bag, its contents will be changed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 204 | * @param[in] pubkey_path Path to a file containing a public key. |
| 205 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 206 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 207 | * @return 0 on success, non-zero otherwise. |
| 208 | */ |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 209 | int nc_server_config_add_truststore_pubkey(const struct ly_ctx *ctx, const char *pub_bag_name, const char *pubkey_name, |
| 210 | const char *pubkey_path, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 211 | |
| 212 | /** |
| 213 | * @brief Deletes a truststore's public key from the YANG data. |
| 214 | * |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 215 | * @param[in] pub_bag_name Identifier of an existing public key bag. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 216 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 217 | * If NULL, all of the public keys in the given bag will be deleted. |
| 218 | * @param[in,out] config Configuration YANG data tree. |
| 219 | * @return 0 on success, non-zero otherwise. |
| 220 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 221 | int nc_server_config_del_truststore_pubkey(const char *pub_bag_name, const char *pubkey_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 222 | |
| 223 | /** |
| 224 | * @brief Creates new YANG data nodes for a certificate in the truststore. |
| 225 | * |
| 226 | * @param[in] ctx libyang context. |
| 227 | * @param[in] cert_bag_name Arbitrary identifier of the certificate bag. |
| 228 | * This name is used to reference the certificates in the bag. |
| 229 | * If a certificate bag with this name already exists, its contents will be changed. |
| 230 | * @param[in] cert_name Arbitrary identifier of the certificate. |
| 231 | * If a certificate with this name already exists in the given bag, its contents will be changed. |
| 232 | * @param[in] cert_path Path to a file containing a PEM encoded certificate. |
| 233 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 234 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 235 | * @return 0 on success, non-zero otherwise. |
| 236 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 237 | int nc_server_config_add_truststore_cert(const struct ly_ctx *ctx, const char *cert_bag_name, const char *cert_name, |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 238 | const char *cert_path, struct lyd_node **config); |
| 239 | |
| 240 | /** |
| 241 | * @brief Deletes a truststore's certificate from the YANG data. |
| 242 | * |
| 243 | * @param[in] cert_bag_name Identifier of an existing certificate bag. |
| 244 | * @param[in] cert_name Optional identifier of a certificate to be deleted. |
| 245 | * If NULL, all of the certificates in the given bag will be deleted. |
| 246 | * @param[in,out] config Configuration YANG data tree. |
| 247 | * @return 0 on success, non-zero otherwise. |
| 248 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 249 | int nc_server_config_del_truststore_cert(const char *cert_bag_name, |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 250 | const char *cert_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 251 | |
| 252 | /** |
roman | d05b2ad | 2024-01-23 12:02:40 +0100 | [diff] [blame] | 253 | * @brief Gets the hostkey algorithms supported by the server from the 'iana-ssh-public-key-algs' YANG module. |
| 254 | * |
| 255 | * @param[in] ctx libyang context. |
| 256 | * @param[out] hostkey_algs Container with leaf-lists containing the supported algorithms. |
| 257 | * @return 0 on success, non-zero otherwise. |
| 258 | */ |
| 259 | int nc_server_config_oper_get_hostkey_algs(const struct ly_ctx *ctx, struct lyd_node **hostkey_algs); |
| 260 | |
| 261 | /** |
| 262 | * @brief Gets the key exchange algorithms supported by the server from the 'iana-ssh-key-exchange-algs' YANG module. |
| 263 | * |
| 264 | * @param[in] ctx libyang context. |
| 265 | * @param[out] kex_algs Container with leaf-lists containing the supported algorithms. |
| 266 | * @return 0 on success, non-zero otherwise. |
| 267 | */ |
| 268 | int nc_server_config_oper_get_kex_algs(const struct ly_ctx *ctx, struct lyd_node **kex_algs); |
| 269 | |
| 270 | /** |
| 271 | * @brief Gets the encryption algorithms supported by the server from the 'iana-ssh-encryption-algs' YANG module. |
| 272 | * |
| 273 | * @param[in] ctx libyang context. |
| 274 | * @param[out] encryption_algs Container with leaf-lists containing the supported algorithms. |
| 275 | * @return 0 on success, non-zero otherwise. |
| 276 | */ |
| 277 | int nc_server_config_oper_get_encryption_algs(const struct ly_ctx *ctx, struct lyd_node **encryption_algs); |
| 278 | |
| 279 | /** |
| 280 | * @brief Gets the MAC algorithms supported by the server from the 'iana-ssh-mac-algs' YANG module. |
| 281 | * |
| 282 | * @param[in] ctx libyang context. |
| 283 | * @param[out] mac_algs Container with leaf-lists containing the supported algorithms. |
| 284 | * @return 0 on success, non-zero otherwise. |
| 285 | */ |
| 286 | int nc_server_config_oper_get_mac_algs(const struct ly_ctx *ctx, struct lyd_node **mac_algs); |
| 287 | |
| 288 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 289 | * @} Server Configuration Functions |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 290 | */ |
| 291 | |
| 292 | /** |
| 293 | * @defgroup server_config_ssh SSH Server Configuration |
| 294 | * @ingroup server_config |
| 295 | * |
| 296 | * @brief SSH server configuration creation and deletion |
| 297 | * @{ |
| 298 | */ |
| 299 | |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 300 | /** |
| 301 | * @brief Creates new YANG configuration data nodes for a hostkey. |
| 302 | * |
| 303 | * @param[in] ctx libyang context. |
| 304 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 305 | * If an endpoint with this identifier already exists, its hostkey might be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 306 | * @param[in] hostkey_name Arbitrary identifier of the hostkey. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 307 | * If a hostkey with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 308 | * @param[in] privkey_path Path to a file containing a private key. |
| 309 | * The private key has to be in a PEM format. Only RSA and ECDSA keys are supported. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 310 | * @param[in] pubkey_path Optional path to a file containing a public key. If NULL, public key will be |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 311 | * generated from the private key. |
| 312 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 313 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 314 | * @return 0 on success, non-zero otherwise. |
| 315 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 316 | int nc_server_config_add_ssh_hostkey(const struct ly_ctx *ctx, const char *endpt_name, const char *hostkey_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 317 | const char *privkey_path, const char *pubkey_path, struct lyd_node **config); |
| 318 | |
| 319 | /** |
| 320 | * @brief Deletes a hostkey from the YANG data. |
| 321 | * |
| 322 | * @param[in] ctx libyang context. |
| 323 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 324 | * @param[in] hostkey_name Optional identifier of the hostkey to be deleted. |
| 325 | * If NULL, all of the hostkeys on this endpoint will be deleted. |
| 326 | * @param[in,out] config Configuration YANG data tree. |
| 327 | * @return 0 on success, non-zero otherwise. |
| 328 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 329 | int nc_server_config_del_ssh_hostkey(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 330 | const char *hostkey_name, struct lyd_node **config); |
| 331 | |
| 332 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 333 | * @brief Creates new YANG data nodes for a reference to an asymmetric key located in the keystore. |
| 334 | * |
| 335 | * This asymmetric key pair will be used as the SSH hostkey. |
| 336 | * |
| 337 | * @param[in] ctx libyang context. |
| 338 | * @param[in] endpt_name Arbitrary identifier of an endpoint. |
| 339 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 340 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 341 | * If an endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 342 | * @param[in] keystore_reference Name of the asymmetric key pair to be referenced and used as a hostkey. |
| 343 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 344 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 345 | * @return 0 on success, non-zero otherwise. |
| 346 | */ |
| 347 | int nc_server_config_add_ssh_keystore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *hostkey_name, |
| 348 | const char *keystore_reference, struct lyd_node **config); |
| 349 | |
| 350 | /** |
| 351 | * @brief Deletes a keystore reference from the YANG data. |
| 352 | * |
| 353 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 354 | * @param[in] hostkey_name Identifier of an existing hostkey on the given endpoint. |
| 355 | * @param[in,out] config Configuration YANG data tree. |
| 356 | * @return 0 on success, non-zero otherwise. |
| 357 | */ |
| 358 | int nc_server_config_del_ssh_keystore_ref(const char *endpt_name, const char *hostkey_name, |
| 359 | struct lyd_node **config); |
| 360 | |
| 361 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 362 | * @brief Creates new YANG configuration data nodes for an SSH user's public key authentication method. |
| 363 | * |
| 364 | * @param[in] ctx libyang context. |
| 365 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 366 | * If an endpoint with this identifier already exists, its user might be changed. |
| 367 | * @param[in] user_name Arbitrary identifier of the user. |
| 368 | * If an user with this identifier already exists, its contents will be changed. |
| 369 | * @param[in] pubkey_name Arbitrary identifier of the user's public key. |
| 370 | * If a public key with this identifier already exists for this user, its contents will be changed. |
| 371 | * @param[in] pubkey_path Path to a file containing the user's public key. |
| 372 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 373 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 374 | * @return 0 on success, non-zero otherwise. |
| 375 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 376 | int nc_server_config_add_ssh_user_pubkey(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 377 | const char *user_name, const char *pubkey_name, const char *pubkey_path, struct lyd_node **config); |
| 378 | |
| 379 | /** |
| 380 | * @brief Deletes an SSH user's public key from the YANG data. |
| 381 | * |
| 382 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 383 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
| 384 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 385 | * If NULL, all of the users public keys will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 386 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 387 | * @return 0 on success, non-zero otherwise. |
| 388 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 389 | int nc_server_config_del_ssh_user_pubkey(const char *endpt_name, const char *user_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 390 | const char *pubkey_name, struct lyd_node **config); |
| 391 | |
| 392 | /** |
roman | a9ec336 | 2023-12-21 10:59:57 +0100 | [diff] [blame] | 393 | * @brief Creates new YANG configuration data nodes for an SSH user that will use system's authorized_keys to authenticate. |
| 394 | * |
| 395 | * The path to the authorized_keys file must be configured to successfully |
| 396 | * authenticate, see ::nc_server_ssh_set_authkey_path_format(). |
| 397 | * |
| 398 | * @param[in] ctx libyang context. |
| 399 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 400 | * If an endpoint with this identifier already exists, its user might be changed. |
| 401 | * @param[in] user_name Arbitrary identifier of the user. |
| 402 | * If an user with this identifier already exists, its contents will be changed. |
| 403 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 404 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 405 | * @return 0 on success, non-zero otherwise. |
| 406 | */ |
| 407 | int nc_server_config_add_ssh_user_authkey(const struct ly_ctx *ctx, const char *endpt_name, |
| 408 | const char *user_name, struct lyd_node **config); |
| 409 | |
| 410 | /** |
| 411 | * @brief Deletes an SSH user's authorized_keys method from the YANG data. |
| 412 | * |
| 413 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 414 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
| 415 | * @param[in,out] config Modified configuration YANG data tree. |
| 416 | * @return 0 on success, non-zero otherwise. |
| 417 | */ |
| 418 | int nc_server_config_del_ssh_user_authkey(const char *endpt_name, const char *user_name, struct lyd_node **config); |
| 419 | |
| 420 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 421 | * @brief Creates new YANG configuration data nodes for an SSH user's password authentication method. |
| 422 | * |
| 423 | * @param[in] ctx libyang context. |
| 424 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 425 | * If an endpoint with this identifier already exists, its user might be changed. |
| 426 | * @param[in] user_name Arbitrary identifier of the user. |
| 427 | * If an user with this identifier already exists, its contents will be changed. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 428 | * @param[in] password Clear-text password to be set for the user. It will be hashed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 429 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 430 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 431 | * @return 0 on success, non-zero otherwise. |
| 432 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 433 | int nc_server_config_add_ssh_user_password(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 434 | const char *user_name, const char *password, struct lyd_node **config); |
| 435 | |
| 436 | /** |
| 437 | * @brief Deletes an SSH user's password from the YANG data. |
| 438 | * |
| 439 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 440 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 441 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 442 | * @return 0 on success, non-zero otherwise. |
| 443 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 444 | int nc_server_config_del_ssh_user_password(const char *endpt_name, const char *user_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 445 | struct lyd_node **config); |
| 446 | |
| 447 | /** |
| 448 | * @brief Creates new YANG configuration data nodes for an SSH user's keyboard interactive authentication method. |
| 449 | * |
roman | c651842 | 2023-11-30 16:39:00 +0100 | [diff] [blame] | 450 | * One of Linux PAM, local users, or user callback is used to authenticate users with this SSH method (see \ref ln2doc_kbdint "the documentation"). |
roman | 808f3f6 | 2023-11-23 16:01:04 +0100 | [diff] [blame] | 451 | * |
| 452 | * @param[in] ctx libyang context. |
| 453 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 454 | * If an endpoint with this identifier already exists, its user might be changed. |
| 455 | * @param[in] user_name Arbitrary identifier of the user. |
| 456 | * If an user with this identifier already exists, its contents will be changed. |
| 457 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 458 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 459 | * @return 0 on success, non-zero otherwise. |
| 460 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 461 | int nc_server_config_add_ssh_user_interactive(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 808f3f6 | 2023-11-23 16:01:04 +0100 | [diff] [blame] | 462 | const char *user_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 463 | |
| 464 | /** |
| 465 | * @brief Deletes an SSH user's keyboard interactive authentication from the YANG data. |
| 466 | * |
| 467 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 468 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 469 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 470 | * @return 0 on success, non-zero otherwise. |
| 471 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 472 | int nc_server_config_del_ssh_user_interactive(const char *endpt_name, const char *user_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 473 | struct lyd_node **config); |
| 474 | |
| 475 | /** |
| 476 | * @brief Deletes an SSH user from the YANG data. |
| 477 | * |
| 478 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 479 | * @param[in] user_name Optional identifier of an user to be deleted. |
| 480 | * If NULL, all of the users on this endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 481 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 482 | * @return 0 on success, non-zero otherwise. |
| 483 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 484 | int nc_server_config_del_ssh_user(const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 485 | const char *user_name, struct lyd_node **config); |
| 486 | |
| 487 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 488 | * @brief Creates new YANG data nodes for a reference to a public key bag located in the truststore. |
| 489 | * |
| 490 | * The public key's located in the bag will be used for client authentication. |
| 491 | * |
| 492 | * @param[in] ctx libyang context. |
| 493 | * @param[in] endpt_name Arbitrary identifier of an endpoint. |
| 494 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 495 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 496 | * If an endpoint's user with this identifier already exists, its contents will be changed. |
| 497 | * @param[in] truststore_reference Name of the public key bag to be referenced and used for authentication. |
| 498 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 499 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 500 | * @return 0 on success, non-zero otherwise. |
| 501 | */ |
| 502 | int nc_server_config_add_ssh_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *user_name, |
| 503 | const char *truststore_reference, struct lyd_node **config); |
| 504 | |
| 505 | /** |
| 506 | * @brief Deletes a truststore reference from the YANG data. |
| 507 | * |
| 508 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 509 | * @param[in] user_name Identifier of an user on the given endpoint whose truststore reference will be deleted. |
| 510 | * @param[in,out] config Modified configuration YANG data tree. |
| 511 | * @return 0 on success, non-zero otherwise. |
| 512 | */ |
| 513 | int nc_server_config_del_ssh_truststore_ref(const char *endpt_name, const char *user_name, |
| 514 | struct lyd_node **config); |
| 515 | |
| 516 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 517 | * @brief Creates new YANG configuration data nodes, which will be a reference to another SSH endpoint's users. |
| 518 | * |
| 519 | * Whenever a client tries to connect to the referencing endpoint, all of its users will be tried first. If no match is |
| 520 | * found, the referenced endpoint's configured users will be tried. |
| 521 | * |
| 522 | * @param[in] ctx libyang context |
| 523 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 524 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 525 | * @param[in] referenced_endpt Identifier of an endpoint, which has to exist whenever this data |
| 526 | * is applied. The referenced endpoint can reference another one and so on, but there mustn't be a cycle. |
| 527 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 528 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 529 | * @return 0 on success, non-zero otherwise. |
| 530 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 531 | int nc_server_config_add_ssh_endpoint_client_ref(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 532 | const char *referenced_endpt, struct lyd_node **config); |
| 533 | |
| 534 | /** |
| 535 | * @brief Deletes reference to another SSH endpoint's users from the YANG data. |
| 536 | * |
| 537 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 538 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 539 | * @return 0 on success, non-zero otherwise. |
| 540 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 541 | int nc_server_config_del_ssh_endpoint_client_ref(const char *endpt_name, struct lyd_node **config); |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 542 | |
| 543 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 544 | * @} SSH Server Configuration |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 545 | */ |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 546 | |
| 547 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 548 | * @defgroup server_config_tls TLS Server Configuration |
| 549 | * @ingroup server_config |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 550 | * |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 551 | * @brief TLS server configuration creation and deletion |
| 552 | * @{ |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 553 | */ |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 554 | |
| 555 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 556 | * @brief Creates new YANG configuration data nodes for a server's certificate. |
| 557 | * |
| 558 | * @param[in] ctx libyang context. |
| 559 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 560 | * If an endpoint with this identifier already exists, its server certificate will be changed. |
roman | 6c4efcd | 2023-08-08 10:18:44 +0200 | [diff] [blame] | 561 | * @param[in] privkey_path Path to the server's PEM encoded private key file. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 562 | * @param[in] pubkey_path Optional path to the server's public key file. If not provided, |
| 563 | * it will be generated from the private key. |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 564 | * @param[in] cert_path Path to the server's certificate file. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 565 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 566 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 567 | * @return 0 on success, non-zero otherwise. |
| 568 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 569 | int nc_server_config_add_tls_server_cert(const struct ly_ctx *ctx, const char *endpt_name, const char *privkey_path, |
| 570 | const char *pubkey_path, const char *cert_path, struct lyd_node **config); |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 571 | |
| 572 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 573 | * @brief Deletes the server's certificate from the YANG data. |
| 574 | * |
| 575 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 576 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 577 | * @return 0 on success, non-zero otherwise. |
| 578 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 579 | int nc_server_config_del_tls_server_cert(const char *endpt_name, struct lyd_node **config); |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 580 | |
| 581 | /** |
| 582 | * @brief Creates new YANG configuration data nodes for a keystore reference to the TLS server's certificate. |
| 583 | * |
| 584 | * @param[in] ctx libyang context. |
| 585 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 586 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 587 | * @param[in] asym_key_ref Name of the asymmetric key pair in the keystore to be referenced. |
| 588 | * @param[in] cert_ref Name of the certificate, which must belong to the given asymmetric key pair, to be referenced. |
| 589 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 590 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 591 | * @return 0 on success, non-zero otherwise. |
| 592 | */ |
| 593 | int nc_server_config_add_tls_keystore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *asym_key_ref, |
| 594 | const char *cert_ref, struct lyd_node **config); |
| 595 | |
| 596 | /** |
| 597 | * @brief Deletes a TLS server certificate keystore reference from the YANG data. |
| 598 | * |
| 599 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 600 | * @param[in,out] config Modified configuration YANG data tree. |
| 601 | * @return 0 on success, non-zero otherwise. |
| 602 | */ |
| 603 | int nc_server_config_del_tls_keystore_ref(const char *endpt_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 604 | |
| 605 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 606 | * @brief Creates new YANG configuration data nodes for a client's (end-entity) certificate. |
| 607 | * |
| 608 | * @param[in] ctx libyang context. |
| 609 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 610 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 611 | * @param[in] cert_name Arbitrary identifier of the client's certificate. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 612 | * If a client certificate with this identifier already exists, it will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 613 | * @param[in] cert_path Path to the client's certificate file. |
| 614 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 615 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 616 | * @return 0 on success, non-zero otherwise. |
| 617 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 618 | int nc_server_config_add_tls_client_cert(const struct ly_ctx *ctx, const char *endpt_name, const char *cert_name, |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 619 | const char *cert_path, struct lyd_node **config); |
| 620 | |
| 621 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 622 | * @brief Deletes a client (end-entity) certificate from the YANG data. |
| 623 | * |
| 624 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 625 | * @param[in] cert_name Optional name of a certificate to be deleted. |
| 626 | * If NULL, all of the end-entity certificates on the given endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 627 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 628 | * @return 0 on success, non-zero otherwise. |
| 629 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 630 | int nc_server_config_del_tls_client_cert(const char *endpt_name, const char *cert_name, struct lyd_node **config); |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 631 | |
| 632 | /** |
| 633 | * @brief Creates new YANG configuration data nodes for a truststore reference to a set of client (end-entity) certificates. |
| 634 | * |
| 635 | * @param[in] ctx libyang context. |
| 636 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 637 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 638 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 639 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 640 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 641 | * @return 0 on success, non-zero otherwise. |
| 642 | */ |
| 643 | int nc_server_config_add_tls_client_cert_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, |
| 644 | const char *cert_bag_ref, struct lyd_node **config); |
| 645 | |
| 646 | /** |
| 647 | * @brief Deletes a client (end-entity) certificates truststore reference from the YANG data. |
| 648 | * |
| 649 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 650 | * @param[in,out] config Modified configuration YANG data tree. |
| 651 | * @return 0 on success, non-zero otherwise. |
| 652 | */ |
| 653 | int nc_server_config_del_tls_client_cert_truststore_ref(const char *endpt_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 654 | |
| 655 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 656 | * @brief Creates new YANG configuration data nodes for a client certificate authority (trust-anchor) certificate. |
| 657 | * |
| 658 | * @param[in] ctx libyang context. |
| 659 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 660 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 661 | * @param[in] cert_name Arbitrary identifier of the certificate authority certificate. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 662 | * If a CA with this identifier already exists, it will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 663 | * @param[in] cert_path Path to the CA certificate file. |
| 664 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 665 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 666 | * @return 0 on success, non-zero otherwise. |
| 667 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 668 | int nc_server_config_add_tls_ca_cert(const struct ly_ctx *ctx, const char *endpt_name, const char *cert_name, |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 669 | const char *cert_path, struct lyd_node **config); |
| 670 | |
| 671 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 672 | * @brief Deletes a client certificate authority (trust-anchor) certificate from the YANG data. |
| 673 | * |
| 674 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 675 | * @param[in] cert_name Optional name of a certificate to be deleted. |
| 676 | * If NULL, all of the CA certificates on the given endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 677 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 678 | * @return 0 on success, non-zero otherwise. |
| 679 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 680 | int nc_server_config_del_tls_ca_cert(const char *endpt_name, const char *cert_name, struct lyd_node **config); |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 681 | |
| 682 | /** |
| 683 | * @brief Creates new YANG configuration data nodes for a truststore reference to a set of client certificate authority (trust-anchor) certificates. |
| 684 | * |
| 685 | * @param[in] ctx libyang context. |
| 686 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 687 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 688 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 689 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 690 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 691 | * @return 0 on success, non-zero otherwise. |
| 692 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 693 | int nc_server_config_add_tls_ca_cert_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 694 | const char *cert_bag_ref, struct lyd_node **config); |
| 695 | |
| 696 | /** |
| 697 | * @brief Deletes a client certificate authority (trust-anchor) certificates truststore reference from the YANG data. |
| 698 | * |
| 699 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 700 | * @param[in,out] config Modified configuration YANG data tree. |
| 701 | * @return 0 on success, non-zero otherwise. |
| 702 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 703 | int nc_server_config_del_tls_ca_cert_truststore_ref(const char *endpt_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 704 | |
| 705 | /** |
Roytak | 7695891 | 2023-09-29 15:25:14 +0200 | [diff] [blame] | 706 | * @brief Creates new YANG configuration data nodes, which will be a reference to another TLS endpoint's certificates. |
| 707 | * |
| 708 | * Whenever an user tries to connect to the referencing endpoint, all of its certificates will be tried first. If no match is |
| 709 | * found, the referenced endpoint's configured certificates will be tried. The same applies to cert-to-name entries. |
| 710 | * |
| 711 | * @param[in] ctx libyang context |
| 712 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 713 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 714 | * @param[in] referenced_endpt Identifier of an endpoint, which has to exist whenever this data |
| 715 | * is applied. The referenced endpoint can reference another one and so on, but there mustn't be a cycle. |
| 716 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 717 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 718 | * @return 0 on success, non-zero otherwise. |
| 719 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 720 | int nc_server_config_add_tls_endpoint_client_ref(const struct ly_ctx *ctx, const char *endpt_name, |
Roytak | 7695891 | 2023-09-29 15:25:14 +0200 | [diff] [blame] | 721 | const char *referenced_endpt, struct lyd_node **config); |
| 722 | |
| 723 | /** |
| 724 | * @brief Deletes reference to another TLS endpoint's users from the YANG data. |
| 725 | * |
| 726 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 727 | * @param[in,out] config Modified configuration YANG data tree. |
| 728 | * @return 0 on success, non-zero otherwise. |
| 729 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 730 | int nc_server_config_del_tls_endpoint_client_ref(const char *endpt_name, struct lyd_node **config); |
Roytak | 7695891 | 2023-09-29 15:25:14 +0200 | [diff] [blame] | 731 | |
| 732 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 733 | * @brief Creates new YANG configuration data nodes for a cert-to-name entry. |
| 734 | * |
| 735 | * @param[in] ctx libyang context. |
| 736 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 737 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 738 | * @param[in] id ID of the entry. The lower the ID, the higher the priority of the entry (it will be checked earlier). |
| 739 | * @param[in] fingerprint Optional fingerprint of the entry. The fingerprint should always be set, however if it is |
| 740 | * not set, it will match any certificate. Entry with no fingerprint should therefore be placed only as the last entry. |
| 741 | * @param[in] map_type Mapping username to the certificate option. |
| 742 | * @param[in] name Username for this cert-to-name entry. |
| 743 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 744 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 745 | * @return 0 on success, non-zero otherwise. |
| 746 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 747 | int nc_server_config_add_tls_ctn(const struct ly_ctx *ctx, const char *endpt_name, uint32_t id, const char *fingerprint, |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 748 | NC_TLS_CTN_MAPTYPE map_type, const char *name, struct lyd_node **config); |
| 749 | |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 750 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 751 | * @brief Deletes a cert-to-name entry from the YANG data. |
| 752 | * |
| 753 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 754 | * @param[in] id Optional ID of the CTN entry. |
| 755 | * If 0, all of the cert-to-name entries on the given endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 756 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 757 | * @return 0 on success, non-zero otherwise. |
| 758 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 759 | int nc_server_config_del_tls_ctn(const char *endpt_name, uint32_t id, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 760 | |
| 761 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 762 | * @} TLS Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 763 | */ |
| 764 | |
| 765 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 766 | * @defgroup server_config_ch Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 767 | * @ingroup server_config |
| 768 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 769 | * @brief Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 770 | * @{ |
| 771 | */ |
| 772 | |
| 773 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 774 | * @} Call Home Server Configuration |
| 775 | */ |
| 776 | |
| 777 | /** |
| 778 | * @defgroup server_config_ch_functions Call Home Server Configuration Functions |
| 779 | * @ingroup server_config_ch |
| 780 | * |
| 781 | * @brief Call Home server configuration functions |
| 782 | * @{ |
| 783 | */ |
| 784 | |
| 785 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 786 | * @brief Creates new YANG configuration data nodes for a Call Home client's address and port. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 787 | * |
| 788 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 789 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 790 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 791 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 792 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 793 | * @param[in] transport Transport protocol to be used on this endpoint - either SSH or TLS. |
| 794 | * @param[in] address Address to connect to. |
| 795 | * @param[in] port Port to connect to. |
| 796 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 797 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 798 | * @return 0 on success, non-zero otherwise. |
| 799 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 800 | int nc_server_config_add_ch_address_port(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 5cbb653 | 2023-06-22 12:53:17 +0200 | [diff] [blame] | 801 | NC_TRANSPORT_IMPL transport, const char *address, const char *port, struct lyd_node **config); |
| 802 | |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 803 | #endif /* NC_ENABLED_SSH_TLS */ |
| 804 | |
| 805 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 806 | * @brief Deletes a Call Home client from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 807 | * |
| 808 | * @param[in] client_name Optional identifier of a client to be deleted. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 809 | * If NULL, all of the Call Home clients will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 810 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 811 | * @return 0 on success, non-zero otherwise. |
| 812 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 813 | int nc_server_config_del_ch_client(const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 814 | |
| 815 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 816 | * @brief Deletes a Call Home endpoint from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 817 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 818 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 819 | * @param[in] endpt_name Optional identifier of a CH endpoint to be deleted. |
| 820 | * If NULL, all of the CH endpoints which belong to the given client will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 821 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 822 | * @return 0 on success, non-zero otherwise. |
| 823 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 824 | int nc_server_config_del_ch_endpt(const char *client_name, const char *endpt_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 825 | |
| 826 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 827 | * @brief Creates new YANG configuration data nodes for the Call Home persistent connection type. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 828 | * |
| 829 | * This is the default connection type. If periodic connection type was set before, it will be unset. |
| 830 | * |
| 831 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 832 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 833 | * If a Call Home client with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 834 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 835 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 836 | * @return 0 on success, non-zero otherwise. |
| 837 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 838 | int nc_server_config_add_ch_persistent(const struct ly_ctx *ctx, const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 839 | |
| 840 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 841 | * @brief Creates new YANG configuration data nodes for the period parameter of the Call Home periodic connection type. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 842 | * |
| 843 | * If called, the persistent connection type will be replaced by periodic. |
| 844 | * |
| 845 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 846 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 847 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 848 | * @param[in] period Duration between periodic connections in minutes. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 849 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 850 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 851 | * @return 0 on success, non-zero otherwise. |
| 852 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 853 | int nc_server_config_add_ch_period(const struct ly_ctx *ctx, const char *client_name, uint16_t period, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 854 | struct lyd_node **config); |
| 855 | |
| 856 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 857 | * @brief Deletes the Call Home period parameter of the periodic connection type from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 858 | * |
| 859 | * This behaves the same as setting the period to 60 minutes, which is the default value of this node. |
| 860 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 861 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 862 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 863 | * @return 0 on success, non-zero otherwise. |
| 864 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 865 | int nc_server_config_del_ch_period(const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 866 | |
| 867 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 868 | * @brief Creates new YANG configuration data nodes for the anchor time parameter of the Call Home periodic connection type. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 869 | * |
| 870 | * If called, the persistent connection type will be replaced by periodic. |
| 871 | * |
| 872 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 873 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 874 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 875 | * @param[in] anchor_time Timestamp before or after which a series of periodic connections are determined. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 876 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 877 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 878 | * @return 0 on success, non-zero otherwise. |
| 879 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 880 | int nc_server_config_add_ch_anchor_time(const struct ly_ctx *ctx, const char *client_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 881 | const char *anchor_time, struct lyd_node **config); |
| 882 | |
| 883 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 884 | * @brief Deletes the Call Home anchor time parameter of the periodic connection type from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 885 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 886 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 887 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 888 | * @return 0 on success, non-zero otherwise. |
| 889 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 890 | int nc_server_config_del_ch_anchor_time(const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 891 | |
| 892 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 893 | * @brief Creates new YANG configuration data nodes for the idle timeout parameter of the Call Home periodic connection type. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 894 | * |
| 895 | * If called, the persistent connection type will be replaced by periodic. |
| 896 | * |
| 897 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 898 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 899 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 900 | * @param[in] idle_timeout Specifies the maximum number of seconds that a session may remain idle. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 901 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 902 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 903 | * @return 0 on success, non-zero otherwise. |
| 904 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 905 | int nc_server_config_add_ch_idle_timeout(const struct ly_ctx *ctx, const char *client_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 906 | uint16_t idle_timeout, struct lyd_node **config); |
| 907 | |
| 908 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 909 | * @brief Deletes the Call Home idle timeout parameter of the periodic connection type from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 910 | * |
| 911 | * This behaves the same as setting the timeout to 180 seconds, which is the default value of this node. |
| 912 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 913 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 914 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 915 | * @return 0 on success, non-zero otherwise. |
| 916 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 917 | int nc_server_config_del_ch_idle_timeout(const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 918 | |
| 919 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 920 | * @brief Creates new YANG configuration data nodes for the Call Home reconnect strategy. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 921 | * |
| 922 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 923 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 924 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 925 | * @param[in] start_with Specifies which endpoint to try if a connection is unsuccessful. Default value is NC_CH_FIRST_LISTED. |
| 926 | * @param[in] max_wait The number of seconds after which a connection to an endpoint is deemed unsuccessful. Default value if 5. |
| 927 | * @param[in] max_attempts The number of unsuccessful connection attempts before moving to the next endpoint. Default value is 3. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 928 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 929 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 930 | * @return 0 on success, non-zero otherwise. |
| 931 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 932 | int nc_server_config_add_ch_reconnect_strategy(const struct ly_ctx *ctx, const char *client_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 933 | NC_CH_START_WITH start_with, uint16_t max_wait, uint8_t max_attempts, struct lyd_node **config); |
| 934 | |
| 935 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 936 | * @brief Resets the values of the Call Home reconnect strategy nodes to their defaults. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 937 | * |
| 938 | * The default values are: start-with = NC_CH_FIRST_LISTED, max-wait = 5 and max-attempts = 3. |
| 939 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 940 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 941 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 942 | * @return 0 on success, non-zero otherwise. |
| 943 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 944 | int nc_server_config_del_ch_reconnect_strategy(const char *client_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 945 | |
| 946 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 947 | * @} Call Home Server Configuration Functions |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 948 | */ |
| 949 | |
| 950 | #ifdef NC_ENABLED_SSH_TLS |
| 951 | |
| 952 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 953 | * @defgroup server_config_ch_ssh SSH Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 954 | * @ingroup server_config_ch |
| 955 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 956 | * @brief SSH Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 957 | * @{ |
| 958 | */ |
| 959 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 960 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 961 | * @brief Creates new YANG data nodes for a Call Home SSH hostkey. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 962 | * |
| 963 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 964 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 965 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 966 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 967 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 968 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 969 | * If the endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 970 | * @param[in] privkey_path Path to a file containing a private key. |
| 971 | * The private key has to be in a PEM format. Only RSA and ECDSA keys are supported. |
| 972 | * @param[in] pubkey_path Path to a file containing a public key. If NULL, public key will be |
| 973 | * generated from the private key. |
| 974 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 975 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 976 | * @return 0 on success, non-zero otherwise. |
| 977 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 978 | int nc_server_config_add_ch_ssh_hostkey(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 5cbb653 | 2023-06-22 12:53:17 +0200 | [diff] [blame] | 979 | const char *hostkey_name, const char *privkey_path, const char *pubkey_path, struct lyd_node **config); |
| 980 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 981 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 982 | * @brief Deletes a Call Home hostkey from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 983 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 984 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 985 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 986 | * @param[in] hostkey_name Optional identifier of a hostkey to be deleted. |
| 987 | * If NULL, all of the hostkeys on the given endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 988 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 989 | * @return 0 on success, non-zero otherwise. |
| 990 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 991 | int nc_server_config_del_ch_ssh_hostkey(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 992 | const char *hostkey_name, struct lyd_node **config); |
| 993 | |
| 994 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 995 | * @brief Creates new YANG data nodes for a reference to an asymmetric key located in the keystore. |
| 996 | * |
| 997 | * This asymmetric key pair will be used as the Call Home SSH hostkey. |
| 998 | * |
| 999 | * @param[in] ctx libyang context. |
| 1000 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1001 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1002 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1003 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1004 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 1005 | * If the endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 1006 | * @param[in] keystore_reference Name of the asymmetric key pair to be referenced and used as a hostkey. |
| 1007 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1008 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1009 | * @return 0 on success, non-zero otherwise. |
| 1010 | */ |
| 1011 | int nc_server_config_add_ch_ssh_keystore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1012 | const char *endpt_name, const char *hostkey_name, const char *keystore_reference, struct lyd_node **config); |
| 1013 | |
| 1014 | /** |
| 1015 | * @brief Deletes a Call Home keystore reference from the YANG data. |
| 1016 | * |
| 1017 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1018 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1019 | * @param[in] hostkey_name Identifier of an existing hostkey that belongs to the given CH endpoint. |
| 1020 | * @param[in,out] config Modified configuration YANG data tree. |
| 1021 | * @return 0 on success, non-zero otherwise. |
| 1022 | */ |
| 1023 | int nc_server_config_del_ch_ssh_keystore_ref(const char *client_name, const char *endpt_name, |
| 1024 | const char *hostkey_name, struct lyd_node **config); |
| 1025 | |
| 1026 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1027 | * @brief Creates new YANG data nodes for a Call Home SSH user's public key authentication method. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1028 | * |
| 1029 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1030 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1031 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1032 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1033 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1034 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1035 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1036 | * @param[in] pubkey_name Arbitrary identifier of the user's public key. |
| 1037 | * If the user's public key with this identifier already exists, its contents will be changed. |
| 1038 | * @param[in] pubkey_path Path to a file containing a public key. |
| 1039 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1040 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1041 | * @return 0 on success, non-zero otherwise. |
| 1042 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1043 | int nc_server_config_add_ch_ssh_user_pubkey(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 5cbb653 | 2023-06-22 12:53:17 +0200 | [diff] [blame] | 1044 | const char *user_name, const char *pubkey_name, const char *pubkey_path, struct lyd_node **config); |
| 1045 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1046 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1047 | * @brief Deletes a Call Home SSH user's public key from the YANG data. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1048 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1049 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1050 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1051 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1052 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 1053 | * If NULL, all of the public keys which belong to the given SSH user will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1054 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1055 | * @return 0 on success, non-zero otherwise. |
| 1056 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1057 | int nc_server_config_del_ch_ssh_user_pubkey(const char *client_name, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1058 | const char *user_name, const char *pubkey_name, struct lyd_node **config); |
roman | 5cbb653 | 2023-06-22 12:53:17 +0200 | [diff] [blame] | 1059 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1060 | /** |
roman | a9ec336 | 2023-12-21 10:59:57 +0100 | [diff] [blame] | 1061 | * @brief Creates new YANG configuration data nodes for a Call Home SSH user that will use system's authorized_keys to authenticate. |
| 1062 | * |
| 1063 | * The path to the authorized_keys file must be configured to successfully |
| 1064 | * authenticate, see ::nc_server_ssh_set_authkey_path_format(). |
| 1065 | * |
| 1066 | * @param[in] ctx libyang context. |
| 1067 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1068 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1069 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1070 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1071 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1072 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1073 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1074 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1075 | * @return 0 on success, non-zero otherwise. |
| 1076 | */ |
| 1077 | int nc_server_config_add_ch_ssh_user_authkey(const struct ly_ctx *ctx, const char *client_name, |
| 1078 | const char *endpt_name, const char *user_name, struct lyd_node **config); |
| 1079 | |
| 1080 | /** |
| 1081 | * @brief Deletes a Call Home SSH user's authorized_keys method from the YANG data. |
| 1082 | * |
| 1083 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1084 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1085 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
| 1086 | * @param[in,out] config Modified configuration YANG data tree. |
| 1087 | * @return 0 on success, non-zero otherwise. |
| 1088 | */ |
| 1089 | int nc_server_config_ch_del_ssh_user_authkey(const char *client_name, const char *endpt_name, |
| 1090 | const char *user_name, struct lyd_node **config); |
| 1091 | |
| 1092 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1093 | * @brief Creates new YANG data nodes for a Call Home SSH user's password authentication method. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1094 | * |
| 1095 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1096 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1097 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1098 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1099 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1100 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1101 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1102 | * @param[in] password Clear-text password to be set for the user. It will be hashed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1103 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1104 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1105 | * @return 0 on success, non-zero otherwise. |
| 1106 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1107 | int nc_server_config_add_ch_ssh_user_password(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1108 | const char *user_name, const char *password, struct lyd_node **config); |
| 1109 | |
| 1110 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1111 | * @brief Deletes a Call Home SSH user's password from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1112 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1113 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1114 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1115 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1116 | * @param[in,out] config Modified configuration YANG data tree. |
| 1117 | * @return 0 on success, non-zero otherwise. |
| 1118 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1119 | int nc_server_config_del_ch_ssh_user_password(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1120 | const char *user_name, struct lyd_node **config); |
| 1121 | |
| 1122 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1123 | * @brief Creates new YANG configuration data nodes for a Call Home SSH user's keyboard interactive authentication method. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1124 | * |
roman | c651842 | 2023-11-30 16:39:00 +0100 | [diff] [blame] | 1125 | * One of Linux PAM, local users, or user callback is used to authenticate users with this SSH method (see \ref ln2doc_kbdint "the documentation"). |
roman | 808f3f6 | 2023-11-23 16:01:04 +0100 | [diff] [blame] | 1126 | * |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1127 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1128 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1129 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1130 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1131 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1132 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1133 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1134 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1135 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1136 | * @return 0 on success, non-zero otherwise. |
| 1137 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1138 | int nc_server_config_add_ch_ssh_user_interactive(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 808f3f6 | 2023-11-23 16:01:04 +0100 | [diff] [blame] | 1139 | const char *user_name, struct lyd_node **config); |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1140 | |
| 1141 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1142 | * @brief Deletes a Call Home SSH user's keyboard interactive authentication from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1143 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1144 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1145 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1146 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1147 | * @param[in,out] config Modified configuration YANG data tree. |
| 1148 | * @return 0 on success, non-zero otherwise. |
| 1149 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1150 | int nc_server_config_del_ch_ssh_user_interactive(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1151 | const char *user_name, struct lyd_node **config); |
| 1152 | |
| 1153 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1154 | * @brief Deletes a Call Home SSH user from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1155 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1156 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1157 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1158 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1159 | * @param[in,out] config Modified configuration YANG data tree. |
| 1160 | * @return 0 on success, non-zero otherwise. |
| 1161 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1162 | int nc_server_config_del_ch_ssh_user(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1163 | const char *user_name, struct lyd_node **config); |
| 1164 | |
| 1165 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1166 | * @brief Creates new YANG data nodes for a reference to a public key bag located in the truststore. |
| 1167 | * |
| 1168 | * The public key's located in the bag will be used for Call Home SSH client authentication. |
| 1169 | * |
| 1170 | * @param[in] ctx libyang context. |
| 1171 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1172 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1173 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1174 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1175 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1176 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1177 | * @param[in] truststore_reference Name of the public key bag to be referenced and used for authentication. |
| 1178 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1179 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1180 | * @return 0 on success, non-zero otherwise. |
| 1181 | */ |
| 1182 | int nc_server_config_add_ch_ssh_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1183 | const char *endpt_name, const char *user_name, const char *truststore_reference, struct lyd_node **config); |
| 1184 | |
| 1185 | /** |
| 1186 | * @brief Deletes a Call Home SSH truststore reference from the YANG data. |
| 1187 | * |
| 1188 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1189 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1190 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1191 | * @param[in,out] config Modified configuration YANG data tree. |
| 1192 | * @return 0 on success, non-zero otherwise. |
| 1193 | */ |
| 1194 | int nc_server_config_del_ch_ssh_truststore_ref(const char *client_name, const char *endpt_name, |
| 1195 | const char *user_name, struct lyd_node **config); |
| 1196 | |
| 1197 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1198 | * @} SSH Call Home Server Configuration |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1199 | */ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1200 | |
| 1201 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1202 | * @defgroup server_config_ch_tls TLS Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1203 | * @ingroup server_config_ch |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1204 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1205 | * @brief TLS Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1206 | * @{ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1207 | */ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1208 | |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1209 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1210 | * @brief Creates new YANG configuration data nodes for a Call Home server's certificate. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1211 | * |
| 1212 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1213 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1214 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1215 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1216 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
roman | 6c4efcd | 2023-08-08 10:18:44 +0200 | [diff] [blame] | 1217 | * @param[in] privkey_path Path to the server's PEM encoded private key file. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1218 | * @param[in] pubkey_path Optional path to the server's public key file. If not provided, |
| 1219 | * it will be generated from the private key. |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1220 | * @param[in] cert_path Path to the server's certificate file. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1221 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1222 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1223 | * @return 0 on success, non-zero otherwise. |
| 1224 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1225 | int nc_server_config_add_ch_tls_server_cert(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1226 | const char *privkey_path, const char *pubkey_path, const char *cert_path, struct lyd_node **config); |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1227 | |
| 1228 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1229 | * @brief Deletes a Call Home server certificate from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1230 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1231 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1232 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1233 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1234 | * @return 0 on success, non-zero otherwise. |
| 1235 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1236 | int nc_server_config_del_ch_tls_server_cert(const char *client_name, const char *endpt_name, |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1237 | struct lyd_node **config); |
| 1238 | |
| 1239 | /** |
| 1240 | * @brief Creates new YANG configuration data nodes for a keystore reference to the Call Home TLS server's certificate. |
| 1241 | * |
| 1242 | * @param[in] ctx libyang context. |
| 1243 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1244 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1245 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1246 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1247 | * @param[in] asym_key_ref Name of the asymmetric key pair in the keystore to be referenced. |
| 1248 | * @param[in] cert_ref Name of the certificate, which must belong to the given asymmetric key pair, to be referenced. |
| 1249 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1250 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1251 | * @return 0 on success, non-zero otherwise. |
| 1252 | */ |
| 1253 | int nc_server_config_add_ch_tls_keystore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1254 | const char *endpt_name, const char *asym_key_ref, const char *cert_ref, struct lyd_node **config); |
| 1255 | |
| 1256 | /** |
| 1257 | * @brief Deletes a TLS server certificate keystore reference from the YANG data. |
| 1258 | * |
| 1259 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1260 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
| 1261 | * @param[in,out] config Modified configuration YANG data tree. |
| 1262 | * @return 0 on success, non-zero otherwise. |
| 1263 | */ |
| 1264 | int nc_server_config_del_ch_tls_keystore_ref(const char *client_name, const char *endpt_name, |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1265 | struct lyd_node **config); |
| 1266 | |
| 1267 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1268 | * @brief Creates new YANG configuration data nodes for a Call Home client's (end-entity) certificate. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1269 | * |
| 1270 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1271 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1272 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1273 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1274 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1275 | * @param[in] cert_name Arbitrary identifier of the Call Home endpoint's end-entity certificate. |
| 1276 | * If an Call Home endpoint's end-entity certificate with this identifier already exists, its contents will be changed. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1277 | * @param[in] cert_path Path to the certificate file. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1278 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1279 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1280 | * @return 0 on success, non-zero otherwise. |
| 1281 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1282 | int nc_server_config_add_ch_tls_client_cert(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1283 | const char *cert_name, const char *cert_path, struct lyd_node **config); |
| 1284 | |
| 1285 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1286 | * @brief Deletes a Call Home client (end-entity) certificate from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1287 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1288 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1289 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1290 | * @param[in] cert_name Optional identifier of a client certificate to be deleted. |
| 1291 | * If NULL, all of the client certificates will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1292 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1293 | * @return 0 on success, non-zero otherwise. |
| 1294 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1295 | int nc_server_config_del_ch_tls_client_cert(const char *client_name, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1296 | const char *cert_name, struct lyd_node **config); |
| 1297 | |
| 1298 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1299 | * @brief Creates new YANG configuration data nodes for a Call Home truststore reference to a set of client (end-entity) certificates. |
| 1300 | * |
| 1301 | * @param[in] ctx libyang context. |
| 1302 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1303 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1304 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1305 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1306 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 1307 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1308 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1309 | * @return 0 on success, non-zero otherwise. |
| 1310 | */ |
| 1311 | int nc_server_config_add_ch_tls_client_cert_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1312 | const char *endpt_name, const char *cert_bag_ref, struct lyd_node **config); |
| 1313 | |
| 1314 | /** |
| 1315 | * @brief Deletes a Call Home client (end-entity) certificates truststore reference from the YANG data. |
| 1316 | * |
| 1317 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1318 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
| 1319 | * @param[in,out] config Modified configuration YANG data tree. |
| 1320 | * @return 0 on success, non-zero otherwise. |
| 1321 | */ |
| 1322 | int nc_server_config_del_ch_tls_client_cert_truststore_ref(const char *client_name, const char *endpt_name, |
| 1323 | struct lyd_node **config); |
| 1324 | |
| 1325 | /** |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1326 | * @brief Creates new YANG configuration data nodes for a client certificate authority (trust-anchor) certificate. |
| 1327 | * |
| 1328 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1329 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1330 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1331 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1332 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1333 | * @param[in] cert_name Arbitrary identifier of the Call Home endpoint's certificate authority certificate. |
| 1334 | * If an Call Home endpoint's CA certificate with this identifier already exists, its contents will be changed. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1335 | * @param[in] cert_path Path to the certificate file. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1336 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1337 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1338 | * @return 0 on success, non-zero otherwise. |
| 1339 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1340 | int nc_server_config_add_ch_tls_ca_cert(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1341 | const char *cert_name, const char *cert_path, struct lyd_node **config); |
| 1342 | |
| 1343 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1344 | * @brief Deletes a Call Home client certificate authority (trust-anchor) certificate from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1345 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1346 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1347 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1348 | * @param[in] cert_name Optional identifier of a CA certificate to be deleted. |
| 1349 | * If NULL, all of the CA certificates will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1350 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1351 | * @return 0 on success, non-zero otherwise. |
| 1352 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1353 | int nc_server_config_del_ch_tls_ca_cert(const char *client_name, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1354 | const char *cert_name, struct lyd_node **config); |
| 1355 | |
| 1356 | /** |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1357 | * @brief Creates new YANG configuration data nodes for a Call Home truststore reference to a set of client certificate authority (trust-anchor) certificates. |
| 1358 | * |
| 1359 | * @param[in] ctx libyang context. |
| 1360 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1361 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1362 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1363 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1364 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 1365 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1366 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1367 | * @return 0 on success, non-zero otherwise. |
| 1368 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1369 | int nc_server_config_add_ch_tls_ca_cert_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1370 | const char *endpt_name, const char *cert_bag_ref, struct lyd_node **config); |
| 1371 | |
| 1372 | /** |
| 1373 | * @brief Deletes a Call Home client certificate authority (trust-anchor) certificates truststore reference from the YANG data. |
| 1374 | * |
| 1375 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1376 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
| 1377 | * @param[in,out] config Modified configuration YANG data tree. |
| 1378 | * @return 0 on success, non-zero otherwise. |
| 1379 | */ |
roman | e6ec60e | 2023-10-19 15:21:52 +0200 | [diff] [blame] | 1380 | int nc_server_config_del_ch_tls_ca_cert_truststore_ref(const char *client_name, const char *endpt_name, |
roman | d348b94 | 2023-10-13 14:32:19 +0200 | [diff] [blame] | 1381 | struct lyd_node **config); |
| 1382 | |
| 1383 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1384 | * @brief Creates new YANG configuration data nodes for a Call Home cert-to-name entry. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1385 | * |
| 1386 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1387 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1388 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1389 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1390 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1391 | * @param[in] id ID of the entry. The lower the ID, the higher the priority of the entry (it will be checked earlier). |
| 1392 | * @param[in] fingerprint Optional fingerprint of the entry. The fingerprint should always be set, however if it is |
| 1393 | * not set, it will match any certificate. Entry with no fingerprint should therefore be placed only as the last entry. |
| 1394 | * @param[in] map_type Mapping username to the certificate option. |
| 1395 | * @param[in] name Username for this cert-to-name entry. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1396 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1397 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1398 | * @return 0 on success, non-zero otherwise. |
| 1399 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1400 | int nc_server_config_add_ch_tls_ctn(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1401 | uint32_t id, const char *fingerprint, NC_TLS_CTN_MAPTYPE map_type, const char *name, struct lyd_node **config); |
| 1402 | |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1403 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1404 | * @brief Deletes a Call Home cert-to-name entry from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1405 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1406 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1407 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
| 1408 | * @param[in] id Optional identifier of the Call Home CTN entry to be deleted. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1409 | * If 0, all of the CTN entries will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1410 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1411 | * @return 0 on success, non-zero otherwise. |
| 1412 | */ |
Roytak | b279485 | 2023-10-18 14:30:22 +0200 | [diff] [blame] | 1413 | int nc_server_config_del_ch_tls_ctn(const char *client_name, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1414 | uint32_t id, struct lyd_node **config); |
| 1415 | |
| 1416 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1417 | * @} TLS Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1418 | */ |
| 1419 | |
roman | 2eab474 | 2023-06-06 10:00:26 +0200 | [diff] [blame] | 1420 | #endif /* NC_ENABLED_SSH_TLS */ |
roman | 45cec4e | 2023-02-17 10:21:39 +0100 | [diff] [blame] | 1421 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 1422 | #ifdef __cplusplus |
| 1423 | } |
| 1424 | #endif |
| 1425 | |
| 1426 | #endif /* NC_SESSION_SERVER_H_ */ |