| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef COMMON_CONFIG_H_ |
| 20 |
#define COMMON_CONFIG_H_ |
| 21 |
|
| 22 |
#include <openssl/evp.h> |
| 23 |
|
| 24 |
#include "asterisk.h" |
| 25 |
#include "asterisk/paths.h" |
| 26 |
#include "asterisk/sorcery.h" |
| 27 |
#include "asterisk/stringfields.h" |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
#define generate_bool_string_prototypes(param_name) \ |
| 61 |
enum param_name ## _enum { \ |
| 62 |
param_name ## _UNKNOWN = -1, \ |
| 63 |
param_name ## _NO = 0, \ |
| 64 |
param_name ## _YES, \ |
| 65 |
param_name ## _NOT_SET, \ |
| 66 |
}; \ |
| 67 |
enum param_name ## _enum \ |
| 68 |
param_name ## _from_str(const char *value); \ |
| 69 |
const char *param_name ## _to_str(enum param_name ## _enum value); |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
generate_bool_string_prototypes(use_rfc9410_responses); |
| 75 |
|
| 76 |
generate_bool_string_prototypes(relax_x5u_port_scheme_restrictions); |
| 77 |
|
| 78 |
generate_bool_string_prototypes(relax_x5u_path_restrictions); |
| 79 |
|
| 80 |
generate_bool_string_prototypes(load_system_certs); |
| 81 |
|
| 82 |
generate_bool_string_prototypes(ignore_sip_date_header); |
| 83 |
|
| 84 |
generate_bool_string_prototypes(check_tn_cert_public_url); |
| 85 |
|
| 86 |
generate_bool_string_prototypes(send_mky); |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
#define generate_enum_string_prototypes(param_name, ...) \ |
| 97 |
enum param_name ## _enum { \ |
| 98 |
__VA_ARGS__ \ |
| 99 |
}; \ |
| 100 |
enum param_name ## _enum \ |
| 101 |
param_name ## _from_str(const char *value); \ |
| 102 |
const char *param_name ## _to_str(enum param_name ## _enum value); |
| 103 |
|
| 104 |
generate_enum_string_prototypes(endpoint_behavior, |
| 105 |
endpoint_behavior_UNKNOWN = -1, |
| 106 |
endpoint_behavior_OFF = 0, |
| 107 |
endpoint_behavior_ATTEST, |
| 108 |
endpoint_behavior_VERIFY, |
| 109 |
endpoint_behavior_ON, |
| 110 |
endpoint_behavior_NOT_SET |
| 111 |
); |
| 112 |
|
| 113 |
generate_enum_string_prototypes(attest_level, |
| 114 |
attest_level_UNKNOWN = -1, |
| 115 |
attest_level_NOT_SET = 0, |
| 116 |
attest_level_A, |
| 117 |
attest_level_B, |
| 118 |
attest_level_C, |
| 119 |
); |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
enum attest_level_enum unknown_tn_attest_level_from_str(const char *value); |
| 125 |
const char *unknown_tn_attest_level_to_str(enum attest_level_enum value); |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
enum stir_shaken_failure_action_enum |
| 134 |
stir_shaken_failure_action_from_str(const char *action_str); |
| 135 |
|
| 136 |
const char *stir_shaken_failure_action_to_str( |
| 137 |
enum stir_shaken_failure_action_enum action); |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
#define generate_sorcery_enum_to_str_ex(__struct, __substruct, __lc_param, __base_enum) \ |
| 148 |
static int sorcery_ ## __lc_param ## _to_str(const void *obj, const intptr_t *args, char **buf) \ |
| 149 |
{ \ |
| 150 |
const struct __struct *cfg = obj; \ |
| 151 |
*buf = ast_strdup(__base_enum ## _to_str(cfg->__substruct __lc_param)); \ |
| 152 |
return *buf ? 0 : -1; \ |
| 153 |
} |
| 154 |
|
| 155 |
#define generate_sorcery_enum_to_str(__struct, __substruct, __lc_param) \ |
| 156 |
generate_sorcery_enum_to_str_ex(__struct, __substruct, __lc_param, __lc_param) |
| 157 |
|
| 158 |
#define generate_sorcery_enum_from_str_ex(__struct, __substruct, __lc_param, __base_enum, __unknown) \ |
| 159 |
static int sorcery_ ## __lc_param ## _from_str(const struct aco_option *opt, struct ast_variable *var, void *obj) \ |
| 160 |
{ \ |
| 161 |
struct __struct *cfg = obj; \ |
| 162 |
cfg->__substruct __lc_param = __base_enum ## _from_str (var->value); \ |
| 163 |
if (cfg->__substruct __lc_param == __base_enum ## _ ## __unknown) { \ |
| 164 |
ast_log(LOG_WARNING, "Unknown value '%s' specified for %s\n", \ |
| 165 |
var->value, var->name); \ |
| 166 |
return -1; \ |
| 167 |
} \ |
| 168 |
return 0; \ |
| 169 |
} |
| 170 |
|
| 171 |
#define generate_sorcery_enum_from_str(__struct, __substruct, __lc_param, __unknown) \ |
| 172 |
generate_sorcery_enum_from_str_ex(__struct, __substruct, __lc_param, __lc_param, __unknown) \ |
| 173 |
|
| 174 |
|
| 175 |
#define generate_sorcery_acl_to_str(__struct, __lc_param) \ |
| 176 |
static int sorcery_acl_to_str(const void *obj, const intptr_t *args, char **buf) \ |
| 177 |
{ \ |
| 178 |
const struct __struct *cfg = obj; \ |
| 179 |
struct ast_acl *first_acl; \ |
| 180 |
if (!ast_acl_list_is_empty(cfg->vcfg_common.acl)) { \ |
| 181 |
AST_LIST_LOCK(cfg->vcfg_common.acl); \ |
| 182 |
first_acl = AST_LIST_FIRST(cfg->vcfg_common.acl); \ |
| 183 |
if (ast_strlen_zero(first_acl->name)) { \ |
| 184 |
*buf = "deny/permit"; \ |
| 185 |
} else { \ |
| 186 |
*buf = first_acl->name; \ |
| 187 |
} \ |
| 188 |
AST_LIST_UNLOCK(cfg->vcfg_common.acl); \ |
| 189 |
} \ |
| 190 |
*buf = ast_strdup(*buf); \ |
| 191 |
return 0; \ |
| 192 |
} |
| 193 |
|
| 194 |
#define generate_sorcery_acl_from_str(__struct, __lc_param, __unknown) \ |
| 195 |
static int sorcery_acl_from_str(const struct aco_option *opt, struct ast_variable *var, void *obj) \ |
| 196 |
{ \ |
| 197 |
struct __struct *cfg = obj; \ |
| 198 |
int error = 0; \ |
| 199 |
int ignore; \ |
| 200 |
const char *name = var->name + strlen("x5u_"); \ |
| 201 |
if (ast_strlen_zero(var->value)) { \ |
| 202 |
return 0; \ |
| 203 |
} \ |
| 204 |
ast_append_acl(name, var->value, &cfg->vcfg_common.acl, &error, &ignore); \ |
| 205 |
return error; \ |
| 206 |
} |
| 207 |
|
| 208 |
struct ast_acl_list *get_default_acl_list(void); |
| 209 |
|
| 210 |
#define EFFECTIVE_ENUM(__enum1, __enum2, __field, __default) \ |
| 211 |
( __enum1 != ( __field ## _ ## NOT_SET ) ? __enum1 : \ |
| 212 |
(__enum2 != __field ## _ ## NOT_SET ? \ |
| 213 |
__enum2 : __default )) |
| 214 |
|
| 215 |
#define EFFECTIVE_ENUM_BOOL(__enum1, __enum2, __field, __default) \ |
| 216 |
(( __enum1 != ( __field ## _ ## NOT_SET ) ? __enum1 : \ |
| 217 |
(__enum2 != __field ## _ ## NOT_SET ? \ |
| 218 |
__enum2 : __field ## _ ## __default )) == __field ## _ ## YES) |
| 219 |
|
| 220 |
#define ENUM_BOOL(__enum1, __field) \ |
| 221 |
(__enum1 == ( __field ## _ ## YES )) |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
#define cfg_stringfield_copy(__cfg_dst, __cfg_src, __field) \ |
| 234 |
({ \ |
| 235 |
int __res = 0; \ |
| 236 |
if (!ast_strlen_zero(__cfg_src->__field)) { \ |
| 237 |
__res = ast_string_field_set(__cfg_dst, __field, __cfg_src->__field); \ |
| 238 |
} \ |
| 239 |
__res; \ |
| 240 |
}) |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
#define cfg_sf_copy_wrapper(id, __cfg_dst, __cfg_src, __field) \ |
| 249 |
{ \ |
| 250 |
int rc = cfg_stringfield_copy(__cfg_dst, __cfg_src, __field); \ |
| 251 |
if (rc != 0) { \ |
| 252 |
ast_log(LOG_ERROR, "%s: Unable to copy field %s from %s to %s\n", \ |
| 253 |
id, #__field, #__cfg_src, #__cfg_dst); \ |
| 254 |
return -1; \ |
| 255 |
} \ |
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
#define cfg_uint_copy(__cfg_dst, __cfg_src, __field) \ |
| 265 |
({ \ |
| 266 |
if (__cfg_src->__field > 0) { \ |
| 267 |
__cfg_dst->__field = __cfg_src->__field; \ |
| 268 |
} \ |
| 269 |
}) |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
#define cfg_enum_copy_ex(__cfg_dst, __cfg_src, __field, __not_set, __unknown) \ |
| 278 |
({ \ |
| 279 |
if (__cfg_src->__field != __not_set \ |
| 280 |
&& __cfg_src->__field != __unknown) { \ |
| 281 |
__cfg_dst->__field = __cfg_src->__field; \ |
| 282 |
} \ |
| 283 |
}) |
| 284 |
|
| 285 |
#define cfg_enum_copy(__cfg_dst, __cfg_src, __field) \ |
| 286 |
cfg_enum_copy_ex(__cfg_dst, __cfg_src, __field, __field ## _NOT_SET, __field ## _UNKNOWN) |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
struct attestation_cfg_common { |
| 295 |
AST_DECLARE_STRING_FIELDS( |
| 296 |
AST_STRING_FIELD(private_key_file); |
| 297 |
AST_STRING_FIELD(public_cert_url); |
| 298 |
); |
| 299 |
enum attest_level_enum attest_level; |
| 300 |
enum check_tn_cert_public_url_enum check_tn_cert_public_url; |
| 301 |
enum send_mky_enum send_mky; |
| 302 |
unsigned char *raw_key; |
| 303 |
size_t raw_key_length; |
| 304 |
}; |
| 305 |
|
| 306 |
#define generate_acfg_common_sorcery_handlers(object) \ |
| 307 |
generate_sorcery_enum_from_str(object, acfg_common., check_tn_cert_public_url, UNKNOWN); \ |
| 308 |
generate_sorcery_enum_to_str(object, acfg_common., check_tn_cert_public_url); \ |
| 309 |
generate_sorcery_enum_from_str(object, acfg_common., send_mky, UNKNOWN); \ |
| 310 |
generate_sorcery_enum_to_str(object, acfg_common., send_mky); \ |
| 311 |
generate_sorcery_enum_from_str(object, acfg_common., attest_level, UNKNOWN); \ |
| 312 |
generate_sorcery_enum_to_str(object, acfg_common., attest_level); |
| 313 |
|
| 314 |
int as_check_common_config(const char *id, |
| 315 |
struct attestation_cfg_common *acfg_common); |
| 316 |
|
| 317 |
int as_copy_cfg_common(const char *id, struct attestation_cfg_common *cfg_dst, |
| 318 |
struct attestation_cfg_common *cfg_src); |
| 319 |
|
| 320 |
void acfg_cleanup(struct attestation_cfg_common *cfg); |
| 321 |
|
| 322 |
struct attestation_cfg { |
| 323 |
SORCERY_OBJECT(details); |
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
AST_DECLARE_STRING_FIELDS(); |
| 331 |
struct attestation_cfg_common acfg_common; |
| 332 |
enum attest_level_enum unknown_tn_attest_level; |
| 333 |
int global_disable; |
| 334 |
}; |
| 335 |
|
| 336 |
struct attestation_cfg *as_get_cfg(void); |
| 337 |
int as_is_config_loaded(void); |
| 338 |
int as_config_load(void); |
| 339 |
int as_config_reload(void); |
| 340 |
int as_config_unload(void); |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
struct verification_cfg_common { |
| 348 |
AST_DECLARE_STRING_FIELDS( |
| 349 |
AST_STRING_FIELD(ca_file); |
| 350 |
AST_STRING_FIELD(ca_path); |
| 351 |
AST_STRING_FIELD(crl_file); |
| 352 |
AST_STRING_FIELD(crl_path); |
| 353 |
AST_STRING_FIELD(untrusted_cert_file); |
| 354 |
AST_STRING_FIELD(untrusted_cert_path); |
| 355 |
AST_STRING_FIELD(cert_cache_dir); |
| 356 |
); |
| 357 |
unsigned int curl_timeout; |
| 358 |
unsigned int max_iat_age; |
| 359 |
unsigned int max_date_header_age; |
| 360 |
unsigned int max_cache_entry_age; |
| 361 |
unsigned int max_cache_size; |
| 362 |
enum stir_shaken_failure_action_enum |
| 363 |
stir_shaken_failure_action; |
| 364 |
enum use_rfc9410_responses_enum use_rfc9410_responses; |
| 365 |
enum relax_x5u_port_scheme_restrictions_enum |
| 366 |
relax_x5u_port_scheme_restrictions; |
| 367 |
enum relax_x5u_path_restrictions_enum |
| 368 |
relax_x5u_path_restrictions; |
| 369 |
enum load_system_certs_enum load_system_certs; |
| 370 |
enum ignore_sip_date_header_enum ignore_sip_date_header; |
| 371 |
struct ast_acl_list *acl; |
| 372 |
struct crypto_cert_store *tcs; |
| 373 |
}; |
| 374 |
|
| 375 |
#define generate_vcfg_common_sorcery_handlers(object) \ |
| 376 |
generate_sorcery_enum_from_str(object, vcfg_common.,use_rfc9410_responses, UNKNOWN); \ |
| 377 |
generate_sorcery_enum_to_str(object, vcfg_common.,use_rfc9410_responses); \ |
| 378 |
generate_sorcery_enum_from_str(object, vcfg_common.,stir_shaken_failure_action, UNKNOWN); \ |
| 379 |
generate_sorcery_enum_to_str(object, vcfg_common.,stir_shaken_failure_action); \ |
| 380 |
generate_sorcery_enum_from_str(object, vcfg_common.,relax_x5u_port_scheme_restrictions, UNKNOWN); \ |
| 381 |
generate_sorcery_enum_to_str(object, vcfg_common.,relax_x5u_port_scheme_restrictions); \ |
| 382 |
generate_sorcery_enum_from_str(object, vcfg_common.,relax_x5u_path_restrictions, UNKNOWN); \ |
| 383 |
generate_sorcery_enum_to_str(object, vcfg_common.,relax_x5u_path_restrictions); \ |
| 384 |
generate_sorcery_enum_from_str(object, vcfg_common.,load_system_certs, UNKNOWN); \ |
| 385 |
generate_sorcery_enum_to_str(object, vcfg_common.,load_system_certs); \ |
| 386 |
generate_sorcery_enum_from_str(object, vcfg_common.,ignore_sip_date_header, UNKNOWN); \ |
| 387 |
generate_sorcery_enum_to_str(object, vcfg_common.,ignore_sip_date_header); \ |
| 388 |
generate_sorcery_acl_from_str(object, acl, NULL); \ |
| 389 |
generate_sorcery_acl_to_str(object, acl); |
| 390 |
|
| 391 |
int vs_check_common_config(const char *id, |
| 392 |
struct verification_cfg_common *vcfg_common); |
| 393 |
|
| 394 |
int vs_copy_cfg_common(const char *id, struct verification_cfg_common *cfg_dst, |
| 395 |
struct verification_cfg_common *cfg_src); |
| 396 |
|
| 397 |
void vcfg_cleanup(struct verification_cfg_common *cfg); |
| 398 |
|
| 399 |
struct verification_cfg { |
| 400 |
SORCERY_OBJECT(details); |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
AST_DECLARE_STRING_FIELDS(); |
| 408 |
struct verification_cfg_common vcfg_common; |
| 409 |
int global_disable; |
| 410 |
}; |
| 411 |
|
| 412 |
struct verification_cfg *vs_get_cfg(void); |
| 413 |
int vs_is_config_loaded(void); |
| 414 |
int vs_config_load(void); |
| 415 |
int vs_config_reload(void); |
| 416 |
int vs_config_unload(void); |
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
struct profile_cfg { |
| 422 |
SORCERY_OBJECT(details); |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
AST_DECLARE_STRING_FIELDS(); |
| 430 |
struct attestation_cfg_common acfg_common; |
| 431 |
struct verification_cfg_common vcfg_common; |
| 432 |
enum endpoint_behavior_enum endpoint_behavior; |
| 433 |
enum attest_level_enum unknown_tn_attest_level; |
| 434 |
struct profile_cfg *eprofile; |
| 435 |
}; |
| 436 |
|
| 437 |
struct profile_cfg *profile_get_cfg(const char *id); |
| 438 |
struct ao2_container *profile_get_all(void); |
| 439 |
struct profile_cfg *eprofile_get_cfg(const char *id); |
| 440 |
struct ao2_container *eprofile_get_all(void); |
| 441 |
int profile_load(void); |
| 442 |
int profile_reload(void); |
| 443 |
int profile_unload(void); |
| 444 |
|
| 445 |
#define PROFILE_ALLOW_ATTEST(__profile) \ |
| 446 |
(__profile->endpoint_behavior == endpoint_behavior_ON || \ |
| 447 |
__profile->endpoint_behavior == endpoint_behavior_ATTEST) |
| 448 |
|
| 449 |
#define PROFILE_ALLOW_VERIFY(__profile) \ |
| 450 |
(__profile->endpoint_behavior == endpoint_behavior_ON || \ |
| 451 |
__profile->endpoint_behavior == endpoint_behavior_VERIFY) |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
struct tn_cfg { |
| 460 |
SORCERY_OBJECT(details); |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
AST_DECLARE_STRING_FIELDS(); |
| 468 |
struct attestation_cfg_common acfg_common; |
| 469 |
}; |
| 470 |
|
| 471 |
struct tn_cfg *tn_get_cfg(const char *tn); |
| 472 |
struct tn_cfg *tn_get_etn(const char *tn, |
| 473 |
struct profile_cfg *eprofile); |
| 474 |
int tn_config_load(void); |
| 475 |
int tn_config_reload(void); |
| 476 |
int tn_config_unload(void); |
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
#define stringfield_option_register(sorcery, CONFIG_TYPE, object, name, field, nodoc) \ |
| 499 |
ast_sorcery_object_field_register ## nodoc(sorcery, CONFIG_TYPE, #name, \ |
| 500 |
DEFAULT_ ## name, OPT_STRINGFIELD_T, 0, \ |
| 501 |
STRFLDSET(struct object, field)) |
| 502 |
|
| 503 |
#define uint_option_register(sorcery, CONFIG_TYPE, object, name, field, nodoc) \ |
| 504 |
ast_sorcery_object_field_register ## nodoc(sorcery, CONFIG_TYPE, #name, \ |
| 505 |
__stringify(DEFAULT_ ## name), OPT_UINT_T, 0, \ |
| 506 |
FLDSET(struct object, field)) |
| 507 |
|
| 508 |
#define enum_option_register_ex(sorcery, CONFIG_TYPE, name, field, function_prefix, nodoc) \ |
| 509 |
ast_sorcery_object_field_register_custom ## nodoc(sorcery, CONFIG_TYPE, \ |
| 510 |
#name, function_prefix ## _to_str(DEFAULT_ ## field), \ |
| 511 |
sorcery_ ## field ## _from_str, sorcery_ ## field ## _to_str, NULL, 0, 0) |
| 512 |
|
| 513 |
#define enum_option_register(sorcery, CONFIG_TYPE, name, nodoc) \ |
| 514 |
enum_option_register_ex(sorcery, CONFIG_TYPE, name, name, name, nodoc) |
| 515 |
|
| 516 |
#define register_common_verification_fields(sorcery, object, CONFIG_TYPE, nodoc) \ |
| 517 |
({ \ |
| 518 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, ca_file, vcfg_common.ca_file, nodoc); \ |
| 519 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, ca_path, vcfg_common.ca_path, nodoc); \ |
| 520 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, crl_file, vcfg_common.crl_file, nodoc); \ |
| 521 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, crl_path, vcfg_common.crl_path, nodoc); \ |
| 522 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, untrusted_cert_file, vcfg_common.untrusted_cert_file, nodoc); \ |
| 523 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, untrusted_cert_path, vcfg_common.untrusted_cert_path, nodoc); \ |
| 524 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, cert_cache_dir, vcfg_common.cert_cache_dir, nodoc); \ |
| 525 |
\ |
| 526 |
uint_option_register(sorcery, CONFIG_TYPE, object, curl_timeout, vcfg_common.curl_timeout, nodoc);\ |
| 527 |
uint_option_register(sorcery, CONFIG_TYPE, object, max_iat_age, vcfg_common.max_iat_age, nodoc);\ |
| 528 |
uint_option_register(sorcery, CONFIG_TYPE, object, max_date_header_age, vcfg_common.max_date_header_age, nodoc);\ |
| 529 |
uint_option_register(sorcery, CONFIG_TYPE, object, max_cache_entry_age, vcfg_common.max_cache_entry_age, nodoc);\ |
| 530 |
uint_option_register(sorcery, CONFIG_TYPE, object, max_cache_size, vcfg_common.max_cache_size, nodoc);\ |
| 531 |
\ |
| 532 |
enum_option_register_ex(sorcery, CONFIG_TYPE, failure_action, stir_shaken_failure_action, stir_shaken_failure_action, nodoc); \ |
| 533 |
enum_option_register(sorcery, CONFIG_TYPE, use_rfc9410_responses, nodoc); \ |
| 534 |
enum_option_register(sorcery, CONFIG_TYPE, \ |
| 535 |
relax_x5u_port_scheme_restrictions, nodoc); \ |
| 536 |
enum_option_register(sorcery, CONFIG_TYPE, \ |
| 537 |
relax_x5u_path_restrictions, nodoc); \ |
| 538 |
enum_option_register(sorcery, CONFIG_TYPE, \ |
| 539 |
load_system_certs, nodoc); \ |
| 540 |
enum_option_register(sorcery, CONFIG_TYPE, ignore_sip_date_header, nodoc); \ |
| 541 |
\ |
| 542 |
ast_sorcery_object_field_register_custom ## nodoc(sorcery, CONFIG_TYPE, "x5u_deny", "", sorcery_acl_from_str, NULL, NULL, 0, 0); \ |
| 543 |
ast_sorcery_object_field_register_custom ## nodoc(sorcery, CONFIG_TYPE, "x5u_permit", "", sorcery_acl_from_str, NULL, NULL, 0, 0); \ |
| 544 |
ast_sorcery_object_field_register_custom ## nodoc(sorcery, CONFIG_TYPE, "x5u_acl", "", sorcery_acl_from_str, sorcery_acl_to_str, NULL, 0, 0); \ |
| 545 |
}) |
| 546 |
|
| 547 |
#define register_common_attestation_fields(sorcery, object, CONFIG_TYPE, nodoc) \ |
| 548 |
({ \ |
| 549 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, private_key_file, acfg_common.private_key_file, nodoc); \ |
| 550 |
stringfield_option_register(sorcery, CONFIG_TYPE, object, public_cert_url, acfg_common.public_cert_url, nodoc); \ |
| 551 |
enum_option_register(sorcery, CONFIG_TYPE, attest_level, nodoc); \ |
| 552 |
enum_option_register(sorcery, CONFIG_TYPE, check_tn_cert_public_url, nodoc); \ |
| 553 |
enum_option_register(sorcery, CONFIG_TYPE, send_mky, nodoc); \ |
| 554 |
}) |
| 555 |
|
| 556 |
int common_config_load(void); |
| 557 |
int common_config_unload(void); |
| 558 |
int common_config_reload(void); |
| 559 |
|
| 560 |
enum config_object_type { |
| 561 |
config_object_type_attestation = 0, |
| 562 |
config_object_type_verification, |
| 563 |
config_object_type_profile, |
| 564 |
config_object_type_tn, |
| 565 |
}; |
| 566 |
|
| 567 |
struct config_object_cli_data { |
| 568 |
const char *title; |
| 569 |
enum config_object_type object_type; |
| 570 |
}; |
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
int config_object_cli_show(void *obj, void *arg, void *data, int flags); |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
char *config_object_tab_complete_name(const char *word, struct ao2_container *container); |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
char *canonicalize_tn(const char *tn, char *dest_tn); |
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
char *canonicalize_tn_alloc(const char *tn); |
| 611 |
|
| 612 |
#endif |