19#define _TRACE_PREFIX_ "ac",__LINE__, ""
30#define CONFIG_TYPE "attestation"
32#define DEFAULT_global_disable 0
34#define DEFAULT_check_tn_cert_public_url check_tn_cert_public_url_NO
35#define DEFAULT_private_key_file NULL
36#define DEFAULT_public_cert_url NULL
37#define DEFAULT_attest_level attest_level_NOT_SET
38#define DEFAULT_unknown_tn_attest_level attest_level_NOT_SET
39#define DEFAULT_send_mky send_mky_NO
118 if (!cfg_dst || !cfg_src) {
141 SCOPE_ENTER(3,
"%s: Checking common config\n",
id);
150 check_tn_cert_public_url)
154 size_t public_cert_len;
157 SCOPE_ENTER(3 ,
"%s: Checking public cert url '%s'\n",
161 &public_cert_len, &public_cert_data,
NULL);
162 if (http_code / 100 != 2) {
174 X509_free(public_cert);
189 EVP_PKEY *private_key;
199 EVP_PKEY_free(private_key);
212 "%s: Could not allocate memory for raw private key\n",
id);
237 .
title =
"Default Attestation",
243 e->
command =
"stir_shaken show attestation";
245 "Usage: stir_shaken show attestation\n"
246 " Show the stir/shaken attestation settings\n";
257 ast_log(
LOG_WARNING,
"Stir/Shaken attestation service disabled. Either there were errors in the 'attestation' object in stir_shaken.conf or it was missing altogether.\n");
278 ast_log(
LOG_WARNING,
"Stir/Shaken attestation service disabled. Either there were errors in the 'attestation' object in stir_shaken.conf or it was missing altogether.\n");
321 unknown_tn_attest_level, attest_level,);
328 ast_log(
LOG_WARNING,
"Stir/Shaken attestation service disabled. Either there were errors in the 'attestation' object in stir_shaken.conf or it was missing altogether.\n");
Asterisk main include file. File version handling, generic pbx functions.
void ast_std_free(void *ptr)
#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.
#define ao2_alloc(data_size, destructor_fn)
int as_config_unload(void)
int as_config_reload(void)
static struct ast_cli_entry attestation_cli[]
struct attestation_cfg * as_get_cfg(void)
static struct attestation_cfg * empty_cfg
static void attestation_destructor(void *obj)
int as_check_common_config(const char *id, struct attestation_cfg_common *acfg_common)
void acfg_cleanup(struct attestation_cfg_common *acfg_common)
generate_sorcery_enum_from_str_ex(attestation_cfg,, unknown_tn_attest_level, attest_level, UNKNOWN)
generate_sorcery_enum_to_str_ex(attestation_cfg,, unknown_tn_attest_level, attest_level)
#define DEFAULT_global_disable
int as_is_config_loaded(void)
generate_acfg_common_sorcery_handlers(attestation_cfg)
static void * attestation_alloc(const char *name)
static char * attestation_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int as_copy_cfg_common(const char *id, struct attestation_cfg_common *cfg_dst, struct attestation_cfg_common *cfg_src)
static int attestation_apply(const struct ast_sorcery *sorcery, void *obj)
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_attestation
#define cfg_sf_copy_wrapper(id, __cfg_dst, __cfg_src, __field)
cfg_copy_wrapper
#define register_common_attestation_fields(sorcery, object, CONFIG_TYPE, nodoc)
#define ENUM_BOOL(__enum1, __field)
#define cfg_enum_copy(__cfg_dst, __cfg_src, __field)
#define enum_option_register_ex(sorcery, CONFIG_TYPE, name, field, function_prefix, nodoc)
#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)
X509 * crypto_load_cert_from_memory(const char *buffer, size_t size)
Load an X509 Cert from a NULL terminated buffer.
EVP_PKEY * crypto_load_privkey_from_file(const char *filename)
Load a private key from a file.
int crypto_extract_raw_privkey(EVP_PKEY *key, unsigned char **buffer)
Extract raw private key from EVP_PKEY.
int crypto_is_cert_time_valid(X509 *cert, time_t reftime)
Check if the reftime is within the cert's valid dates.
int crypto_has_private_key_from_memory(const char *buffer, size_t size)
Check if the supplied buffer has a private key.
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
#define SCOPE_ENTER(level,...)
long curl_download_to_memory(const char *url, size_t *returned_length, char **returned_data, struct ast_variable **headers)
Really simple document retrieval to memory.
Support for logging to various files, console and syslog Configuration in file logger....
Asterisk file paths, configured in asterisk.conf.
static struct ast_sorcery * sorcery
Sorcery Data Access Layer API.
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.
Attestation Service configuration for stir/shaken.
enum check_tn_cert_public_url_enum check_tn_cert_public_url
const ast_string_field public_cert_url
const ast_string_field private_key_file
struct attestation_cfg_common acfg_common
enum attest_level_enum unknown_tn_attest_level
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_file_is_readable(const char *filename)
Test that a file exists and is readable by the effective user.