19#define _TRACE_PREFIX_ "vc",__LINE__, ""
27#define CONFIG_TYPE "verification"
29#define DEFAULT_global_disable 0
31#define DEFAULT_ca_file NULL
32#define DEFAULT_ca_path NULL
33#define DEFAULT_crl_file NULL
34#define DEFAULT_crl_path NULL
35#define DEFAULT_untrusted_cert_file NULL
36#define DEFAULT_untrusted_cert_path NULL
39#define DEFAULT_curl_timeout 2
40#define DEFAULT_max_iat_age 15
41#define DEFAULT_max_date_header_age 15
42#define DEFAULT_max_cache_entry_age 3600
43#define DEFAULT_max_cache_size 1000
44#define DEFAULT_stir_shaken_failure_action stir_shaken_failure_action_CONTINUE
45#define DEFAULT_use_rfc9410_responses use_rfc9410_responses_NO
46#define DEFAULT_relax_x5u_port_scheme_restrictions relax_x5u_port_scheme_restrictions_NO
47#define DEFAULT_relax_x5u_path_restrictions relax_x5u_path_restrictions_NO
48#define DEFAULT_load_system_certs load_system_certs_NO
52#define STIR_SHAKEN_DIR_NAME "stir_shaken"
128 if (!cfg_dst || !cfg_src) {
132 if (!cfg_dst->
tcs && cfg_src->
tcs) {
140 cfg_dst->
tcs = cfg_src->
tcs;
153 cfg_enum_copy(cfg_dst, cfg_src, relax_x5u_port_scheme_restrictions);
154 cfg_enum_copy(cfg_dst, cfg_src, relax_x5u_path_restrictions);
168 SCOPE_ENTER(3,
"%s: Checking common config\n",
id);
173 "%s: ca_file '%s' not found, or is unreadable\n",
180 "%s: ca_path '%s' not found, or is unreadable\n",
187 "%s: crl_file '%s' not found, or is unreadable\n",
194 "%s: crl_path '%s' not found, or is unreadable\n",
201 "%s: untrusted_cert_file '%s' not found, or is unreadable\n",
208 "%s: untrusted_cert_path '%s' not found, or is unreadable\n",
220 "%s: Unable to create CA cert store\n",
id);
227 "%s: Unable to load CA cert store from '%s' or '%s'\n",
240 "%s: Unable to create CA cert store\n",
id);
247 "%s: Unable to load CA CRL store from '%s' or '%s'\n",
260 "%s: Unable to create CA cert store\n",
id);
267 "%s: Unable to load CA CRL store from '%s' or '%s'\n",
279 X509_STORE_set_flags(
vcfg_common->
tcs->
certs, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_EXTENDED_CRL_SUPPORT);
289 "%s: Unable to allocate memory for testfile\n",
id);
292 fp = fopen(testfile,
"w+");
296 "%s: cert_cache_dir '%s' was not writable\n",
322 "255.255.255.255/32",
357 id,
"permit",
"0.0.0.0/0");
380 .
title =
"Default Verification",
386 e->
command =
"stir_shaken show verification";
388 "Usage: stir_shaken show verification\n"
389 " Show the stir/shaken verification settings\n";
400 ast_log(
LOG_WARNING,
"Stir/Shaken verification service disabled. Either there were errors in the 'verification' object in stir_shaken.conf or it was missing altogether.\n");
422 ast_log(
LOG_WARNING,
"Stir/Shaken verification service disabled. Either there were errors in the 'verification' object in stir_shaken.conf or it was missing altogether.\n");
472 ast_log(
LOG_WARNING,
"Stir/Shaken verification service disabled. Either there were errors in the 'verification' object in stir_shaken.conf or it was missing altogether.\n");
void ast_append_acl(const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag)
Add a rule to an ACL struct.
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
struct ast_acl_list * ast_duplicate_acl_list(struct ast_acl_list *original)
Duplicates the contests of a list of lists of host access rules.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
int config_object_cli_show(void *obj, void *arg, void *data, int flags)
Output configuration settings to the Asterisk CLI.
struct ast_sorcery * get_sorcery(void)
Retrieve the stir/shaken sorcery context.
@ config_object_type_verification
#define cfg_uint_copy(__cfg_dst, __cfg_src, __field)
cfg_uint_copy
#define cfg_sf_copy_wrapper(id, __cfg_dst, __cfg_src, __field)
cfg_copy_wrapper
#define register_common_verification_fields(sorcery, object, CONFIG_TYPE, nodoc)
#define ENUM_BOOL(__enum1, __field)
#define cfg_enum_copy(__cfg_dst, __cfg_src, __field)
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_YESNO_T
Type for default option handler for bools (ast_true/ast_false)
int crypto_load_crl_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with certificate revocation lists.
int crypto_load_untrusted_cert_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with untrusted certificates.
struct crypto_cert_store * crypto_create_cert_store(void)
Create an empty X509 store.
int crypto_load_cert_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with either certificates or CRLs.
#define crypto_free_cert_store(store)
Free an X509 store.
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
#define SCOPE_ENTER(level,...)
Support for logging to various files, console and syslog Configuration in file logger....
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
const char * ast_config_AST_DATA_DIR
static struct ast_sorcery * sorcery
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
#define ast_sorcery_object_field_register_nodoc(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object without documentation.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
void ast_sorcery_load_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to load persistent objects.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
void ast_sorcery_force_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects even if no changes determin...
#define ast_sorcery_apply_default(sorcery, type, name, data)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
static force_inline int attribute_pure ast_strlen_zero(const char *s)
descriptor for a cli entry.
Full structure for sorcery.
Verification Service configuration for stir/shaken.
struct crypto_cert_store * tcs
const ast_string_field cert_cache_dir
const ast_string_field ca_path
const ast_string_field crl_file
const ast_string_field crl_path
enum load_system_certs_enum load_system_certs
const ast_string_field ca_file
const ast_string_field untrusted_cert_file
struct ast_acl_list * acl
const ast_string_field untrusted_cert_path
struct verification_cfg_common vcfg_common
int error(const char *format,...)
int ast_file_is_readable(const char *filename)
Test that a file exists and is readable by the effective user.
static int verification_apply(const struct ast_sorcery *sorcery, void *obj)
void vcfg_cleanup(struct verification_cfg_common *vcfg_common)
int vs_config_reload(void)
static struct ast_cli_entry verification_cli[]
generate_vcfg_common_sorcery_handlers(verification_cfg)
int vs_is_config_loaded(void)
static void verification_destructor(void *obj)
#define STIR_SHAKEN_DIR_NAME
static char * cli_verification_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct verification_cfg * vs_get_cfg(void)
static void * verification_alloc(const char *name)
int vs_copy_cfg_common(const char *id, struct verification_cfg_common *cfg_dst, struct verification_cfg_common *cfg_src)
static char DEFAULT_cert_cache_dir[PATH_MAX]
#define DEFAULT_global_disable
static struct verification_cfg * empty_cfg
int vs_config_unload(void)
int vs_check_common_config(const char *id, struct verification_cfg_common *vcfg_common)
static char * special_addresses[]