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