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