26#define _TRACE_PREFIX_ "rss",__LINE__, ""
85 .
type =
"STIR/SHAKEN VERIFICATION",
94 const char *chan_name;
104 ast_log(
LOG_ERROR,
"No identity to add STIR/SHAKEN verification to channel "
110 ast_log(
LOG_ERROR,
"Attestation cannot be NULL to add STIR/SHAKEN verification to "
111 "channel %s\n", chan_name);
117 ast_log(
LOG_ERROR,
"Failed to allocate space for STIR/SHAKEN datastore for "
118 "channel %s\n", chan_name);
125 "identity for channel %s\n", chan_name);
133 "attestation for channel %s\n", chan_name);
141 if (!chan_datastore) {
177 unsigned int target_index, current_index = 0;
206 if (!strcasecmp(
first,
"count")) {
223 snprintf(
buf,
len,
"%zu", count);
231 ast_log(
LOG_ERROR,
"Retrieving a value using %s requires two paramaters (index, value) "
232 "- only index was given\n", function);
237 ast_log(
LOG_ERROR,
"Failed to convert index %s to integer for function %s\n",
249 if (current_index == target_index) {
256 if (current_index != target_index || !chan_datastore) {
262 if (!strcasecmp(second,
"identity")) {
264 }
else if (!strcasecmp(second,
"attestation")) {
266 }
else if (!strcasecmp(second,
"verify_result")) {
277 .
name =
"STIR_SHAKEN",
298#define TN_AUTH_LIST_OID "1.3.6.1.5.5.7.1.26"
299#define TN_AUTH_LIST_SHORT "TNAuthList"
300#define TN_AUTH_LIST_LONG "TNAuthorizationList"
304 const char *error_msg =
"There appears to be a 'stir_shaken.conf' file"
305 " with old configuration options in it. Please see the new config"
306 " file format in the configs/samples/stir_shaken.conf.sample file"
307 " in the source tree at https://github.com/asterisk/asterisk/raw/master/configs/samples/stir_shaken.conf.sample"
308 " or visit https://docs.asterisk.org/Deployment/STIR-SHAKEN for more information.";
332 if (strcasecmp(cat,
"general") == 0) {
337 if (
val && (strcasecmp(
val,
"store") == 0 ||
338 strcasecmp(
val,
"certificate") == 0)) {
389 .
requires =
"res_curl",
struct sla_ringing_trunk * first
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_channel_lock(chan)
struct ast_datastore_list * ast_channel_datastores(struct ast_channel *chan)
#define ast_channel_unlock(chan)
Standard Command Line Interface.
int common_config_unload(void)
int common_config_reload(void)
int common_config_load(void)
Conversion utility functions.
int ast_str_to_uint(const char *str, unsigned int *res)
Convert the given string to an unsigned integer.
int crypto_register_x509_extension(const char *oid, const char *short_name, const char *long_name)
Register a certificate extension to openssl.
int crypto_unload(void)
Clean up the crypto utils.
#define ast_datastore_alloc(info, uid)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
globally accessible channel datastores
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define CONFIG_STATUS_FILEMISSING
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DEPEND
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Core PBX routines and definitions.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static void crypto_load(int ifd, int ofd)
refresh RSA keys from file
#define TN_AUTH_LIST_SHORT
int ast_stir_shaken_add_result_to_channel(struct ast_stir_shaken_vs_ctx *ctx)
Add a STIR/SHAKEN verification result to a channel.
static const struct ast_datastore_info stir_shaken_datastore_info
static void stir_datastore_destroy_cb(void *data)
The callback to destroy a stir_shaken_datastore.
#define TN_AUTH_LIST_LONG
static void stir_datastore_free(struct stir_datastore *datastore)
Frees a stir_shaken_datastore structure.
static struct ast_custom_function stir_shaken_function
static int func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Retrieves STIR/SHAKEN verification information for the channel via dialplan. Examples:
static int reload_module(void)
static int check_for_old_config(void)
static int tn_auth_list_nid
static int load_module(void)
static int unload_module(void)
int get_tn_auth_nid(void)
Retrieves the OpenSSL NID for the TN Auth list extension.
ast_stir_shaken_vs_response_code
const char * vs_response_code_to_str(enum ast_stir_shaken_vs_response_code vs_rc)
Return string version of VS response code.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
const struct ast_datastore_info * info
Structure used to handle boolean flags.
const ast_string_field attestation
const ast_string_field identity_hdr
struct ast_channel * chan
enum ast_stir_shaken_vs_response_code failure_reason
enum ast_stir_shaken_vs_response_code verify_result
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.