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 | 3f9b65c | 2023-06-05 14:26:58 +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 | * |
| 63 | * @param[in, out] ctx Optional context in which the modules will be implemented. Created if ctx is null. |
| 64 | * @return 0 on success, 1 on error. |
| 65 | */ |
| 66 | int nc_server_config_load_modules(struct ly_ctx **ctx); |
| 67 | |
| 68 | /** |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 69 | * @brief Configure server based on the given diff data. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 70 | * |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 71 | * Expected data are a validated instance of a ietf-netconf-server YANG data. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 72 | * The data must be in the diff format and supported operations are: create, replace, |
| 73 | * delete and none. Context must already have implemented the required modules, see |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 74 | * ::nc_server_config_load_modules(). |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 75 | * |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 76 | * @param[in] diff ietf-netconf-server YANG diff data. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 77 | * @return 0 on success, 1 on error. |
| 78 | */ |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 79 | int nc_server_config_setup_diff(const struct lyd_node *diff); |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 80 | |
| 81 | /** |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 82 | * @brief Configure server based on the given data. |
| 83 | * |
| 84 | * Expected data is a validated instance of a ietf-netconf-server YANG data. |
| 85 | * Behaves as if all the nodes in data had the replace operation. That means that the current configuration will be deleted |
| 86 | * and just the given data will all be applied. |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 87 | * The data must not contain any operation attribute, see ::nc_server_config_setup_diff() which works with diff. |
| 88 | * 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] | 89 | * |
| 90 | * @param[in] data ietf-netconf-server YANG data. |
| 91 | * @return 0 on success, 1 on error. |
| 92 | */ |
roman | f6f37a5 | 2023-05-25 14:27:51 +0200 | [diff] [blame] | 93 | int nc_server_config_setup_data(const struct lyd_node *data); |
roman | f02273a | 2023-05-25 09:44:11 +0200 | [diff] [blame] | 94 | |
| 95 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 96 | * @brief Configure server based on the given ietf-netconf-server YANG data from a file. |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 97 | * Wrapper around ::nc_server_config_setup_data() hiding work with parsing the data. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 98 | * |
| 99 | * @param[in] ctx libyang context. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 100 | * @param[in] path Path to the file with ietf-netconf-server YANG data. |
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 | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 108 | * @brief Creates new YANG configuration data nodes for local-address and local-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 | */ |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 120 | int nc_server_config_new_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 | */ |
| 133 | int nc_server_config_new_del_endpt(const char *endpt_name, struct lyd_node **config); |
| 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 | */ |
roman | 1314591 | 2023-08-17 15:36:54 +0200 | [diff] [blame^] | 151 | int nc_server_config_new_keystore_asym_key(const struct ly_ctx *ctx, NC_TRANSPORT_IMPL ti, const char *asym_key_name, |
| 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 | */ |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 162 | int nc_server_config_new_del_keystore_asym_key(const char *asym_key_name, struct lyd_node **config); |
| 163 | |
| 164 | /** |
| 165 | * @brief Creates new YANG data nodes for a certificate in the keystore. |
| 166 | * |
| 167 | * A certificate can not exist without its asymmetric key, so you must call ::nc_server_config_new_keystore_asym_key() |
| 168 | * either before or after calling this with the same identifier for the asymmetric key. |
| 169 | * |
| 170 | * An asymmetric key pair can have zero or more certificates associated with this key pair, however a certificate must |
| 171 | * have exactly one key pair it belongs to. |
| 172 | * |
| 173 | * @param[in] ctx libyang context. |
| 174 | * @param[in] asym_key_name Arbitrary identifier of the asymmetric key. |
| 175 | * If an asymmetric key pair with this name already exists, its contents will be changed. |
| 176 | * @param[in] cert_name Arbitrary identifier of the key pair's certificate. |
| 177 | * If a certificate with this name already exists, its contents will be changed. |
| 178 | * @param[in] cert_path Path to the PEM encoded certificate file. |
| 179 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 180 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 181 | * @return 0 on success, non-zero otherwise. |
| 182 | */ |
| 183 | int nc_server_config_new_keystore_cert(const struct ly_ctx *ctx, const char *asym_key_name, const char *cert_name, |
| 184 | const char *cert_path, struct lyd_node **config); |
| 185 | |
| 186 | /** |
| 187 | * @brief Deletes a keystore's certificate from the YANG data. |
| 188 | * |
| 189 | * @param[in] asym_key_name Identifier of an existing asymmetric key pair. |
| 190 | * @param[in] cert_name Optional identifier of a certificate to be deleted. |
| 191 | * If NULL, all of the certificates belonging to the asymmetric key pair will be deleted. |
| 192 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 193 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 194 | * @return 0 on success, non-zero otherwise. |
| 195 | */ |
| 196 | int nc_server_config_new_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] | 197 | |
| 198 | /** |
| 199 | * @brief Creates new YANG data nodes for a public key in the truststore. |
| 200 | * |
| 201 | * @param[in] ctx libyang context. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 202 | * @param[in] pub_bag_name Arbitrary identifier of the public key bag. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 203 | * This name is used to reference the public keys in the bag. |
| 204 | * If a public key bag with this name already exists, its contents will be changed. |
| 205 | * @param[in] pubkey_name Arbitrary identifier of the public key. |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 206 | * 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] | 207 | * @param[in] pubkey_path Path to a file containing a public key. |
| 208 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 209 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 210 | * @return 0 on success, non-zero otherwise. |
| 211 | */ |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 212 | int nc_server_config_new_truststore_pubkey(const struct ly_ctx *ctx, const char *pub_bag_name, const char *pubkey_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 213 | const char *pubkey_path, struct lyd_node **config); |
| 214 | |
| 215 | /** |
| 216 | * @brief Deletes a truststore's public key from the YANG data. |
| 217 | * |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 218 | * @param[in] pub_bag_name Identifier of an existing public key bag. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 219 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 220 | * If NULL, all of the public keys in the given bag will be deleted. |
| 221 | * @param[in,out] config Configuration YANG data tree. |
| 222 | * @return 0 on success, non-zero otherwise. |
| 223 | */ |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 224 | int nc_server_config_new_del_truststore_pubkey(const char *pub_bag_name, const char *pubkey_name, struct lyd_node **config); |
| 225 | |
| 226 | /** |
| 227 | * @brief Creates new YANG data nodes for a certificate in the truststore. |
| 228 | * |
| 229 | * @param[in] ctx libyang context. |
| 230 | * @param[in] cert_bag_name Arbitrary identifier of the certificate bag. |
| 231 | * This name is used to reference the certificates in the bag. |
| 232 | * If a certificate bag with this name already exists, its contents will be changed. |
| 233 | * @param[in] cert_name Arbitrary identifier of the certificate. |
| 234 | * If a certificate with this name already exists in the given bag, its contents will be changed. |
| 235 | * @param[in] cert_path Path to a file containing a PEM encoded certificate. |
| 236 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 237 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 238 | * @return 0 on success, non-zero otherwise. |
| 239 | */ |
| 240 | int nc_server_config_new_truststore_cert(const struct ly_ctx *ctx, const char *cert_bag_name, const char *cert_name, |
| 241 | const char *cert_path, struct lyd_node **config); |
| 242 | |
| 243 | /** |
| 244 | * @brief Deletes a truststore's certificate from the YANG data. |
| 245 | * |
| 246 | * @param[in] cert_bag_name Identifier of an existing certificate bag. |
| 247 | * @param[in] cert_name Optional identifier of a certificate to be deleted. |
| 248 | * If NULL, all of the certificates in the given bag will be deleted. |
| 249 | * @param[in,out] config Configuration YANG data tree. |
| 250 | * @return 0 on success, non-zero otherwise. |
| 251 | */ |
| 252 | int nc_server_config_new_del_truststore_cert(const char *cert_bag_name, |
| 253 | const char *cert_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 254 | |
| 255 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 256 | * @} Server Configuration Functions |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 257 | */ |
| 258 | |
| 259 | /** |
| 260 | * @defgroup server_config_ssh SSH Server Configuration |
| 261 | * @ingroup server_config |
| 262 | * |
| 263 | * @brief SSH server configuration creation and deletion |
| 264 | * @{ |
| 265 | */ |
| 266 | |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 267 | /** |
| 268 | * @brief Creates new YANG configuration data nodes for a hostkey. |
| 269 | * |
| 270 | * @param[in] ctx libyang context. |
| 271 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 272 | * If an endpoint with this identifier already exists, its hostkey might be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 273 | * @param[in] hostkey_name Arbitrary identifier of the hostkey. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 274 | * If a hostkey with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 275 | * @param[in] privkey_path Path to a file containing a private key. |
| 276 | * 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] | 277 | * @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] | 278 | * generated from the private key. |
| 279 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 280 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 281 | * @return 0 on success, non-zero otherwise. |
| 282 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 283 | int nc_server_config_new_ssh_hostkey(const struct ly_ctx *ctx, const char *endpt_name, const char *hostkey_name, |
| 284 | const char *privkey_path, const char *pubkey_path, struct lyd_node **config); |
| 285 | |
| 286 | /** |
| 287 | * @brief Deletes a hostkey from the YANG data. |
| 288 | * |
| 289 | * @param[in] ctx libyang context. |
| 290 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 291 | * @param[in] hostkey_name Optional identifier of the hostkey to be deleted. |
| 292 | * If NULL, all of the hostkeys on this endpoint will be deleted. |
| 293 | * @param[in,out] config Configuration YANG data tree. |
| 294 | * @return 0 on success, non-zero otherwise. |
| 295 | */ |
| 296 | int nc_server_config_new_ssh_del_hostkey(const struct ly_ctx *ctx, const char *endpt_name, |
| 297 | const char *hostkey_name, struct lyd_node **config); |
| 298 | |
| 299 | /** |
| 300 | * @brief Creates new YANG data nodes for a reference to an asymmetric key located in the keystore. |
| 301 | * |
| 302 | * This asymmetric key pair will be used as the SSH hostkey. |
| 303 | * |
| 304 | * @param[in] ctx libyang context. |
| 305 | * @param[in] endpt_name Arbitrary identifier of an endpoint. |
| 306 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 307 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 308 | * If an endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 309 | * @param[in] keystore_reference Name of the asymmetric key pair to be referenced and used as a hostkey. |
| 310 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 311 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 312 | * @return 0 on success, non-zero otherwise. |
| 313 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 314 | int nc_server_config_new_ssh_keystore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *hostkey_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 315 | const char *keystore_reference, struct lyd_node **config); |
| 316 | |
| 317 | /** |
| 318 | * @brief Deletes a keystore reference from the YANG data. |
| 319 | * |
| 320 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 321 | * @param[in] hostkey_name Identifier of an existing hostkey on the given endpoint. |
| 322 | * @param[in,out] config Configuration YANG data tree. |
| 323 | * @return 0 on success, non-zero otherwise. |
| 324 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 325 | int nc_server_config_new_ssh_del_keystore_ref(const char *endpt_name, const char *hostkey_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 326 | struct lyd_node **config); |
| 327 | |
| 328 | /** |
roman | 68404fd | 2023-07-24 10:40:59 +0200 | [diff] [blame] | 329 | * @brief Creates new YANG configuration data nodes for the maximum amount of failed SSH authentication attempts. |
| 330 | * |
| 331 | * @param[in] ctx libyang context. |
| 332 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 333 | * If an endpoint with this identifier already exists, its contents might be changed. |
| 334 | * @param[in] auth_attempts Maximum amount of failed SSH authentication attempts after which a |
| 335 | * client is disconnected. The default value is 3. |
| 336 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 337 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 338 | * @return 0 on success, non-zero otherwise. |
| 339 | */ |
| 340 | int nc_server_config_new_ssh_auth_attempts(const struct ly_ctx *ctx, const char *endpt_name, uint16_t auth_attempts, |
| 341 | struct lyd_node **config); |
| 342 | |
| 343 | /** |
| 344 | * @brief Creates new YANG configuration data nodes for an SSH authentication timeout. |
| 345 | * |
| 346 | * @param[in] ctx libyang context. |
| 347 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 348 | * If an endpoint with this identifier already exists, its contents might be changed. |
| 349 | * @param[in] auth_timeout Maximum amount of time in seconds after which the authentication is deemed |
| 350 | * unsuccessful. The default value is 10. |
| 351 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 352 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 353 | * @return 0 on success, non-zero otherwise. |
| 354 | */ |
| 355 | int nc_server_config_new_ssh_auth_timeout(const struct ly_ctx *ctx, const char *endpt_name, uint16_t auth_timeout, |
| 356 | struct lyd_node **config); |
| 357 | |
| 358 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 359 | * @brief Creates new YANG configuration data nodes for an SSH user's public key authentication method. |
| 360 | * |
| 361 | * @param[in] ctx libyang context. |
| 362 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 363 | * If an endpoint with this identifier already exists, its user might be changed. |
| 364 | * @param[in] user_name Arbitrary identifier of the user. |
| 365 | * If an user with this identifier already exists, its contents will be changed. |
| 366 | * @param[in] pubkey_name Arbitrary identifier of the user's public key. |
| 367 | * If a public key with this identifier already exists for this user, its contents will be changed. |
| 368 | * @param[in] pubkey_path Path to a file containing the user's public key. |
| 369 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 370 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 371 | * @return 0 on success, non-zero otherwise. |
| 372 | */ |
| 373 | int nc_server_config_new_ssh_user_pubkey(const struct ly_ctx *ctx, const char *endpt_name, |
| 374 | const char *user_name, const char *pubkey_name, const char *pubkey_path, struct lyd_node **config); |
| 375 | |
| 376 | /** |
| 377 | * @brief Deletes an SSH user's public key from the YANG data. |
| 378 | * |
| 379 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 380 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
| 381 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 382 | * If NULL, all of the users public keys will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 383 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 384 | * @return 0 on success, non-zero otherwise. |
| 385 | */ |
| 386 | int nc_server_config_new_ssh_del_user_pubkey(const char *endpt_name, const char *user_name, |
| 387 | const char *pubkey_name, struct lyd_node **config); |
| 388 | |
| 389 | /** |
| 390 | * @brief Creates new YANG configuration data nodes for an SSH user's password authentication method. |
| 391 | * |
| 392 | * @param[in] ctx libyang context. |
| 393 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 394 | * If an endpoint with this identifier already exists, its user might be changed. |
| 395 | * @param[in] user_name Arbitrary identifier of the user. |
| 396 | * If an user with this identifier already exists, its contents will be changed. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 397 | * @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] | 398 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 399 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 400 | * @return 0 on success, non-zero otherwise. |
| 401 | */ |
| 402 | int nc_server_config_new_ssh_user_password(const struct ly_ctx *ctx, const char *endpt_name, |
| 403 | const char *user_name, const char *password, struct lyd_node **config); |
| 404 | |
| 405 | /** |
| 406 | * @brief Deletes an SSH user's password from the YANG data. |
| 407 | * |
| 408 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 409 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 410 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 411 | * @return 0 on success, non-zero otherwise. |
| 412 | */ |
| 413 | int nc_server_config_new_ssh_del_user_password(const char *endpt_name, const char *user_name, |
| 414 | struct lyd_node **config); |
| 415 | |
| 416 | /** |
| 417 | * @brief Creates new YANG configuration data nodes for an SSH user's none authentication method. |
| 418 | * |
| 419 | * @param[in] ctx libyang context. |
| 420 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 421 | * If an endpoint with this identifier already exists, its user might be changed. |
| 422 | * @param[in] user_name Arbitrary identifier of the user. |
| 423 | * If an user with this identifier already exists, its contents will be changed. |
| 424 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 425 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 426 | * @return 0 on success, non-zero otherwise. |
| 427 | */ |
| 428 | int nc_server_config_new_ssh_user_none(const struct ly_ctx *ctx, const char *endpt_name, |
| 429 | const char *user_name, struct lyd_node **config); |
| 430 | |
| 431 | /** |
| 432 | * @brief Deletes an SSH user's none authentication method from the YANG data. |
| 433 | * |
| 434 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 435 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 436 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 437 | * @return 0 on success, non-zero otherwise. |
| 438 | */ |
| 439 | int nc_server_config_new_ssh_del_user_none(const char *endpt_name, const char *user_name, |
| 440 | struct lyd_node **config); |
| 441 | |
| 442 | /** |
| 443 | * @brief Creates new YANG configuration data nodes for an SSH user's keyboard interactive authentication method. |
| 444 | * |
| 445 | * @param[in] ctx libyang context. |
| 446 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 447 | * If an endpoint with this identifier already exists, its user might be changed. |
| 448 | * @param[in] user_name Arbitrary identifier of the user. |
| 449 | * If an user with this identifier already exists, its contents will be changed. |
| 450 | * @param[in] pam_config_name Name of the PAM configuration file. |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 451 | * @param[in] pam_config_dir Optional. The absolute path to the directory in which the configuration file |
| 452 | * with the name pam_config_name is located. A newer version (>= 1.4) of PAM library is required to be able to specify |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 453 | * the path. If NULL is passed, then the PAM's system directories will be searched (usually /etc/pam.d/). |
| 454 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 455 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 456 | * @return 0 on success, non-zero otherwise. |
| 457 | */ |
| 458 | int nc_server_config_new_ssh_user_interactive(const struct ly_ctx *ctx, const char *endpt_name, |
| 459 | const char *user_name, const char *pam_config_name, const char *pam_config_dir, struct lyd_node **config); |
| 460 | |
| 461 | /** |
| 462 | * @brief Deletes an SSH user's keyboard interactive authentication from the YANG data. |
| 463 | * |
| 464 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 465 | * @param[in] user_name Identifier of an existing user on the given endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 466 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 467 | * @return 0 on success, non-zero otherwise. |
| 468 | */ |
| 469 | int nc_server_config_new_ssh_del_user_interactive(const char *endpt_name, const char *user_name, |
| 470 | struct lyd_node **config); |
| 471 | |
| 472 | /** |
| 473 | * @brief Deletes an SSH user from the YANG data. |
| 474 | * |
| 475 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 476 | * @param[in] user_name Optional identifier of an user to be deleted. |
| 477 | * If NULL, all of the users on this endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 478 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 479 | * @return 0 on success, non-zero otherwise. |
| 480 | */ |
| 481 | int nc_server_config_new_ssh_del_user(const char *endpt_name, |
| 482 | const char *user_name, struct lyd_node **config); |
| 483 | |
| 484 | /** |
| 485 | * @brief Creates new YANG data nodes for a reference to a public key bag located in the truststore. |
| 486 | * |
| 487 | * The public key's located in the bag will be used for client authentication. |
| 488 | * |
| 489 | * @param[in] ctx libyang context. |
| 490 | * @param[in] endpt_name Arbitrary identifier of an endpoint. |
| 491 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 492 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 493 | * If an endpoint's user with this identifier already exists, its contents will be changed. |
| 494 | * @param[in] truststore_reference Name of the public key bag to be referenced and used for authentication. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 495 | * @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] | 496 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 497 | * @return 0 on success, non-zero otherwise. |
| 498 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 499 | int nc_server_config_new_ssh_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *user_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 500 | const char *truststore_reference, struct lyd_node **config); |
| 501 | |
| 502 | /** |
| 503 | * @brief Deletes a truststore reference from the YANG data. |
| 504 | * |
| 505 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 506 | * @param[in] user_name Identifier of an user on the given endpoint whose truststore reference will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 507 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 508 | * @return 0 on success, non-zero otherwise. |
| 509 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 510 | int nc_server_config_new_ssh_del_truststore_ref(const char *endpt_name, const char *user_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 511 | struct lyd_node **config); |
| 512 | |
| 513 | /** |
| 514 | * @brief Creates new YANG configuration data nodes, which will be a reference to another SSH endpoint's users. |
| 515 | * |
| 516 | * Whenever a client tries to connect to the referencing endpoint, all of its users will be tried first. If no match is |
| 517 | * found, the referenced endpoint's configured users will be tried. |
| 518 | * |
| 519 | * @param[in] ctx libyang context |
| 520 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 521 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 522 | * @param[in] referenced_endpt Identifier of an endpoint, which has to exist whenever this data |
| 523 | * is applied. The referenced endpoint can reference another one and so on, but there mustn't be a cycle. |
| 524 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 525 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 526 | * @return 0 on success, non-zero otherwise. |
| 527 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 528 | int nc_config_new_ssh_endpoint_user_ref(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 529 | const char *referenced_endpt, struct lyd_node **config); |
| 530 | |
| 531 | /** |
| 532 | * @brief Deletes reference to another SSH endpoint's users from the YANG data. |
| 533 | * |
| 534 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 535 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 536 | * @return 0 on success, non-zero otherwise. |
| 537 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 538 | int nc_config_new_ssh_del_endpoint_user_ref(const char *endpt_name, struct lyd_node **config); |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 539 | |
| 540 | /** |
| 541 | * @brief Creates new YANG configuration data nodes for host-key algorithms replacing any previous ones. |
| 542 | * |
| 543 | * Supported algorithms are: ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, |
| 544 | * rsa-sha2-512, rsa-sha2-256, ssh-rsa and ssh-dss. |
| 545 | * |
| 546 | * @param[in] ctx libyang context |
| 547 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 548 | * If an endpoint with this identifier already exists, its host-key algorithms will be replaced. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 549 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 550 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 551 | * @param[in] alg_count Number of following algorithms. |
| 552 | * @param[in] ... String literals of host-key algorithms in a decreasing order of preference. |
| 553 | * @return 0 on success, non-zero otherwise. |
| 554 | */ |
roman | 466719d | 2023-05-05 16:14:37 +0200 | [diff] [blame] | 555 | int nc_server_config_new_ssh_host_key_algs(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 556 | struct lyd_node **config, int alg_count, ...); |
| 557 | |
| 558 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 559 | * @brief Deletes a hostkey algorithm from the YANG data. |
| 560 | * |
| 561 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 562 | * @param[in] alg Optional algorithm to be deleted. |
| 563 | * If NULL, all of the hostkey algorithms on this endpoint will be deleted. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 564 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 565 | * @return 0 on success, non-zero otherwise. |
| 566 | */ |
| 567 | int nc_server_config_new_ssh_del_host_key_alg(const char *endpt_name, const char *alg, struct lyd_node **config); |
| 568 | |
| 569 | /** |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 570 | * @brief Creates new YANG configuration data nodes for key exchange algorithms replacing any previous ones. |
| 571 | * |
| 572 | * Supported algorithms are: diffie-hellman-group-exchange-sha1, curve25519-sha256, ecdh-sha2-nistp256, |
| 573 | * ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group18-sha512, diffie-hellman-group16-sha512, |
| 574 | * diffie-hellman-group-exchange-sha256 and diffie-hellman-group14-sha256. |
| 575 | * |
| 576 | * @param[in] ctx libyang context |
| 577 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 578 | * If an endpoint with this identifier already exists, its key exchange algorithms will be replaced. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 579 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 580 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 581 | * @param[in] alg_count Number of following algorithms. |
| 582 | * @param[in] ... String literals of key exchange algorithms in a decreasing order of preference. |
| 583 | * @return 0 on success, non-zero otherwise. |
| 584 | */ |
roman | 466719d | 2023-05-05 16:14:37 +0200 | [diff] [blame] | 585 | int nc_server_config_new_ssh_key_exchange_algs(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config, |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 586 | int alg_count, ...); |
| 587 | |
| 588 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 589 | * @brief Deletes a key exchange algorithm from the YANG data. |
| 590 | * |
| 591 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 592 | * @param[in] alg Optional algorithm to be deleted. |
| 593 | * If NULL, all of the key exchange algorithms on this endpoint will be deleted. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 594 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 595 | * @return 0 on success, non-zero otherwise. |
| 596 | */ |
| 597 | int nc_server_config_new_ssh_del_key_exchange_alg(const char *endpt_name, const char *alg, struct lyd_node **config); |
| 598 | |
| 599 | /** |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 600 | * @brief Creates new YANG configuration data nodes for encryption algorithms replacing any previous ones. |
| 601 | * |
| 602 | * Supported algorithms are: aes256-ctr, aes192-ctr, aes128-ctr, aes256-cbc, aes192-cbc, aes128-cbc, blowfish-cbc |
| 603 | * triple-des-cbc and none. |
| 604 | * |
| 605 | * @param[in] ctx libyang context |
| 606 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 607 | * If an endpoint with this identifier already exists, its encryption algorithms will be replaced. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 608 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 609 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 610 | * @param[in] alg_count Number of following algorithms. |
| 611 | * @param[in] ... String literals of encryption algorithms in a decreasing order of preference. |
| 612 | * @return 0 on success, non-zero otherwise. |
| 613 | */ |
roman | 466719d | 2023-05-05 16:14:37 +0200 | [diff] [blame] | 614 | int nc_server_config_new_ssh_encryption_algs(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config, |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 615 | int alg_count, ...); |
| 616 | |
| 617 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 618 | * @brief Deletes an encryption algorithm from the YANG data. |
| 619 | * |
| 620 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 621 | * @param[in] alg Optional algorithm to be deleted. |
| 622 | * If NULL, all of the encryption algorithms on this endpoint will be deleted. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 623 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 624 | * @return 0 on success, non-zero otherwise. |
| 625 | */ |
| 626 | int nc_server_config_new_ssh_del_encryption_alg(const char *endpt_name, const char *alg, struct lyd_node **config); |
| 627 | |
| 628 | /** |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 629 | * @brief Creates new YANG configuration data nodes for mac algorithms replacing any previous ones. |
| 630 | * |
| 631 | * Supported algorithms are: hmac-sha2-256, hmac-sha2-512 and hmac-sha1. |
| 632 | * |
| 633 | * @param[in] ctx libyang context |
| 634 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 635 | * If an endpoint with this identifier already exists, its mac algorithms will be replaced. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 636 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 637 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 638 | * @param[in] alg_count Number of following algorithms. |
| 639 | * @param[in] ... String literals of mac algorithms in a decreasing order of preference. |
| 640 | * @return 0 on success, non-zero otherwise. |
| 641 | */ |
roman | 466719d | 2023-05-05 16:14:37 +0200 | [diff] [blame] | 642 | int nc_server_config_new_ssh_mac_algs(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config, |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 643 | int alg_count, ...); |
| 644 | |
| 645 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 646 | * @brief Deletes a mac algorithm from the YANG data. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 647 | * |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 648 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 649 | * @param[in] alg Optional algorithm to be deleted. |
| 650 | * If NULL, all of the mac algorithms on this endpoint will be deleted. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 651 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 652 | * @return 0 on success, non-zero otherwise. |
| 653 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 654 | int nc_server_config_new_ssh_del_mac_alg(const char *endpt_name, const char *alg, struct lyd_node **config); |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 655 | |
| 656 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 657 | * @} SSH Server Configuration |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 658 | */ |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 659 | |
| 660 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 661 | * @defgroup server_config_tls TLS Server Configuration |
| 662 | * @ingroup server_config |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 663 | * |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 664 | * @brief TLS server configuration creation and deletion |
| 665 | * @{ |
roman | 9b1379c | 2023-03-31 10:11:10 +0200 | [diff] [blame] | 666 | */ |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 667 | |
| 668 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 669 | * @brief Creates new YANG configuration data nodes for a server's certificate. |
| 670 | * |
| 671 | * @param[in] ctx libyang context. |
| 672 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 673 | * 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] | 674 | * @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] | 675 | * @param[in] pubkey_path Optional path to the server's public key file. If not provided, |
| 676 | * it will be generated from the private key. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 677 | * @param[in] certificate_path Path to the server's certificate file. |
| 678 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 679 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 680 | * @return 0 on success, non-zero otherwise. |
| 681 | */ |
roman | 6c4efcd | 2023-08-08 10:18:44 +0200 | [diff] [blame] | 682 | int nc_server_config_new_tls_server_certificate(const struct ly_ctx *ctx, const char *endpt_name, const char *privkey_path, |
| 683 | const char *pubkey_path, const char *certificate_path, struct lyd_node **config); |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 684 | |
| 685 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 686 | * @brief Deletes the server's certificate from the YANG data. |
| 687 | * |
| 688 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 689 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 690 | * @return 0 on success, non-zero otherwise. |
| 691 | */ |
| 692 | int nc_server_config_new_tls_del_server_certificate(const char *endpt_name, struct lyd_node **config); |
| 693 | |
| 694 | /** |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 695 | * @brief Creates new YANG configuration data nodes for a keystore reference to the TLS server's certificate. |
| 696 | * |
| 697 | * @param[in] ctx libyang context. |
| 698 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 699 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 700 | * @param[in] asym_key_ref Name of the asymmetric key pair in the keystore to be referenced. |
| 701 | * @param[in] cert_ref Name of the certificate, which must belong to the given asymmetric key pair, to be referenced. |
| 702 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 703 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 704 | * @return 0 on success, non-zero otherwise. |
| 705 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 706 | int nc_server_config_new_tls_keystore_ref(const struct ly_ctx *ctx, const char *endpt_name, const char *asym_key_ref, |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 707 | const char *cert_ref, struct lyd_node **config); |
| 708 | |
| 709 | /** |
| 710 | * @brief Deletes a TLS server certificate keystore reference from the YANG data. |
| 711 | * |
| 712 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 713 | * @param[in,out] config Modified configuration YANG data tree. |
| 714 | * @return 0 on success, non-zero otherwise. |
| 715 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 716 | int nc_server_config_new_tls_del_keystore_ref(const char *endpt_name, struct lyd_node **config); |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 717 | |
| 718 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 719 | * @brief Creates new YANG configuration data nodes for a client's (end-entity) certificate. |
| 720 | * |
| 721 | * @param[in] ctx libyang context. |
| 722 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 723 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 724 | * @param[in] cert_name Arbitrary identifier of the client's certificate. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 725 | * If a client certificate with this identifier already exists, it will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 726 | * @param[in] cert_path Path to the client's certificate file. |
| 727 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 728 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 729 | * @return 0 on success, non-zero otherwise. |
| 730 | */ |
| 731 | int nc_server_config_new_tls_client_certificate(const struct ly_ctx *ctx, const char *endpt_name, const char *cert_name, |
| 732 | const char *cert_path, struct lyd_node **config); |
| 733 | |
| 734 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 735 | * @brief Deletes a client (end-entity) certificate from the YANG data. |
| 736 | * |
| 737 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 738 | * @param[in] cert_name Optional name of a certificate to be deleted. |
| 739 | * 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] | 740 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 741 | * @return 0 on success, non-zero otherwise. |
| 742 | */ |
| 743 | int nc_server_config_new_tls_del_client_certificate(const char *endpt_name, const char *cert_name, struct lyd_node **config); |
| 744 | |
| 745 | /** |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 746 | * @brief Creates new YANG configuration data nodes for a truststore reference to a set of client (end-entity) certificates. |
| 747 | * |
| 748 | * @param[in] ctx libyang context. |
| 749 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 750 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 751 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 752 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 753 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 754 | * @return 0 on success, non-zero otherwise. |
| 755 | */ |
| 756 | int nc_server_config_new_tls_client_cert_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, |
| 757 | const char *cert_bag_ref, struct lyd_node **config); |
| 758 | |
| 759 | /** |
| 760 | * @brief Deletes a client (end-entity) certificates truststore reference from the YANG data. |
| 761 | * |
| 762 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 763 | * @param[in,out] config Modified configuration YANG data tree. |
| 764 | * @return 0 on success, non-zero otherwise. |
| 765 | */ |
| 766 | int nc_server_config_new_tls_del_client_cert_truststore_ref(const char *endpt_name, struct lyd_node **config); |
| 767 | |
| 768 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 769 | * @brief Creates new YANG configuration data nodes for a client certificate authority (trust-anchor) certificate. |
| 770 | * |
| 771 | * @param[in] ctx libyang context. |
| 772 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 773 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 774 | * @param[in] cert_name Arbitrary identifier of the certificate authority certificate. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 775 | * If a CA with this identifier already exists, it will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 776 | * @param[in] cert_path Path to the CA certificate file. |
| 777 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 778 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 779 | * @return 0 on success, non-zero otherwise. |
| 780 | */ |
| 781 | int nc_server_config_new_tls_client_ca(const struct ly_ctx *ctx, const char *endpt_name, const char *cert_name, |
| 782 | const char *cert_path, struct lyd_node **config); |
| 783 | |
| 784 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 785 | * @brief Deletes a client certificate authority (trust-anchor) certificate from the YANG data. |
| 786 | * |
| 787 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 788 | * @param[in] cert_name Optional name of a certificate to be deleted. |
| 789 | * 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] | 790 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 791 | * @return 0 on success, non-zero otherwise. |
| 792 | */ |
| 793 | int nc_server_config_new_tls_del_client_ca(const char *endpt_name, const char *cert_name, struct lyd_node **config); |
| 794 | |
| 795 | /** |
roman | 12c3d52 | 2023-07-26 13:39:30 +0200 | [diff] [blame] | 796 | * @brief Creates new YANG configuration data nodes for a truststore reference to a set of client certificate authority (trust-anchor) certificates. |
| 797 | * |
| 798 | * @param[in] ctx libyang context. |
| 799 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
| 800 | * If an endpoint with this identifier already exists, its contents will be changed. |
| 801 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 802 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 803 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 804 | * @return 0 on success, non-zero otherwise. |
| 805 | */ |
| 806 | int nc_server_config_new_tls_client_ca_truststore_ref(const struct ly_ctx *ctx, const char *endpt_name, |
| 807 | const char *cert_bag_ref, struct lyd_node **config); |
| 808 | |
| 809 | /** |
| 810 | * @brief Deletes a client certificate authority (trust-anchor) certificates truststore reference from the YANG data. |
| 811 | * |
| 812 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 813 | * @param[in,out] config Modified configuration YANG data tree. |
| 814 | * @return 0 on success, non-zero otherwise. |
| 815 | */ |
| 816 | int nc_server_config_new_tls_del_client_ca_truststore_ref(const char *endpt_name, struct lyd_node **config); |
| 817 | |
| 818 | /** |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 819 | * @brief Creates new YANG configuration data nodes for a cert-to-name entry. |
| 820 | * |
| 821 | * @param[in] ctx libyang context. |
| 822 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 823 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 3f9b65c | 2023-06-05 14:26:58 +0200 | [diff] [blame] | 824 | * @param[in] id ID of the entry. The lower the ID, the higher the priority of the entry (it will be checked earlier). |
| 825 | * @param[in] fingerprint Optional fingerprint of the entry. The fingerprint should always be set, however if it is |
| 826 | * not set, it will match any certificate. Entry with no fingerprint should therefore be placed only as the last entry. |
| 827 | * @param[in] map_type Mapping username to the certificate option. |
| 828 | * @param[in] name Username for this cert-to-name entry. |
| 829 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 830 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 831 | * @return 0 on success, non-zero otherwise. |
| 832 | */ |
| 833 | int nc_server_config_new_tls_ctn(const struct ly_ctx *ctx, const char *endpt_name, uint32_t id, const char *fingerprint, |
| 834 | NC_TLS_CTN_MAPTYPE map_type, const char *name, struct lyd_node **config); |
| 835 | |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 836 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 837 | * @brief Deletes a cert-to-name entry from the YANG data. |
| 838 | * |
| 839 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 840 | * @param[in] id Optional ID of the CTN entry. |
| 841 | * 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] | 842 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 843 | * @return 0 on success, non-zero otherwise. |
| 844 | */ |
| 845 | int nc_server_config_new_tls_del_ctn(const char *endpt_name, uint32_t id, struct lyd_node **config); |
| 846 | |
| 847 | /** |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 848 | * @brief Creates new YANG configuration data nodes for a TLS version. |
| 849 | * |
| 850 | * @param[in] ctx libyang context. |
| 851 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 852 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 853 | * @param[in] tls_version TLS version to be used. Call this multiple times to set |
| 854 | * the accepted versions of the TLS protocol and let the client and server negotiate |
| 855 | * the given version. |
| 856 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 857 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 858 | * @return 0 on success, non-zero otherwise. |
| 859 | */ |
| 860 | int nc_server_config_new_tls_version(const struct ly_ctx *ctx, const char *endpt_name, |
| 861 | NC_TLS_VERSION tls_version, struct lyd_node **config); |
| 862 | |
| 863 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 864 | * @brief Deletes a TLS version from the YANG data. |
| 865 | * |
| 866 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 867 | * @param[in] tls_version TLS version to be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 868 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 869 | * @return 0 on success, non-zero otherwise. |
| 870 | */ |
| 871 | int nc_server_config_new_tls_del_version(const char *endpt_name, NC_TLS_VERSION tls_version, struct lyd_node **config); |
| 872 | |
| 873 | /** |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 874 | * @brief Creates new YANG configuration data nodes for a TLS cipher. |
| 875 | * |
| 876 | * @param[in] ctx libyang context. |
| 877 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 878 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 879 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 880 | * Otherwise the new YANG data will be added to the previous data and may override it. |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 881 | * @param[in] cipher_count Number of following ciphers. |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 882 | * @param[in] ... TLS ciphers. These ciphers MUST be in the format as listed in the |
| 883 | * iana-tls-cipher-suite-algs YANG model (lowercase and separated by dashes). Regardless |
| 884 | * of the TLS protocol version used, all of these ciphers will be tried and some of them |
| 885 | * might not be set (TLS handshake might fail then). For the list of supported ciphers see |
| 886 | * the OpenSSL documentation. |
| 887 | * @return 0 on success, non-zero otherwise. |
| 888 | */ |
| 889 | int nc_server_config_new_tls_ciphers(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config, |
roman | 08f67f4 | 2023-06-08 13:51:54 +0200 | [diff] [blame] | 890 | int cipher_count, ...); |
roman | 12644fe | 2023-06-08 11:06:42 +0200 | [diff] [blame] | 891 | |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 892 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 893 | * @brief Deletes a TLS cipher from the YANG data. |
| 894 | * |
| 895 | * @param[in] endpt_name Identifier of an existing endpoint. |
| 896 | * @param[in] cipher TLS cipher to be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 897 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 898 | * @return 0 on success, non-zero otherwise. |
| 899 | */ |
| 900 | int nc_server_config_new_tls_del_cipher(const char *endpt_name, const char *cipher, struct lyd_node **config); |
| 901 | |
| 902 | /** |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 903 | * @brief Creates new YANG configuration data nodes for a Certificate Revocation List via a local file. |
| 904 | * |
| 905 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 906 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 907 | * |
| 908 | * @param[in] ctx libyang context. |
| 909 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 910 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 911 | * @param[in] crl_path Path to a DER/PEM encoded CRL file. |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 912 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 913 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 914 | * @return 0 on success, non-zero otherwise. |
| 915 | */ |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 916 | int nc_server_config_new_tls_crl_path(const struct ly_ctx *ctx, const char *endpt_name, |
| 917 | const char *crl_path, struct lyd_node **config); |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 918 | |
| 919 | /** |
| 920 | * @brief Creates new YANG configuration data nodes for a Certificate Revocation List via an URL. |
| 921 | * |
| 922 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 923 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 924 | * |
| 925 | * @param[in] ctx libyang context. |
| 926 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 927 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 928 | * @param[in] crl_url URL from which the CRL file will be downloaded. The file has to be in the DER or PEM format. |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 929 | * The allowed protocols are all the protocols supported by CURL. |
| 930 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 931 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 932 | * @return 0 on success, non-zero otherwise. |
| 933 | */ |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 934 | int nc_server_config_new_tls_crl_url(const struct ly_ctx *ctx, const char *endpt_name, const char *crl_url, struct lyd_node **config); |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 935 | |
| 936 | /** |
| 937 | * @brief Creates new YANG configuration data nodes for a Certificate Revocation List via certificate extensions. |
| 938 | * |
| 939 | * The chain of configured Certificate Authorities will be examined. For each certificate in this chain all the |
| 940 | * CRLs from the URLs specified in their extension fields CRL Distribution Points will be downloaded and used. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 941 | * |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 942 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 943 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 944 | * |
| 945 | * @param[in] ctx libyang context. |
| 946 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 947 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | faecc58 | 2023-06-15 16:13:31 +0200 | [diff] [blame] | 948 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 949 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 950 | * @return 0 on success, non-zero otherwise. |
| 951 | */ |
| 952 | int nc_server_config_new_tls_crl_cert_ext(const struct ly_ctx *ctx, const char *endpt_name, struct lyd_node **config); |
| 953 | |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 954 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 955 | * @brief Deletes all the CRL nodes from the YANG data. |
| 956 | * |
| 957 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 958 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 959 | * @return 0 on success, non-zero otherwise. |
| 960 | */ |
| 961 | int nc_server_config_new_tls_del_crl(const char *endpt_name, struct lyd_node **config); |
| 962 | |
| 963 | /** |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 964 | * @brief Creates new YANG configuration data nodes, which will be a reference to another TLS endpoint's certificates. |
| 965 | * |
| 966 | * Whenever an user tries to connect to the referencing endpoint, all of its certificates will be tried first. If no match is |
| 967 | * found, the referenced endpoint's configured certificates will be tried. The same applies to cert-to-name entries. |
| 968 | * |
| 969 | * @param[in] ctx libyang context |
| 970 | * @param[in] endpt_name Arbitrary identifier of the endpoint. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 971 | * If an endpoint with this identifier already exists, its contents will be changed. |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 972 | * @param[in] referenced_endpt Identifier of an endpoint, which has to exist whenever this data |
| 973 | * is applied. The referenced endpoint can reference another one and so on, but there mustn't be a cycle. |
| 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 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 978 | int nc_config_new_tls_endpoint_client_ref(const struct ly_ctx *ctx, const char *endpt_name, |
roman | 2e797ef | 2023-06-19 10:47:49 +0200 | [diff] [blame] | 979 | const char *referenced_endpt, struct lyd_node **config); |
| 980 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 981 | /** |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 982 | * @brief Deletes reference to another TLS endpoint's users from the YANG data. |
| 983 | * |
| 984 | * @param[in] endpt_name Identifier of an existing endpoint. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 985 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 986 | * @return 0 on success, non-zero otherwise. |
| 987 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 988 | int nc_config_new_tls_del_endpoint_client_ref(const char *endpt_name, struct lyd_node **config); |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 989 | |
| 990 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 991 | * @} TLS Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 992 | */ |
| 993 | |
| 994 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 995 | * @defgroup server_config_ch Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 996 | * @ingroup server_config |
| 997 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 998 | * @brief Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 999 | * @{ |
| 1000 | */ |
| 1001 | |
| 1002 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1003 | * @} Call Home Server Configuration |
| 1004 | */ |
| 1005 | |
| 1006 | /** |
| 1007 | * @defgroup server_config_ch_functions Call Home Server Configuration Functions |
| 1008 | * @ingroup server_config_ch |
| 1009 | * |
| 1010 | * @brief Call Home server configuration functions |
| 1011 | * @{ |
| 1012 | */ |
| 1013 | |
| 1014 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1015 | * @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] | 1016 | * |
| 1017 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1018 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1019 | * 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] | 1020 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1021 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1022 | * @param[in] transport Transport protocol to be used on this endpoint - either SSH or TLS. |
| 1023 | * @param[in] address Address to connect to. |
| 1024 | * @param[in] port Port to connect to. |
| 1025 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1026 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1027 | * @return 0 on success, non-zero otherwise. |
| 1028 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1029 | int nc_server_config_new_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] | 1030 | NC_TRANSPORT_IMPL transport, const char *address, const char *port, struct lyd_node **config); |
| 1031 | |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1032 | #endif /* NC_ENABLED_SSH_TLS */ |
| 1033 | |
| 1034 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1035 | * @brief Deletes a Call Home client from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1036 | * |
| 1037 | * @param[in] client_name Optional identifier of a client to be deleted. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1038 | * If NULL, all of the Call Home clients will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1039 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1040 | * @return 0 on success, non-zero otherwise. |
| 1041 | */ |
| 1042 | int nc_server_config_new_del_ch_client(const char *client_name, struct lyd_node **config); |
| 1043 | |
| 1044 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1045 | * @brief Deletes a Call Home endpoint from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1046 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1047 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1048 | * @param[in] endpt_name Optional identifier of a CH endpoint to be deleted. |
| 1049 | * 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] | 1050 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1051 | * @return 0 on success, non-zero otherwise. |
| 1052 | */ |
| 1053 | int nc_server_config_new_ch_del_endpt(const char *client_name, const char *endpt_name, struct lyd_node **config); |
| 1054 | |
| 1055 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1056 | * @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] | 1057 | * |
| 1058 | * This is the default connection type. If periodic connection type was set before, it will be unset. |
| 1059 | * |
| 1060 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1061 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1062 | * 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] | 1063 | * @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] | 1064 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1065 | * @return 0 on success, non-zero otherwise. |
| 1066 | */ |
| 1067 | int nc_server_config_new_ch_persistent(const struct ly_ctx *ctx, const char *client_name, struct lyd_node **config); |
| 1068 | |
| 1069 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1070 | * @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] | 1071 | * |
| 1072 | * If called, the persistent connection type will be replaced by periodic. |
| 1073 | * |
| 1074 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1075 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1076 | * 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] | 1077 | * @param[in] period Duration between periodic connections in minutes. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1078 | * @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] | 1079 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1080 | * @return 0 on success, non-zero otherwise. |
| 1081 | */ |
| 1082 | int nc_server_config_new_ch_period(const struct ly_ctx *ctx, const char *client_name, uint16_t period, |
| 1083 | struct lyd_node **config); |
| 1084 | |
| 1085 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1086 | * @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] | 1087 | * |
| 1088 | * This behaves the same as setting the period to 60 minutes, which is the default value of this node. |
| 1089 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1090 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1091 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1092 | * @return 0 on success, non-zero otherwise. |
| 1093 | */ |
| 1094 | int nc_server_config_new_ch_del_period(const char *client_name, struct lyd_node **config); |
| 1095 | |
| 1096 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1097 | * @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] | 1098 | * |
| 1099 | * If called, the persistent connection type will be replaced by periodic. |
| 1100 | * |
| 1101 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1102 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1103 | * 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] | 1104 | * @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] | 1105 | * @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] | 1106 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1107 | * @return 0 on success, non-zero otherwise. |
| 1108 | */ |
| 1109 | int nc_server_config_new_ch_anchor_time(const struct ly_ctx *ctx, const char *client_name, |
| 1110 | const char *anchor_time, struct lyd_node **config); |
| 1111 | |
| 1112 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1113 | * @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] | 1114 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1115 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1116 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1117 | * @return 0 on success, non-zero otherwise. |
| 1118 | */ |
| 1119 | int nc_server_config_new_ch_del_anchor_time(const char *client_name, struct lyd_node **config); |
| 1120 | |
| 1121 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1122 | * @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] | 1123 | * |
| 1124 | * If called, the persistent connection type will be replaced by periodic. |
| 1125 | * |
| 1126 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1127 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1128 | * 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] | 1129 | * @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] | 1130 | * @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] | 1131 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1132 | * @return 0 on success, non-zero otherwise. |
| 1133 | */ |
| 1134 | int nc_server_config_new_ch_idle_timeout(const struct ly_ctx *ctx, const char *client_name, |
| 1135 | uint16_t idle_timeout, struct lyd_node **config); |
| 1136 | |
| 1137 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1138 | * @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] | 1139 | * |
| 1140 | * This behaves the same as setting the timeout to 180 seconds, which is the default value of this node. |
| 1141 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1142 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1143 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1144 | * @return 0 on success, non-zero otherwise. |
| 1145 | */ |
| 1146 | int nc_server_config_new_ch_del_idle_timeout(const char *client_name, struct lyd_node **config); |
| 1147 | |
| 1148 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1149 | * @brief Creates new YANG configuration data nodes for the Call Home reconnect strategy. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1150 | * |
| 1151 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1152 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1153 | * 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] | 1154 | * @param[in] start_with Specifies which endpoint to try if a connection is unsuccessful. Default value is NC_CH_FIRST_LISTED. |
| 1155 | * @param[in] max_wait The number of seconds after which a connection to an endpoint is deemed unsuccessful. Default value if 5. |
| 1156 | * @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] | 1157 | * @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] | 1158 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1159 | * @return 0 on success, non-zero otherwise. |
| 1160 | */ |
| 1161 | int nc_server_config_new_ch_reconnect_strategy(const struct ly_ctx *ctx, const char *client_name, |
| 1162 | NC_CH_START_WITH start_with, uint16_t max_wait, uint8_t max_attempts, struct lyd_node **config); |
| 1163 | |
| 1164 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1165 | * @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] | 1166 | * |
| 1167 | * The default values are: start-with = NC_CH_FIRST_LISTED, max-wait = 5 and max-attempts = 3. |
| 1168 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1169 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1170 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1171 | * @return 0 on success, non-zero otherwise. |
| 1172 | */ |
| 1173 | int nc_server_config_new_ch_del_reconnect_strategy(const char *client_name, struct lyd_node **config); |
| 1174 | |
| 1175 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1176 | * @} Call Home Server Configuration Functions |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1177 | */ |
| 1178 | |
| 1179 | #ifdef NC_ENABLED_SSH_TLS |
| 1180 | |
| 1181 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1182 | * @defgroup server_config_ch_ssh SSH Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1183 | * @ingroup server_config_ch |
| 1184 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1185 | * @brief SSH Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1186 | * @{ |
| 1187 | */ |
| 1188 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1189 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1190 | * @brief Creates new YANG data nodes for a Call Home SSH hostkey. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1191 | * |
| 1192 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1193 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1194 | * 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] | 1195 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1196 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1197 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 1198 | * If the endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 1199 | * @param[in] privkey_path Path to a file containing a private key. |
| 1200 | * The private key has to be in a PEM format. Only RSA and ECDSA keys are supported. |
| 1201 | * @param[in] pubkey_path Path to a file containing a public key. If NULL, public key will be |
| 1202 | * generated from the private key. |
| 1203 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1204 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1205 | * @return 0 on success, non-zero otherwise. |
| 1206 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1207 | int nc_server_config_new_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] | 1208 | const char *hostkey_name, const char *privkey_path, const char *pubkey_path, struct lyd_node **config); |
| 1209 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1210 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1211 | * @brief Deletes a Call Home hostkey from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1212 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1213 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1214 | * @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] | 1215 | * @param[in] hostkey_name Optional identifier of a hostkey to be deleted. |
| 1216 | * If NULL, all of the hostkeys on the given endpoint will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1217 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1218 | * @return 0 on success, non-zero otherwise. |
| 1219 | */ |
| 1220 | int nc_server_config_new_ch_ssh_del_hostkey(const char *client_name, const char *endpt_name, |
| 1221 | const char *hostkey_name, struct lyd_node **config); |
| 1222 | |
| 1223 | /** |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1224 | * @brief Creates new YANG data nodes for a reference to an asymmetric key located in the keystore. |
| 1225 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1226 | * This asymmetric key pair will be used as the Call Home SSH hostkey. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1227 | * |
| 1228 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1229 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1230 | * 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] | 1231 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1232 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1233 | * @param[in] hostkey_name Arbitrary identifier of the endpoint's hostkey. |
| 1234 | * If the endpoint's hostkey with this identifier already exists, its contents will be changed. |
| 1235 | * @param[in] keystore_reference Name of the asymmetric key pair to be referenced and used as a hostkey. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1236 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1237 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1238 | * @return 0 on success, non-zero otherwise. |
| 1239 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1240 | int nc_server_config_new_ch_ssh_keystore_ref(const struct ly_ctx *ctx, const char *client_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1241 | const char *endpt_name, const char *hostkey_name, const char *keystore_reference, struct lyd_node **config); |
| 1242 | |
| 1243 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1244 | * @brief Deletes a Call Home keystore reference from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1245 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1246 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1247 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1248 | * @param[in] hostkey_name Identifier of an existing hostkey that belongs to the given CH endpoint. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1249 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1250 | * @return 0 on success, non-zero otherwise. |
| 1251 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1252 | int nc_server_config_new_ch_ssh_del_keystore_ref(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1253 | const char *hostkey_name, struct lyd_node **config); |
| 1254 | |
| 1255 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1256 | * @brief Creates new YANG configuration data nodes for the maximum amount of failed Call Home SSH authentication attempts. |
roman | 68404fd | 2023-07-24 10:40:59 +0200 | [diff] [blame] | 1257 | * |
| 1258 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1259 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1260 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 68404fd | 2023-07-24 10:40:59 +0200 | [diff] [blame] | 1261 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1262 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1263 | * @param[in] auth_attempts Maximum amount of failed SSH authentication attempts after which a |
| 1264 | * client is disconnected. The default value is 3. |
| 1265 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1266 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1267 | * @return 0 on success, non-zero otherwise. |
| 1268 | */ |
| 1269 | int nc_server_config_new_ch_ssh_auth_attempts(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1270 | uint16_t auth_attempts, struct lyd_node **config); |
| 1271 | |
| 1272 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1273 | * @brief Creates new YANG configuration data nodes for a Call Home SSH authentication timeout. |
roman | 68404fd | 2023-07-24 10:40:59 +0200 | [diff] [blame] | 1274 | * |
| 1275 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1276 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1277 | * If a Call Home client with this identifier already exists, its contents will be changed. |
roman | 68404fd | 2023-07-24 10:40:59 +0200 | [diff] [blame] | 1278 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1279 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1280 | * @param[in] auth_timeout Maximum amount of time in seconds after which the authentication is deemed |
| 1281 | * unsuccessful. The default value is 10. |
| 1282 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1283 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1284 | * @return 0 on success, non-zero otherwise. |
| 1285 | */ |
| 1286 | int nc_server_config_new_ch_ssh_auth_timeout(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1287 | uint16_t auth_timeout, struct lyd_node **config); |
| 1288 | |
| 1289 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1290 | * @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] | 1291 | * |
| 1292 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1293 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1294 | * 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] | 1295 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1296 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1297 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1298 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1299 | * @param[in] pubkey_name Arbitrary identifier of the user's public key. |
| 1300 | * If the user's public key with this identifier already exists, its contents will be changed. |
| 1301 | * @param[in] pubkey_path Path to a file containing a public key. |
| 1302 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1303 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1304 | * @return 0 on success, non-zero otherwise. |
| 1305 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1306 | int nc_server_config_new_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] | 1307 | const char *user_name, const char *pubkey_name, const char *pubkey_path, struct lyd_node **config); |
| 1308 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1309 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1310 | * @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] | 1311 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1312 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1313 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1314 | * @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] | 1315 | * @param[in] pubkey_name Optional identifier of a public key to be deleted. |
| 1316 | * 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] | 1317 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1318 | * @return 0 on success, non-zero otherwise. |
| 1319 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1320 | int nc_server_config_new_ch_ssh_del_user_pubkey(const char *client_name, const char *endpt_name, |
| 1321 | const char *user_name, const char *pubkey_name, struct lyd_node **config); |
roman | 5cbb653 | 2023-06-22 12:53:17 +0200 | [diff] [blame] | 1322 | |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1323 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1324 | * @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] | 1325 | * |
| 1326 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1327 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1328 | * 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] | 1329 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1330 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1331 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1332 | * 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] | 1333 | * @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] | 1334 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1335 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1336 | * @return 0 on success, non-zero otherwise. |
| 1337 | */ |
| 1338 | int nc_server_config_new_ch_ssh_user_password(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1339 | const char *user_name, const char *password, struct lyd_node **config); |
| 1340 | |
| 1341 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1342 | * @brief Deletes a Call Home SSH user's password from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1343 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1344 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1345 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1346 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1347 | * @param[in,out] config Modified configuration YANG data tree. |
| 1348 | * @return 0 on success, non-zero otherwise. |
| 1349 | */ |
| 1350 | int nc_server_config_new_ch_ssh_del_user_password(const char *client_name, const char *endpt_name, |
| 1351 | const char *user_name, struct lyd_node **config); |
| 1352 | |
| 1353 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1354 | * @brief Creates new YANG configuration data nodes for a Call Home SSH user's none authentication method. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1355 | * |
| 1356 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1357 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1358 | * 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] | 1359 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1360 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1361 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1362 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1363 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1364 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1365 | * @return 0 on success, non-zero otherwise. |
| 1366 | */ |
| 1367 | int nc_server_config_new_ch_ssh_user_none(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1368 | const char *user_name, struct lyd_node **config); |
| 1369 | |
| 1370 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1371 | * @brief Deletes a Call Home SSH user's none authentication method from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1372 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1373 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1374 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1375 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1376 | * @param[in,out] config Modified configuration YANG data tree. |
| 1377 | * @return 0 on success, non-zero otherwise. |
| 1378 | */ |
| 1379 | int nc_server_config_new_ch_ssh_del_user_none(const char *client_name, const char *endpt_name, |
| 1380 | const char *user_name, struct lyd_node **config); |
| 1381 | |
| 1382 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1383 | * @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] | 1384 | * |
| 1385 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1386 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1387 | * 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] | 1388 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1389 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1390 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1391 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1392 | * @param[in] pam_config_name Name of the PAM configuration file. |
roman | 0f5fa42 | 2023-08-07 09:03:24 +0200 | [diff] [blame] | 1393 | * @param[in] pam_config_dir Optional. The absolute path to the directory in which the configuration file |
| 1394 | * with the name pam_config_name is located. A newer version (>= 1.4) of PAM library is required to be able to specify |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1395 | * the path. If NULL is passed, then the PAM's system directories will be searched (usually /etc/pam.d/). |
| 1396 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 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 | */ |
| 1400 | int nc_server_config_new_ch_ssh_user_interactive(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1401 | const char *user_name, const char *pam_config_name, const char *pam_config_dir, struct lyd_node **config); |
| 1402 | |
| 1403 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1404 | * @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] | 1405 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1406 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1407 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1408 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1409 | * @param[in,out] config Modified configuration YANG data tree. |
| 1410 | * @return 0 on success, non-zero otherwise. |
| 1411 | */ |
| 1412 | int nc_server_config_new_ch_ssh_del_user_interactive(const char *client_name, const char *endpt_name, |
| 1413 | const char *user_name, struct lyd_node **config); |
| 1414 | |
| 1415 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1416 | * @brief Deletes a Call Home SSH user from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1417 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1418 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1419 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1420 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1421 | * @param[in,out] config Modified configuration YANG data tree. |
| 1422 | * @return 0 on success, non-zero otherwise. |
| 1423 | */ |
| 1424 | int nc_server_config_new_ch_ssh_del_user(const char *client_name, const char *endpt_name, |
| 1425 | const char *user_name, struct lyd_node **config); |
| 1426 | |
| 1427 | /** |
| 1428 | * @brief Creates new YANG data nodes for a reference to a public key bag located in the truststore. |
| 1429 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1430 | * The public key's located in the bag will be used for Call Home SSH client authentication. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1431 | * |
| 1432 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1433 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1434 | * 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] | 1435 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1436 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
| 1437 | * @param[in] user_name Arbitrary identifier of the endpoint's user. |
| 1438 | * If the endpoint's user with this identifier already exists, its contents will be changed. |
| 1439 | * @param[in] truststore_reference Name of the public key bag to be referenced and used for authentication. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1440 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1441 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1442 | * @return 0 on success, non-zero otherwise. |
| 1443 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1444 | int nc_server_config_new_ch_ssh_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1445 | const char *endpt_name, const char *user_name, const char *truststore_reference, struct lyd_node **config); |
| 1446 | |
| 1447 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1448 | * @brief Deletes a Call Home SSH truststore reference from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1449 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1450 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1451 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1452 | * @param[in] user_name Identifier of an existing SSH user that belongs to the given CH endpoint. |
| 1453 | * @param[in,out] config Modified configuration YANG data tree. |
| 1454 | * @return 0 on success, non-zero otherwise. |
| 1455 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1456 | int nc_server_config_new_ch_ssh_del_truststore_ref(const char *client_name, const char *endpt_name, |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1457 | const char *user_name, struct lyd_node **config); |
| 1458 | |
| 1459 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1460 | * @brief Creates new YANG configuration data nodes for Call Home host-key algorithms replacing any previous ones. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1461 | * |
| 1462 | * Supported algorithms are: ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, |
| 1463 | * rsa-sha2-512, rsa-sha2-256, ssh-rsa and ssh-dss. |
| 1464 | * |
| 1465 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1466 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1467 | * 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] | 1468 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1469 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1470 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1471 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1472 | * @param[in] alg_count Number of following algorithms. |
| 1473 | * @param[in] ... String literals of host-key algorithms in a decreasing order of preference. |
| 1474 | * @return 0 on success, non-zero otherwise. |
| 1475 | */ |
| 1476 | int nc_server_config_new_ch_ssh_host_key_algs(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1477 | struct lyd_node **config, int alg_count, ...); |
| 1478 | |
| 1479 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1480 | * @brief Deletes a Call Home hostkey algorithm from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1481 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1482 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1483 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1484 | * @param[in] alg Optional algorithm to be deleted. |
| 1485 | * If NULL, all of the hostkey algorithms on this endpoint will be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1486 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1487 | * @return 0 on success, non-zero otherwise. |
| 1488 | */ |
| 1489 | int nc_server_config_new_ch_ssh_del_host_key_alg(const char *client_name, const char *endpt_name, |
| 1490 | const char *alg, struct lyd_node **config); |
| 1491 | |
| 1492 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1493 | * @brief Creates new YANG configuration data nodes for Call Home key exchange algorithms replacing any previous ones. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1494 | * |
| 1495 | * Supported algorithms are: diffie-hellman-group-exchange-sha1, curve25519-sha256, ecdh-sha2-nistp256, |
| 1496 | * ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group18-sha512, diffie-hellman-group16-sha512, |
| 1497 | * diffie-hellman-group-exchange-sha256 and diffie-hellman-group14-sha256. |
| 1498 | * |
| 1499 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1500 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1501 | * 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] | 1502 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1503 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1504 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1505 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1506 | * @param[in] alg_count Number of following algorithms. |
| 1507 | * @param[in] ... String literals of key exchange algorithms in a decreasing order of preference. |
| 1508 | * @return 0 on success, non-zero otherwise. |
| 1509 | */ |
| 1510 | int nc_server_config_new_ch_ssh_key_exchange_algs(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1511 | struct lyd_node **config, int alg_count, ...); |
| 1512 | |
| 1513 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1514 | * @brief Deletes a Call Home key exchange algorithm from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1515 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1516 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1517 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1518 | * @param[in] alg Optional algorithm to be deleted. |
| 1519 | * If NULL, all of the key exchange algorithms on this endpoint will be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1520 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1521 | * @return 0 on success, non-zero otherwise. |
| 1522 | */ |
| 1523 | int nc_server_config_new_ch_ssh_del_key_exchange_alg(const char *client_name, const char *endpt_name, |
| 1524 | const char *alg, struct lyd_node **config); |
| 1525 | |
| 1526 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1527 | * @brief Creates new YANG configuration data nodes for Call Home encryption algorithms replacing any previous ones. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1528 | * |
| 1529 | * Supported algorithms are: aes256-ctr, aes192-ctr, aes128-ctr, aes256-cbc, aes192-cbc, aes128-cbc, blowfish-cbc |
| 1530 | * triple-des-cbc and none. |
| 1531 | * |
| 1532 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1533 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1534 | * 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] | 1535 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1536 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1537 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1538 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1539 | * @param[in] alg_count Number of following algorithms. |
| 1540 | * @param[in] ... String literals of encryption algorithms in a decreasing order of preference. |
| 1541 | * @return 0 on success, non-zero otherwise. |
| 1542 | */ |
| 1543 | int nc_server_config_new_ch_ssh_encryption_algs(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1544 | struct lyd_node **config, int alg_count, ...); |
| 1545 | |
| 1546 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1547 | * @brief Deletes a Call Home encryption algorithm from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1548 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1549 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1550 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1551 | * @param[in] alg Optional algorithm to be deleted. |
| 1552 | * If NULL, all of the encryption algorithms on this endpoint will be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1553 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1554 | * @return 0 on success, non-zero otherwise. |
| 1555 | */ |
| 1556 | int nc_server_config_new_ch_ssh_del_encryption_alg(const char *client_name, const char *endpt_name, |
| 1557 | const char *alg, struct lyd_node **config); |
| 1558 | |
| 1559 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1560 | * @brief Creates new YANG configuration data nodes for Call Home mac algorithms replacing any previous ones. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1561 | * |
| 1562 | * Supported algorithms are: hmac-sha2-256, hmac-sha2-512 and hmac-sha1. |
| 1563 | * |
| 1564 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1565 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1566 | * 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] | 1567 | * @param[in] endpt_name Arbitrary identifier of the client's endpoint. |
| 1568 | * If the client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1569 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1570 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1571 | * @param[in] alg_count Number of following algorithms. |
| 1572 | * @param[in] ... String literals of mac algorithms in a decreasing order of preference. |
| 1573 | * @return 0 on success, non-zero otherwise. |
| 1574 | */ |
| 1575 | int nc_server_config_new_ch_ssh_mac_algs(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1576 | struct lyd_node **config, int alg_count, ...); |
| 1577 | |
| 1578 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1579 | * @brief Deletes a Call Home mac algorithm from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1580 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1581 | * @param[in] client_name Identifier of an existing Call Home client. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1582 | * @param[in] endpt_name Identifier of an existing endpoint that belongs to the given CH client. |
| 1583 | * @param[in] alg Optional algorithm to be deleted. |
| 1584 | * If NULL, all of the mac algorithms on this endpoint will be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1585 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1586 | * @return 0 on success, non-zero otherwise. |
| 1587 | */ |
| 1588 | int nc_server_config_new_ch_ssh_del_mac_alg(const char *client_name, const char *endpt_name, |
| 1589 | const char *alg, struct lyd_node **config); |
| 1590 | |
| 1591 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1592 | * @} SSH Call Home Server Configuration |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1593 | */ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1594 | |
| 1595 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1596 | * @defgroup server_config_ch_tls TLS Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1597 | * @ingroup server_config_ch |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1598 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1599 | * @brief TLS Call Home server configuration creation and deletion |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1600 | * @{ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1601 | */ |
roman | 142718b | 2023-06-29 09:15:29 +0200 | [diff] [blame] | 1602 | |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1603 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1604 | * @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] | 1605 | * |
| 1606 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1607 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1608 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1609 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1610 | * 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] | 1611 | * @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] | 1612 | * @param[in] pubkey_path Optional path to the server's public key file. If not provided, |
| 1613 | * it will be generated from the private key. |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1614 | * @param[in] certificate_path Path to the server's certificate file. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1615 | * @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] | 1616 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1617 | * @return 0 on success, non-zero otherwise. |
| 1618 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1619 | int nc_server_config_new_ch_tls_server_certificate(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | 6c4efcd | 2023-08-08 10:18:44 +0200 | [diff] [blame] | 1620 | const char *privkey_path, const char *pubkey_path, const char *certificate_path, struct lyd_node **config); |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1621 | |
| 1622 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1623 | * @brief Deletes a Call Home server certificate from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1624 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1625 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1626 | * @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] | 1627 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1628 | * @return 0 on success, non-zero otherwise. |
| 1629 | */ |
| 1630 | int nc_server_config_new_ch_tls_del_server_certificate(const char *client_name, const char *endpt_name, |
| 1631 | struct lyd_node **config); |
| 1632 | |
| 1633 | /** |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1634 | * @brief Creates new YANG configuration data nodes for a keystore reference to the Call Home TLS server's certificate. |
| 1635 | * |
| 1636 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1637 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1638 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1639 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1640 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1641 | * @param[in] asym_key_ref Name of the asymmetric key pair in the keystore to be referenced. |
| 1642 | * @param[in] cert_ref Name of the certificate, which must belong to the given asymmetric key pair, to be referenced. |
| 1643 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1644 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1645 | * @return 0 on success, non-zero otherwise. |
| 1646 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1647 | int nc_server_config_new_ch_tls_keystore_ref(const struct ly_ctx *ctx, const char *client_name, |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1648 | const char *endpt_name, const char *asym_key_ref, const char *cert_ref, struct lyd_node **config); |
| 1649 | |
| 1650 | /** |
| 1651 | * @brief Deletes a TLS server certificate keystore reference from the YANG data. |
| 1652 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1653 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1654 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1655 | * @param[in,out] config Modified configuration YANG data tree. |
| 1656 | * @return 0 on success, non-zero otherwise. |
| 1657 | */ |
roman | 67af898 | 2023-08-08 10:56:04 +0200 | [diff] [blame] | 1658 | int nc_server_config_new_ch_tls_del_keystore_ref(const char *client_name, const char *endpt_name, |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1659 | struct lyd_node **config); |
| 1660 | |
| 1661 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1662 | * @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] | 1663 | * |
| 1664 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1665 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1666 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1667 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1668 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1669 | * @param[in] cert_name Arbitrary identifier of the Call Home endpoint's end-entity certificate. |
| 1670 | * 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] | 1671 | * @param[in] cert_path Path to the certificate file. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1672 | * @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] | 1673 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1674 | * @return 0 on success, non-zero otherwise. |
| 1675 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1676 | int nc_server_config_new_ch_tls_client_certificate(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1677 | const char *cert_name, const char *cert_path, struct lyd_node **config); |
| 1678 | |
| 1679 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1680 | * @brief Deletes a Call Home client (end-entity) certificate from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1681 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1682 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1683 | * @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] | 1684 | * @param[in] cert_name Optional identifier of a client certificate to be deleted. |
| 1685 | * If NULL, all of the client certificates will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1686 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1687 | * @return 0 on success, non-zero otherwise. |
| 1688 | */ |
| 1689 | int nc_server_config_new_ch_tls_del_client_certificate(const char *client_name, const char *endpt_name, |
| 1690 | const char *cert_name, struct lyd_node **config); |
| 1691 | |
| 1692 | /** |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1693 | * @brief Creates new YANG configuration data nodes for a Call Home truststore reference to a set of client (end-entity) certificates. |
| 1694 | * |
| 1695 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1696 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1697 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1698 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1699 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1700 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 1701 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1702 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1703 | * @return 0 on success, non-zero otherwise. |
| 1704 | */ |
| 1705 | int nc_server_config_new_ch_tls_client_cert_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1706 | const char *endpt_name, const char *cert_bag_ref, struct lyd_node **config); |
| 1707 | |
| 1708 | /** |
| 1709 | * @brief Deletes a Call Home client (end-entity) certificates truststore reference from the YANG data. |
| 1710 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1711 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1712 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1713 | * @param[in,out] config Modified configuration YANG data tree. |
| 1714 | * @return 0 on success, non-zero otherwise. |
| 1715 | */ |
| 1716 | int nc_server_config_new_ch_tls_del_client_cert_truststore_ref(const char *client_name, const char *endpt_name, |
| 1717 | struct lyd_node **config); |
| 1718 | |
| 1719 | /** |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1720 | * @brief Creates new YANG configuration data nodes for a client certificate authority (trust-anchor) certificate. |
| 1721 | * |
| 1722 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1723 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1724 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1725 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1726 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
| 1727 | * @param[in] cert_name Arbitrary identifier of the Call Home endpoint's certificate authority certificate. |
| 1728 | * 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] | 1729 | * @param[in] cert_path Path to the certificate file. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1730 | * @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] | 1731 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1732 | * @return 0 on success, non-zero otherwise. |
| 1733 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1734 | int nc_server_config_new_ch_tls_client_ca(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
roman | b6f4403 | 2023-06-30 15:07:56 +0200 | [diff] [blame] | 1735 | const char *cert_name, const char *cert_path, struct lyd_node **config); |
| 1736 | |
| 1737 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1738 | * @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] | 1739 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1740 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1741 | * @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] | 1742 | * @param[in] cert_name Optional identifier of a CA certificate to be deleted. |
| 1743 | * If NULL, all of the CA certificates will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1744 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1745 | * @return 0 on success, non-zero otherwise. |
| 1746 | */ |
| 1747 | int nc_server_config_new_ch_tls_del_client_ca(const char *client_name, const char *endpt_name, |
| 1748 | const char *cert_name, struct lyd_node **config); |
| 1749 | |
| 1750 | /** |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1751 | * @brief Creates new YANG configuration data nodes for a Call Home truststore reference to a set of client certificate authority (trust-anchor) certificates. |
| 1752 | * |
| 1753 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1754 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1755 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1756 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1757 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1758 | * @param[in] cert_bag_ref Identifier of the certificate bag in the truststore to be referenced. |
| 1759 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
| 1760 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1761 | * @return 0 on success, non-zero otherwise. |
| 1762 | */ |
| 1763 | int nc_server_config_new_ch_tls_client_ca_truststore_ref(const struct ly_ctx *ctx, const char *client_name, |
| 1764 | const char *endpt_name, const char *cert_bag_ref, struct lyd_node **config); |
| 1765 | |
| 1766 | /** |
| 1767 | * @brief Deletes a Call Home client certificate authority (trust-anchor) certificates truststore reference from the YANG data. |
| 1768 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1769 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1770 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
Roytak | 934edc3 | 2023-07-27 12:04:18 +0200 | [diff] [blame] | 1771 | * @param[in,out] config Modified configuration YANG data tree. |
| 1772 | * @return 0 on success, non-zero otherwise. |
| 1773 | */ |
| 1774 | int nc_server_config_new_ch_tls_del_client_ca_truststore_ref(const char *client_name, const char *endpt_name, |
| 1775 | struct lyd_node **config); |
| 1776 | |
| 1777 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1778 | * @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] | 1779 | * |
| 1780 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1781 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1782 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1783 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1784 | * 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] | 1785 | * @param[in] id ID of the entry. The lower the ID, the higher the priority of the entry (it will be checked earlier). |
| 1786 | * @param[in] fingerprint Optional fingerprint of the entry. The fingerprint should always be set, however if it is |
| 1787 | * not set, it will match any certificate. Entry with no fingerprint should therefore be placed only as the last entry. |
| 1788 | * @param[in] map_type Mapping username to the certificate option. |
| 1789 | * @param[in] name Username for this cert-to-name entry. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1790 | * @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] | 1791 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1792 | * @return 0 on success, non-zero otherwise. |
| 1793 | */ |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1794 | int nc_server_config_new_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] | 1795 | uint32_t id, const char *fingerprint, NC_TLS_CTN_MAPTYPE map_type, const char *name, struct lyd_node **config); |
| 1796 | |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1797 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1798 | * @brief Deletes a Call Home cert-to-name entry from the YANG data. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1799 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1800 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1801 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
| 1802 | * @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] | 1803 | * If 0, all of the CTN entries will be deleted. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1804 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1805 | * @return 0 on success, non-zero otherwise. |
| 1806 | */ |
| 1807 | int nc_server_config_new_ch_tls_del_ctn(const char *client_name, const char *endpt_name, |
| 1808 | uint32_t id, struct lyd_node **config); |
| 1809 | |
| 1810 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1811 | * @brief Creates new YANG configuration data nodes for a Call Home TLS version. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1812 | * |
| 1813 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1814 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1815 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1816 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1817 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1818 | * @param[in] tls_version TLS version to be used. Call this multiple times to set the accepted versions |
| 1819 | * of the TLS protocol and let the client and server negotiate the given version. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1820 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1821 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1822 | * @return 0 on success, non-zero otherwise. |
| 1823 | */ |
| 1824 | int nc_server_config_new_ch_tls_version(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1825 | NC_TLS_VERSION tls_version, struct lyd_node **config); |
| 1826 | |
| 1827 | /** |
| 1828 | * @brief Deletes a TLS version from the YANG data. |
| 1829 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1830 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1831 | * @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] | 1832 | * @param[in] tls_version TLS version to be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1833 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1834 | * @return 0 on success, non-zero otherwise. |
| 1835 | */ |
| 1836 | int nc_server_config_new_ch_tls_del_version(const char *client_name, const char *endpt_name, |
| 1837 | NC_TLS_VERSION tls_version, struct lyd_node **config); |
| 1838 | |
| 1839 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1840 | * @brief Creates new YANG configuration data nodes for a Call Home TLS cipher. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1841 | * |
| 1842 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1843 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1844 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1845 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1846 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1847 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1848 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1849 | * @param[in] cipher_count Number of following ciphers. |
| 1850 | * @param[in] ... TLS ciphers. These ciphers MUST be in the format as listed in the |
| 1851 | * iana-tls-cipher-suite-algs YANG model (lowercase and separated by dashes). Regardless |
| 1852 | * of the TLS protocol version used, all of these ciphers will be tried and some of them |
| 1853 | * might not be set (TLS handshake might fail then). For the list of supported ciphers see |
| 1854 | * the OpenSSL documentation. |
| 1855 | * @return 0 on success, non-zero otherwise. |
| 1856 | */ |
| 1857 | int nc_server_config_new_ch_tls_ciphers(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1858 | struct lyd_node **config, int cipher_count, ...); |
| 1859 | |
| 1860 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1861 | * @brief Deletes a Call Home TLS cipher from the YANG data. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1862 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1863 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1864 | * @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] | 1865 | * @param[in] cipher TLS cipher to be deleted. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1866 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1867 | * @return 0 on success, non-zero otherwise. |
| 1868 | */ |
| 1869 | int nc_server_config_new_ch_tls_del_cipher(const char *client_name, const char *endpt_name, |
| 1870 | const char *cipher, struct lyd_node **config); |
| 1871 | |
| 1872 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1873 | * @brief Creates new YANG configuration data nodes for a Call Home Certificate Revocation List via a local file. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1874 | * |
| 1875 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 1876 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 1877 | * |
| 1878 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1879 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1880 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1881 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1882 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1883 | * @param[in] crl_path Path to a DER/PEM encoded CRL file. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1884 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1885 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1886 | * @return 0 on success, non-zero otherwise. |
| 1887 | */ |
| 1888 | int nc_server_config_new_ch_tls_crl_path(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1889 | const char *crl_path, struct lyd_node **config); |
| 1890 | |
| 1891 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1892 | * @brief Creates new YANG configuration data nodes for a Call Home Certificate Revocation List via an URL. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1893 | * |
| 1894 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 1895 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 1896 | * |
| 1897 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1898 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1899 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1900 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1901 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1902 | * @param[in] crl_url URL from which the CRL file will be downloaded. The file has to be in the DER or PEM format. |
| 1903 | * The allowed protocols are all the protocols supported by CURL. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1904 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1905 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1906 | * @return 0 on success, non-zero otherwise. |
| 1907 | */ |
| 1908 | int nc_server_config_new_ch_tls_crl_url(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1909 | const char *crl_url, struct lyd_node **config); |
| 1910 | |
| 1911 | /** |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1912 | * @brief Creates new YANG configuration data nodes for a Call Home Certificate Revocation List via certificate extensions. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1913 | * |
| 1914 | * The chain of configured Certificate Authorities will be examined. For each certificate in this chain all the |
| 1915 | * CRLs from the URLs specified in their extension fields CRL Distribution Points will be downloaded and used. |
| 1916 | * |
| 1917 | * Beware that you can choose up to one function between the three CRL alternatives on a given endpoint and calling |
| 1918 | * this function will remove any CRL YANG nodes created by the other two functions. |
| 1919 | * |
| 1920 | * @param[in] ctx libyang context. |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1921 | * @param[in] client_name Arbitrary identifier of the Call Home client. |
| 1922 | * If a Call Home client with this identifier already exists, its contents will be changed. |
| 1923 | * @param[in] endpt_name Arbitrary identifier of the Call Home client's endpoint. |
| 1924 | * If a Call Home client's endpoint with this identifier already exists, its contents will be changed. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1925 | * @param[in,out] config Configuration YANG data tree. If *config is NULL, it will be created. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1926 | * Otherwise the new YANG data will be added to the previous data and may override it. |
| 1927 | * @return 0 on success, non-zero otherwise. |
| 1928 | */ |
| 1929 | int nc_server_config_new_ch_tls_crl_cert_ext(const struct ly_ctx *ctx, const char *client_name, const char *endpt_name, |
| 1930 | struct lyd_node **config); |
| 1931 | |
| 1932 | /** |
| 1933 | * @brief Deletes all the CRL nodes from the YANG data. |
| 1934 | * |
Roytak | 2161df6 | 2023-08-02 15:04:42 +0200 | [diff] [blame] | 1935 | * @param[in] client_name Identifier of an existing Call Home client. |
| 1936 | * @param[in] endpt_name Identifier of an existing Call Home endpoint that belongs to the given client. |
Roytak | 9b32c0f | 2023-08-02 15:07:29 +0200 | [diff] [blame] | 1937 | * @param[in,out] config Modified configuration YANG data tree. |
roman | 9d5e5a5 | 2023-07-14 12:43:44 +0200 | [diff] [blame] | 1938 | * @return 0 on success, non-zero otherwise. |
| 1939 | */ |
| 1940 | int nc_server_config_new_ch_tls_del_crl(const char *client_name, const char *endpt_name, struct lyd_node **config); |
| 1941 | |
| 1942 | /** |
roman | 3512097 | 2023-08-08 10:39:12 +0200 | [diff] [blame] | 1943 | * @} TLS Call Home Server Configuration |
roman | 8ba6efa | 2023-07-12 15:27:52 +0200 | [diff] [blame] | 1944 | */ |
| 1945 | |
roman | 2eab474 | 2023-06-06 10:00:26 +0200 | [diff] [blame] | 1946 | #endif /* NC_ENABLED_SSH_TLS */ |
roman | 45cec4e | 2023-02-17 10:21:39 +0100 | [diff] [blame] | 1947 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 1948 | #ifdef __cplusplus |
| 1949 | } |
| 1950 | #endif |
| 1951 | |
| 1952 | #endif /* NC_SESSION_SERVER_H_ */ |