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