|
Packit Service |
384592 |
/*
|
|
Packit Service |
384592 |
* ModSecurity for Apache 2.x, http://www.modsecurity.org/
|
|
Packit Service |
384592 |
* Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* You may not use this file except in compliance with
|
|
Packit Service |
384592 |
* the License. You may obtain a copy of the License at
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* If any of the files related to licensing are missing or if you have any
|
|
Packit Service |
384592 |
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
|
Packit Service |
384592 |
* directly using the email address security@modsecurity.org.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#include "re.h"
|
|
Packit Service |
384592 |
#include <ctype.h>
|
|
Packit Service |
384592 |
#include "apr_lib.h"
|
|
Packit Service |
384592 |
#include "apr_strmatch.h"
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
* Register action with the engine.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
static void msre_engine_action_register(msre_engine *engine, const char *name,
|
|
Packit Service |
384592 |
unsigned int type, unsigned int argc_min, unsigned int argc_max,
|
|
Packit Service |
384592 |
unsigned int allow_param_plusminus, unsigned int cardinality,
|
|
Packit Service |
384592 |
unsigned int cardinality_group, fn_action_validate_t validate,
|
|
Packit Service |
384592 |
fn_action_init_t init, fn_action_execute_t execute)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msre_action_metadata *metadata = (msre_action_metadata *)apr_pcalloc(engine->mp,
|
|
Packit Service |
384592 |
sizeof(msre_action_metadata));
|
|
Packit Service |
384592 |
if (metadata == NULL) return;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
metadata->name = name;
|
|
Packit Service |
384592 |
metadata->type = type;
|
|
Packit Service |
384592 |
metadata->argc_min = argc_min;
|
|
Packit Service |
384592 |
metadata->argc_max = argc_max;
|
|
Packit Service |
384592 |
metadata->allow_param_plusminus = allow_param_plusminus;
|
|
Packit Service |
384592 |
metadata->cardinality = cardinality;
|
|
Packit Service |
384592 |
metadata->cardinality_group = cardinality_group;
|
|
Packit Service |
384592 |
metadata->validate = validate;
|
|
Packit Service |
384592 |
metadata->init = init;
|
|
Packit Service |
384592 |
metadata->execute = execute;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_setn(engine->actions, name, (void *)metadata);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
* Generates a single variable (from the supplied metadata).
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
msre_var *generate_single_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr,
|
|
Packit Service |
384592 |
msre_rule *rule, apr_pool_t *mptmp)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
apr_table_t *vartab = NULL;
|
|
Packit Service |
384592 |
const apr_table_entry_t *te = NULL;
|
|
Packit Service |
384592 |
const apr_array_header_t *arr = NULL;
|
|
Packit Service |
384592 |
msre_var *rvar = NULL;
|
|
Packit Service |
384592 |
int i;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Sanity check. */
|
|
Packit Service |
384592 |
if ((var == NULL)||(var->metadata == NULL)||(var->metadata->generate == NULL)) return NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
vartab = apr_table_make(mptmp, 16);
|
|
Packit Service |
384592 |
var->metadata->generate(msr, var, rule, vartab, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
arr = apr_table_elts(vartab);
|
|
Packit Service |
384592 |
if (arr->nelts == 0) return NULL;
|
|
Packit Service |
384592 |
te = (apr_table_entry_t *)arr->elts;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rvar = (msre_var *)te[0].val;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Return straight away if there were no
|
|
Packit Service |
384592 |
* transformation functions supplied.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
if ((tfn_arr == NULL)||(tfn_arr->nelts == 0)) {
|
|
Packit Service |
384592 |
return rvar;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Copy the value so that we can transform it in place. */
|
|
Packit Service |
384592 |
rvar->value = apr_pstrndup(mptmp, rvar->value, rvar->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Transform rvar in a loop. */
|
|
Packit Service |
384592 |
for (i = 0; i < tfn_arr->nelts; i++) {
|
|
Packit Service |
384592 |
msre_tfn_metadata *tfn = ((msre_tfn_metadata **)tfn_arr->elts)[i];
|
|
Packit Service |
384592 |
char *rval;
|
|
Packit Service |
384592 |
int rc;
|
|
Packit Service |
384592 |
long int rval_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rc = tfn->execute(mptmp, (unsigned char *)rvar->value,
|
|
Packit Service |
384592 |
rvar->value_len, &rval, &rval_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rvar->value = rval;
|
|
Packit Service |
384592 |
rvar->value_len = rval_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "T (%d) %s: \"%s\"", rc, tfn->name,
|
|
Packit Service |
384592 |
log_escape_nq_ex(mptmp, rvar->value, rvar->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return rvar;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#if defined(WITH_LUA)
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
apr_table_t *generate_multi_var(modsec_rec *msr, msre_var *var, apr_array_header_t *tfn_arr,
|
|
Packit Service |
384592 |
msre_rule *rule, apr_pool_t *mptmp)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
const apr_array_header_t *tarr;
|
|
Packit Service |
384592 |
const apr_table_entry_t *telts;
|
|
Packit Service |
384592 |
apr_table_t *vartab = NULL, *tvartab = NULL;
|
|
Packit Service |
384592 |
msre_var *rvar = NULL;
|
|
Packit Service |
384592 |
int i, j;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Sanity check. */
|
|
Packit Service |
384592 |
if ((var == NULL)||(var->metadata == NULL)||(var->metadata->generate == NULL)) return NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Generate variables. */
|
|
Packit Service |
384592 |
vartab = apr_table_make(mptmp, 16);
|
|
Packit Service |
384592 |
var->metadata->generate(msr, var, rule, vartab, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Return straight away if there were no
|
|
Packit Service |
384592 |
* transformation functions supplied.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
if ((tfn_arr == NULL)||(tfn_arr->nelts == 0)) {
|
|
Packit Service |
384592 |
return vartab;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
tvartab = apr_table_make(mptmp, 16);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
tarr = apr_table_elts(vartab);
|
|
Packit Service |
384592 |
telts = (const apr_table_entry_t*)tarr->elts;
|
|
Packit Service |
384592 |
for (j = 0; j < tarr->nelts; j++) {
|
|
Packit Service |
384592 |
rvar = (msre_var *)telts[j].val;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Copy the value so that we can transform it in place. */
|
|
Packit Service |
384592 |
rvar->value = apr_pstrndup(mptmp, rvar->value, rvar->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Transform rvar in a loop. */
|
|
Packit Service |
384592 |
for (i = 0; i < tfn_arr->nelts; i++) {
|
|
Packit Service |
384592 |
msre_tfn_metadata *tfn = ((msre_tfn_metadata **)tfn_arr->elts)[i];
|
|
Packit Service |
384592 |
char *rval;
|
|
Packit Service |
384592 |
int rc;
|
|
Packit Service |
384592 |
long int rval_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rc = tfn->execute(mptmp, (unsigned char *)rvar->value,
|
|
Packit Service |
384592 |
rvar->value_len, &rval, &rval_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rvar->value = rval;
|
|
Packit Service |
384592 |
rvar->value_len = rval_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "T (%d) %s: \"%s\"", rc, tfn->name,
|
|
Packit Service |
384592 |
log_escape_nq_ex(mptmp, rvar->value, rvar->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_addn(tvartab, rvar->name, (void *)rvar);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return tvartab;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
#endif
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
* Expands macros ("%{NAME}" entities) if present
|
|
Packit Service |
384592 |
* in the given variable.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
int expand_macros(modsec_rec *msr, msc_string *var, msre_rule *rule, apr_pool_t *mptmp) {
|
|
Packit Service |
384592 |
char *data = NULL;
|
|
Packit Service |
384592 |
apr_array_header_t *arr = NULL;
|
|
Packit Service |
384592 |
char *p = NULL, *q = NULL, *t = NULL;
|
|
Packit Service |
384592 |
char *text_start = NULL, *next_text_start = NULL;
|
|
Packit Service |
384592 |
msc_string *part = NULL;
|
|
Packit Service |
384592 |
int i, offset = 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (var->value == NULL) return 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 Duplicate the string and create the array on
|
|
Packit Service |
384592 |
* demand, thus not having to do it if there are
|
|
Packit Service |
384592 |
* no macros in the input data.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
data = apr_pstrdup(mptmp, var->value); /* IMP1 Are we modifying data anywhere? */
|
|
Packit Service |
384592 |
arr = apr_array_make(mptmp, 16, sizeof(msc_string *));
|
|
Packit Service |
384592 |
if ((data == NULL)||(arr == NULL)) return -1;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
text_start = next_text_start = data;
|
|
Packit Service |
384592 |
do {
|
|
Packit Service |
384592 |
text_start = next_text_start;
|
|
Packit Service |
384592 |
p = strstr(text_start, "%");
|
|
Packit Service |
384592 |
if (p != NULL) {
|
|
Packit Service |
384592 |
char *var_name = NULL;
|
|
Packit Service |
384592 |
char *var_value = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if ((*(p + 1) == '{')&&(*(p + 2) != '\0')) {
|
|
Packit Service |
384592 |
char *var_start = p + 2;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
t = var_start;
|
|
Packit Service |
384592 |
while((*t != '\0')&&(*t != '}')) t++;
|
|
Packit Service |
384592 |
if (*t == '}') {
|
|
Packit Service |
384592 |
/* Named variable. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var_name = apr_pstrmemdup(mptmp, var_start, t - var_start);
|
|
Packit Service |
384592 |
q = strstr(var_name, ".");
|
|
Packit Service |
384592 |
if (q != NULL) {
|
|
Packit Service |
384592 |
var_value = q + 1;
|
|
Packit Service |
384592 |
*q = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
next_text_start = t + 1; /* *t was '}' */
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
/* Warn about a possiblly forgotten '}' */
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Warning: Possibly unterminated macro: \"%s\"",
|
|
Packit Service |
384592 |
log_escape_ex(mptmp, var_start - 2, t - var_start + 2));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
next_text_start = t; /* *t was '\0' */
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (var_name != NULL) {
|
|
Packit Service |
384592 |
char *my_error_msg = NULL;
|
|
Packit Service |
384592 |
msre_var *var_generated = NULL;
|
|
Packit Service |
384592 |
msre_var *var_resolved = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Add the text part before the macro to the array. */
|
|
Packit Service |
384592 |
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (part == NULL) return -1;
|
|
Packit Service |
384592 |
part->value_len = p - text_start;
|
|
Packit Service |
384592 |
part->value = apr_pstrmemdup(mptmp, text_start, part->value_len);
|
|
Packit Service |
384592 |
*(msc_string **)apr_array_push(arr) = part;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Resolve the macro and add that to the array. */
|
|
Packit Service |
384592 |
var_resolved = msre_create_var_ex(mptmp, msr->modsecurity->msre, var_name, var_value,
|
|
Packit Service |
384592 |
msr, &my_error_msg);
|
|
Packit Service |
384592 |
if (var_resolved != NULL) {
|
|
Packit Service |
384592 |
var_generated = generate_single_var(msr, var_resolved, NULL, rule, mptmp);
|
|
Packit Service |
384592 |
if (var_generated != NULL) {
|
|
Packit Service |
384592 |
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (part == NULL) return -1;
|
|
Packit Service |
384592 |
part->value_len = var_generated->value_len;
|
|
Packit Service |
384592 |
part->value = (char *)var_generated->value;
|
|
Packit Service |
384592 |
*(msc_string **)apr_array_push(arr) = part;
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Resolved macro %%{%s%s%s} to: %s",
|
|
Packit Service |
384592 |
var_name,
|
|
Packit Service |
384592 |
(var_value ? "." : ""),
|
|
Packit Service |
384592 |
(var_value ? var_value : ""),
|
|
Packit Service |
384592 |
log_escape_nq_ex(mptmp, part->value, part->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Failed to resolve macro %%{%s%s%s}: %s",
|
|
Packit Service |
384592 |
var_name,
|
|
Packit Service |
384592 |
(var_value ? "." : ""),
|
|
Packit Service |
384592 |
(var_value ? var_value : ""),
|
|
Packit Service |
384592 |
my_error_msg);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
/* We could not identify a valid macro so add it as text. */
|
|
Packit Service |
384592 |
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (part == NULL) return -1;
|
|
Packit Service |
384592 |
part->value_len = p - text_start + 1; /* len(text)+len("%") */
|
|
Packit Service |
384592 |
part->value = apr_pstrmemdup(mptmp, text_start, part->value_len);
|
|
Packit Service |
384592 |
*(msc_string **)apr_array_push(arr) = part;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
next_text_start = p + 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
/* Text part. */
|
|
Packit Service |
384592 |
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
part->value = apr_pstrdup(mptmp, text_start);
|
|
Packit Service |
384592 |
part->value_len = strlen(part->value);
|
|
Packit Service |
384592 |
*(msc_string **)apr_array_push(arr) = part;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} while (p != NULL);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* If there's more than one member of the array that
|
|
Packit Service |
384592 |
* means there was at least one macro present. Combine
|
|
Packit Service |
384592 |
* text parts into a single string now.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
if (arr->nelts > 1) {
|
|
Packit Service |
384592 |
/* Figure out the required size for the string. */
|
|
Packit Service |
384592 |
var->value_len = 0;
|
|
Packit Service |
384592 |
for(i = 0; i < arr->nelts; i++) {
|
|
Packit Service |
384592 |
part = ((msc_string **)arr->elts)[i];
|
|
Packit Service |
384592 |
var->value_len += part->value_len;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Allocate the string. */
|
|
Packit Service |
384592 |
var->value = apr_palloc(msr->mp, var->value_len + 1);
|
|
Packit Service |
384592 |
if (var->value == NULL) return -1;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Combine the parts. */
|
|
Packit Service |
384592 |
offset = 0;
|
|
Packit Service |
384592 |
for(i = 0; i < arr->nelts; i++) {
|
|
Packit Service |
384592 |
part = ((msc_string **)arr->elts)[i];
|
|
Packit Service |
384592 |
memcpy((char *)(var->value + offset), part->value, part->value_len);
|
|
Packit Service |
384592 |
offset += part->value_len;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
var->value[offset] = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
* Record the original collection values to use to calculate deltas.
|
|
Packit Service |
384592 |
* This can be called multiple times and will not overwrite the first
|
|
Packit Service |
384592 |
* value that is set.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
apr_status_t collection_original_setvar(modsec_rec *msr, const char *col_name, const msc_string *orig_var) {
|
|
Packit Service |
384592 |
apr_table_t *table = NULL;
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
const char *var_name = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (orig_var == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Internal Error: Attempt to record NULL original variable.");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var_name = orig_var->name;
|
|
Packit Service |
384592 |
table = (apr_table_t *)apr_table_get(msr->collections_original, col_name);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Does the collection exist already? */
|
|
Packit Service |
384592 |
if (table == NULL) {
|
|
Packit Service |
384592 |
table = apr_table_make(msr->mp, 24);
|
|
Packit Service |
384592 |
if (table == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space for original collection.");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
apr_table_setn(msr->collections_original, apr_pstrdup(msr->mp, col_name), (void *)table);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
/* Does the variable exist already? */
|
|
Packit Service |
384592 |
var = (msc_string *)apr_table_get(table, var_name);
|
|
Packit Service |
384592 |
if (var != NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Original collection variable: %s.%s = \"%s\"", col_name, var_name,
|
|
Packit Service |
384592 |
log_escape_ex(msr->mp, orig_var->value, orig_var->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var = (msc_string *)apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space for original collection variable.");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Copy the original var and add to collection. */
|
|
Packit Service |
384592 |
var->name = orig_var->name ? apr_pstrmemdup(msr->mp, orig_var->name, orig_var->name_len) : NULL;
|
|
Packit Service |
384592 |
var->name_len = orig_var->name_len;
|
|
Packit Service |
384592 |
var->value = orig_var->value ? apr_pstrmemdup(msr->mp, orig_var->value, orig_var->value_len) : NULL;
|
|
Packit Service |
384592 |
var->value_len = orig_var->value_len;
|
|
Packit Service |
384592 |
apr_table_setn(table, apr_pstrmemdup(msr->mp, var->name, var->name_len), (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Recorded original collection variable: %s.%s = \"%s\"", col_name, var_name,
|
|
Packit Service |
384592 |
log_escape_ex(msr->mp, var->value, var->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* marker */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_marker_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->id = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* id */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_id_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->id = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_id_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
int id;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if(action != NULL && action->param != NULL) {
|
|
Packit Service |
384592 |
for(id=0;id<strlen(action->param);id++) {
|
|
Packit Service |
384592 |
if(!apr_isdigit(action->param[id]))
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid value for action ID: %s", action->param);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
id = atoi(action->param);
|
|
Packit Service |
384592 |
if ((id == LONG_MAX)||(id == LONG_MIN)||(id <= 0)) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid value for action ID: %s", action->param);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* rev */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_rev_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->rev = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* msg */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_msg_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->msg = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* logdata */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_logdata_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->logdata = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* SanitizeMatchedBytes init */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_sanitizeMatchedBytes_init(msre_engine *engine, apr_pool_t *mp,
|
|
Packit Service |
384592 |
msre_actionset *actionset, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *parse_parm = NULL;
|
|
Packit Service |
384592 |
char *ac_param = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
int arg_min = 0;
|
|
Packit Service |
384592 |
int arg_max = 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (action->param != NULL && strlen(action->param) == 3) {
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
ac_param = apr_pstrdup(mp, action->param);
|
|
Packit Service |
384592 |
parse_parm = apr_strtok(ac_param,"/",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if(apr_isdigit(*parse_parm) && apr_isdigit(*savedptr)) {
|
|
Packit Service |
384592 |
arg_max = atoi(parse_parm);
|
|
Packit Service |
384592 |
arg_min = atoi(savedptr);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
actionset->arg_min = arg_min;
|
|
Packit Service |
384592 |
actionset->arg_max = arg_max;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* accuracy */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_accuracy_init(msre_engine *engine, apr_pool_t *mp,
|
|
Packit Service |
384592 |
msre_actionset *actionset, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->accuracy = atoi(action->param);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* maturity */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_maturity_init(msre_engine *engine, apr_pool_t *mp,
|
|
Packit Service |
384592 |
msre_actionset *actionset, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->maturity = atoi(action->param);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ver */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_ver_init(msre_engine *engine, apr_pool_t *mp,
|
|
Packit Service |
384592 |
msre_actionset *actionset, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->version = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* severity */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_severity_init(msre_engine *engine, apr_pool_t *mp,
|
|
Packit Service |
384592 |
msre_actionset *actionset, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
if (strcasecmp(action->param, "emergency") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 0;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "alert") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 1;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "critical") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 2;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "error") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 3;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "warning") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 4;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "notice") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 5;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "info") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 6;
|
|
Packit Service |
384592 |
} else if (strcasecmp(action->param, "debug") == 0) {
|
|
Packit Service |
384592 |
actionset->severity = 7;
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
actionset->severity = atoi(action->param);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* chain */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_chain_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->is_chained = 1;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* log */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_log_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->log = 1;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* nolog */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_nolog_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->log = 0;
|
|
Packit Service |
384592 |
actionset->auditlog = 0;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* auditlog */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_auditlog_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->auditlog = 1;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* noauditlog */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_noauditlog_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->auditlog = 0;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* block */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_block_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
/* Right now we just set a flag and inherit the real disruptive action */
|
|
Packit Service |
384592 |
actionset->block = 1;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* deny */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_deny_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_DENY;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* status */
|
|
Packit Service |
384592 |
static char *msre_action_status_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH action->param must be a valid HTTP status code. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_status_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_status = atoi(action->param);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* drop */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_drop_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_DROP;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* pause */
|
|
Packit Service |
384592 |
static char *msre_action_pause_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Validate a positive number. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_pause_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_PAUSE;
|
|
Packit Service |
384592 |
actionset->intercept_pause = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* redirect */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_redirect_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Add validation. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_redirect_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_REDIRECT;
|
|
Packit Service |
384592 |
actionset->intercept_uri = action->param;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_redirect_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) return -1;
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rule->actionset->intercept_uri = apr_pstrmemdup(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* proxy */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_proxy_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Add validation. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_proxy_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_PROXY;
|
|
Packit Service |
384592 |
actionset->intercept_uri = action->param;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_proxy_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) return -1;
|
|
Packit Service |
384592 |
if (!strncmp(action->param,"[nocanon]",9)) {
|
|
Packit Service |
384592 |
apr_table_setn(msr->r->notes,"proxy-nocanon", "1");
|
|
Packit Service |
384592 |
var->value = (char *)action->param+9;
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
rule->actionset->intercept_uri = apr_pstrmemdup(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* pass */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_pass_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_NONE;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* skip */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_skip_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Add validation. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_skip_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->skip_count = atoi(action->param);
|
|
Packit Service |
384592 |
if (actionset->skip_count <= 0) actionset->skip_count = 1;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* skipAfter */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_skipAfter_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Add validation. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_skipAfter_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->skip_after = action->param;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* allow */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_allow_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_ALLOW;
|
|
Packit Service |
384592 |
actionset->intercept_action_rec = action;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (action->param != NULL) {
|
|
Packit Service |
384592 |
if (strcasecmp(action->param, "phase") == 0) {
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_ALLOW_PHASE;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(action->param, "request") == 0) {
|
|
Packit Service |
384592 |
actionset->intercept_action = ACTION_ALLOW_REQUEST;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_allow_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
if (action->param != NULL) {
|
|
Packit Service |
384592 |
if (strcasecmp(action->param, "phase") == 0) {
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(action->param, "request") == 0) {
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid parameter for allow: %s", action->param);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* phase */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_phase_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
/* ENH Add validation. */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_phase_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
if(strcasecmp(action->param,"request") == 0)
|
|
Packit Service |
384592 |
actionset->phase = 2;
|
|
Packit Service |
384592 |
else if(strcasecmp(action->param,"response") == 0)
|
|
Packit Service |
384592 |
actionset->phase = 4;
|
|
Packit Service |
384592 |
else if(strcasecmp(action->param,"logging") == 0)
|
|
Packit Service |
384592 |
actionset->phase = 5;
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
actionset->phase = atoi(action->param);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* t */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static char *msre_action_t_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
msre_tfn_metadata *metadata = NULL;
|
|
Packit Service |
384592 |
metadata = msre_engine_tfn_resolve(engine, action->param);
|
|
Packit Service |
384592 |
if (metadata == NULL) return apr_psprintf(mp, "Invalid transformation function: %s",
|
|
Packit Service |
384592 |
action->param);
|
|
Packit Service |
384592 |
action->param_data = metadata;
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_t_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msre_tfn_metadata *metadata = (msre_tfn_metadata *)action->param_data;
|
|
Packit Service |
384592 |
action->param_data = metadata;
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ctl */
|
|
Packit Service |
384592 |
static char *msre_action_ctl_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
char *name = NULL;
|
|
Packit Service |
384592 |
char *value = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Parse first. */
|
|
Packit Service |
384592 |
if (parse_name_eq_value(mp, action->param, &name, &value) < 0) {
|
|
Packit Service |
384592 |
return FATAL_ERROR;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (value == NULL) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Missing ctl value for name: %s", name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Validate value. */
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "detectiononly") == 0) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name ruleEngine: %s", value);
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveById") == 0) {
|
|
Packit Service |
384592 |
/* ENH nothing yet */
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveByTag") == 0) {
|
|
Packit Service |
384592 |
if (!msc_pregcomp(mp, value, 0, NULL, NULL))
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid regular expression \"%s\"", value);
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveByMsg") == 0) {
|
|
Packit Service |
384592 |
if (!msc_pregcomp(mp, value, 0, NULL, NULL))
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid regular expression \"%s\"", value);
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyAccess") == 0) {
|
|
Packit Service |
384592 |
if (parse_boolean(value) == -1) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
" requestBodyAccess: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyProcessor") == 0) {
|
|
Packit Service |
384592 |
/* ENH We will accept anything for now but it'd be nice
|
|
Packit Service |
384592 |
* to add a check here that the processor name is a valid one.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "forceRequestBodyVariable") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
" forceRequestBodyVariable: %s", value);
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "responseBodyAccess") == 0) {
|
|
Packit Service |
384592 |
if (parse_boolean(value) == -1) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
" responseBodyAccess: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "auditEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "relevantonly") == 0) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
" auditEngine: %s", value);
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "auditLogParts") == 0) {
|
|
Packit Service |
384592 |
if ((value[0] == '+')||(value[0] == '-')) {
|
|
Packit Service |
384592 |
if (is_valid_parts_specification(value + 1) != 1) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
"auditLogParts: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (is_valid_parts_specification(value) != 1) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
"auditLogParts: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "debugLogLevel") == 0) {
|
|
Packit Service |
384592 |
if ((atoi(value) >= 0)&&(atoi(value) <= 9)) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
"debugLogLevel: %s", value);
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyLimit") == 0) {
|
|
Packit Service |
384592 |
long int limit = strtol(value, NULL, 10);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
"requestBodyLimit: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (limit > REQUEST_BODY_HARD_LIMIT) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Request size limit cannot exceed "
|
|
Packit Service |
384592 |
"the hard limit: %ld", RESPONSE_BODY_HARD_LIMIT);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "responseBodyLimit") == 0) {
|
|
Packit Service |
384592 |
long int limit = strtol(value, NULL, 10);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if ((limit == LONG_MAX)||(limit == LONG_MIN)||(limit <= 0)) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name "
|
|
Packit Service |
384592 |
"responseBodyLimit: %s", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (limit > RESPONSE_BODY_HARD_LIMIT) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Response size limit cannot exceed "
|
|
Packit Service |
384592 |
"the hard limit: %ld", RESPONSE_BODY_HARD_LIMIT);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveTargetById") == 0) {
|
|
Packit Service |
384592 |
char *parm = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
parm = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if(parm == NULL && savedptr == NULL)
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ruleRemoveTargetById must has at least id;VARIABLE");
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name,"ruleRemoveTargetByTag") == 0) {
|
|
Packit Service |
384592 |
char *parm = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
parm = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
if(parm == NULL && savedptr == NULL)
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ruleRemoveTargetByTag must has at least tag;VARIABLE");
|
|
Packit Service |
384592 |
if (!msc_pregcomp(mp, parm, 0, NULL, NULL)) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid regular expression \"%s\"", parm);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name,"ruleRemoveTargetByMsg") == 0) {
|
|
Packit Service |
384592 |
char *parm = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
parm = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
if(parm == NULL && savedptr == NULL)
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ruleRemoveTargetByMsg must has at least msg;VARIABLE");
|
|
Packit Service |
384592 |
if (!msc_pregcomp(mp, parm, 0, NULL, NULL)) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "ModSecurity: Invalid regular expression \"%s\"", parm);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "HashEnforcement") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name HashEnforcement: %s", value);
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "HashEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) return NULL;
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) return NULL;
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid setting for ctl name HashEngine: %s", value);
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Invalid ctl name setting: %s", name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_ctl_init(msre_engine *engine, apr_pool_t *mp, msre_actionset *actionset,
|
|
Packit Service |
384592 |
msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
/* Do nothing. */
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_ctl_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *name = NULL;
|
|
Packit Service |
384592 |
char *value = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Parse first. */
|
|
Packit Service |
384592 |
if (parse_name_eq_value(msr->mp, action->param, &name, &value) < 0) return -1;
|
|
Packit Service |
384592 |
if (value == NULL) return -1;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Validate value. */
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->is_enabled = MODSEC_ENABLED;
|
|
Packit Service |
384592 |
msr->usercfg->is_enabled = MODSEC_ENABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->is_enabled = MODSEC_DISABLED;
|
|
Packit Service |
384592 |
msr->usercfg->is_enabled = MODSEC_DISABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (strcasecmp(value, "detectiononly") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->is_enabled = MODSEC_DETECTION_ONLY;
|
|
Packit Service |
384592 |
msr->usercfg->is_enabled = MODSEC_DETECTION_ONLY;
|
|
Packit Service |
384592 |
msr->txcfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL;
|
|
Packit Service |
384592 |
msr->usercfg->if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL;
|
|
Packit Service |
384592 |
msr->txcfg->of_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL;
|
|
Packit Service |
384592 |
msr->usercfg->of_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set ruleEngine to %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "HashEnforcement") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->hash_enforcement = HASH_ENABLED;
|
|
Packit Service |
384592 |
msr->usercfg->hash_enforcement = HASH_ENABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->hash_enforcement = HASH_DISABLED;
|
|
Packit Service |
384592 |
msr->usercfg->hash_enforcement = HASH_DISABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set HashEnforcement to %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "HashEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->hash_is_enabled = HASH_ENABLED;
|
|
Packit Service |
384592 |
msr->usercfg->hash_is_enabled = HASH_ENABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->hash_is_enabled = HASH_DISABLED;
|
|
Packit Service |
384592 |
msr->usercfg->hash_is_enabled = HASH_DISABLED;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set HashEngine to %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveById") == 0) {
|
|
Packit Service |
384592 |
*(const char **)apr_array_push(msr->removed_rules) = (const char *)apr_pstrdup(msr->mp, value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Removed rule by id : %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveByTag") == 0) {
|
|
Packit Service |
384592 |
rule_exception *re = apr_pcalloc(msr->mp, sizeof(rule_exception));
|
|
Packit Service |
384592 |
re->type = RULE_EXCEPTION_REMOVE_TAG;
|
|
Packit Service |
384592 |
re->param = (const char *)apr_pstrdup(msr->mp, value);
|
|
Packit Service |
384592 |
re->param_data = msc_pregcomp(msr->mp, re->param, 0, NULL, NULL);
|
|
Packit Service |
384592 |
if (re->param_data == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", re->param);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
*(rule_exception **)apr_array_push(msr->removed_rules_tag) = re;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Removed rule by tag : %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveByMsg") == 0) {
|
|
Packit Service |
384592 |
rule_exception *re = apr_pcalloc(msr->mp, sizeof(rule_exception));
|
|
Packit Service |
384592 |
re->type = RULE_EXCEPTION_REMOVE_MSG;
|
|
Packit Service |
384592 |
re->param = (const char *)apr_pstrdup(msr->mp, value);
|
|
Packit Service |
384592 |
re->param_data = msc_pregcomp(msr->mp, re->param, 0, NULL, NULL);
|
|
Packit Service |
384592 |
if (re->param_data == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", re->param);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
*(rule_exception **)apr_array_push(msr->removed_rules_msg) = re;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Removed rule by msg : %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyAccess") == 0) {
|
|
Packit Service |
384592 |
int pv = parse_boolean(value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (pv == -1) return -1;
|
|
Packit Service |
384592 |
msr->txcfg->reqbody_access = pv;
|
|
Packit Service |
384592 |
msr->usercfg->reqbody_access = pv;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set requestBodyAccess to %d.", pv);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "forceRequestBodyVariable") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_ON;
|
|
Packit Service |
384592 |
msr->usercfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_ON;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_OFF;
|
|
Packit Service |
384592 |
msr->usercfg->reqbody_buffering = REQUEST_BODY_FORCEBUF_OFF;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set requestBodyAccess to %d.", msr->txcfg->reqbody_buffering);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyProcessor") == 0) {
|
|
Packit Service |
384592 |
msr->msc_reqbody_processor = value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set requestBodyProcessor to %s.", value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "responseBodyAccess") == 0) {
|
|
Packit Service |
384592 |
int pv = parse_boolean(value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (pv == -1) return -1;
|
|
Packit Service |
384592 |
msr->txcfg->resbody_access = pv;
|
|
Packit Service |
384592 |
msr->usercfg->resbody_access = pv;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set responseBodyAccess to %d.", pv);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "auditEngine") == 0) {
|
|
Packit Service |
384592 |
if (strcasecmp(value, "on") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->auditlog_flag = AUDITLOG_ON;
|
|
Packit Service |
384592 |
msr->usercfg->auditlog_flag = AUDITLOG_ON;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (strcasecmp(value, "off") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->auditlog_flag = AUDITLOG_OFF;
|
|
Packit Service |
384592 |
msr->usercfg->auditlog_flag = AUDITLOG_OFF;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (strcasecmp(value, "relevantonly") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->auditlog_flag = AUDITLOG_RELEVANT;
|
|
Packit Service |
384592 |
msr->usercfg->auditlog_flag = AUDITLOG_RELEVANT;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set auditEngine to %d.", msr->txcfg->auditlog_flag);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "auditLogParts") == 0) {
|
|
Packit Service |
384592 |
char *new_value = value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (value[0] == '+') {
|
|
Packit Service |
384592 |
/* Add the listed parts. */
|
|
Packit Service |
384592 |
new_value = apr_pstrcat(msr->mp, msr->txcfg->auditlog_parts, value + 1, NULL);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else
|
|
Packit Service |
384592 |
if (value[0] == '-') { /* Remove the listed parts. */
|
|
Packit Service |
384592 |
char c, *t = value + 1;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Start with the current value. */
|
|
Packit Service |
384592 |
new_value = apr_pstrdup(msr->mp, msr->txcfg->auditlog_parts);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
while((c = *t++) != '\0') {
|
|
Packit Service |
384592 |
char *s = new_value;
|
|
Packit Service |
384592 |
char *d = new_value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
while(*s != '\0') {
|
|
Packit Service |
384592 |
if (*s != c) {
|
|
Packit Service |
384592 |
*(d++) = *(s++);
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
s++;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
*d = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Set the new value. */
|
|
Packit Service |
384592 |
msr->txcfg->auditlog_parts = new_value;
|
|
Packit Service |
384592 |
msr->usercfg->auditlog_parts = new_value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set auditLogParts to %s.", msr->txcfg->auditlog_parts);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "debugLogLevel") == 0) {
|
|
Packit Service |
384592 |
msr->txcfg->debuglog_level = atoi(value);
|
|
Packit Service |
384592 |
msr->usercfg->debuglog_level = atoi(value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set debugLogLevel to %d.", msr->txcfg->debuglog_level);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "requestBodyLimit") == 0) {
|
|
Packit Service |
384592 |
long int limit = strtol(value, NULL, 10);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH Accept only in correct phase warn otherwise. */
|
|
Packit Service |
384592 |
msr->txcfg->reqbody_limit = limit;
|
|
Packit Service |
384592 |
msr->usercfg->reqbody_limit = limit;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set requestBodyLimit to %ld.", limit);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "responseBodyLimit") == 0) {
|
|
Packit Service |
384592 |
long int limit = strtol(value, NULL, 10);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH Accept only in correct phase warn otherwise. */
|
|
Packit Service |
384592 |
msr->txcfg->of_limit = limit;
|
|
Packit Service |
384592 |
msr->usercfg->of_limit = limit;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: Set responseBodyLimit to %ld.", limit);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveTargetById") == 0) {
|
|
Packit Service |
384592 |
rule_exception *re = NULL;
|
|
Packit Service |
384592 |
char *p1 = NULL, *p2 = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p1 = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p2 = apr_strtok(NULL,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: ruleRemoveTargetById id=%s targets=%s", p1, p2);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
re = apr_pcalloc(msr->mp, sizeof(rule_exception));
|
|
Packit Service |
384592 |
re->type = RULE_EXCEPTION_REMOVE_ID;
|
|
Packit Service |
384592 |
re->param = (const char *)apr_pstrdup(msr->mp, p1);
|
|
Packit Service |
384592 |
apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveTargetByTag") == 0) {
|
|
Packit Service |
384592 |
rule_exception *re = NULL;
|
|
Packit Service |
384592 |
char *p1 = NULL, *p2 = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p1 = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p2 = apr_strtok(NULL,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: ruleRemoveTargetByTag tag=%s targets=%s", p1, p2);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (p2 == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "ModSecurity: Missing target for tag \"%s\"", p1);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
re = apr_pcalloc(msr->mp, sizeof(rule_exception));
|
|
Packit Service |
384592 |
re->type = RULE_EXCEPTION_REMOVE_TAG;
|
|
Packit Service |
384592 |
re->param = (const char *)apr_pstrdup(msr->mp, p1);
|
|
Packit Service |
384592 |
re->param_data = msc_pregcomp(msr->mp, p1, 0, NULL, NULL);
|
|
Packit Service |
384592 |
if (re->param_data == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", p1);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if (strcasecmp(name, "ruleRemoveTargetByMsg") == 0) {
|
|
Packit Service |
384592 |
rule_exception *re = NULL;
|
|
Packit Service |
384592 |
char *p1 = NULL, *p2 = NULL;
|
|
Packit Service |
384592 |
char *savedptr = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p1 = apr_strtok(value,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
p2 = apr_strtok(NULL,";",&savedptr);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Ctl: ruleRemoveTargetByMsg msg=%s targets=%s", p1, p2);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
re = apr_pcalloc(msr->mp, sizeof(rule_exception));
|
|
Packit Service |
384592 |
re->type = RULE_EXCEPTION_REMOVE_MSG;
|
|
Packit Service |
384592 |
re->param = apr_pstrdup(msr->mp, p1);
|
|
Packit Service |
384592 |
re->param_data = msc_pregcomp(msr->mp, p1, 0, NULL, NULL);
|
|
Packit Service |
384592 |
if (re->param_data == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "ModSecurity: Invalid regular expression \"%s\"", p1);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
apr_table_addn(msr->removed_targets, apr_pstrdup(msr->mp, p2), (void *)re);
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
/* Should never happen, but log if it does. */
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Internal Error: Unknown ctl action \"%s\".", name);
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* xmlns */
|
|
Packit Service |
384592 |
static char *msre_action_xmlns_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
char *name = NULL;
|
|
Packit Service |
384592 |
char *value = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Parse first. */
|
|
Packit Service |
384592 |
if (parse_name_eq_value(mp, action->param, &name, &value) < 0) {
|
|
Packit Service |
384592 |
return FATAL_ERROR;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
if (value == NULL) {
|
|
Packit Service |
384592 |
return apr_psprintf(mp, "Missing xmlns href for prefix: %s", name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Don't do anything else right now, we are just storing
|
|
Packit Service |
384592 |
* the value for the variable, which is the real consumer
|
|
Packit Service |
384592 |
* for the namespace information.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeArg */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_sanitizeArg_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
const char *sargname = NULL;
|
|
Packit Service |
384592 |
const apr_array_header_t *tarr;
|
|
Packit Service |
384592 |
const apr_table_entry_t *telts;
|
|
Packit Service |
384592 |
int i;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
sargname = action->param;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
tarr = apr_table_elts(msr->arguments);
|
|
Packit Service |
384592 |
telts = (const apr_table_entry_t*)tarr->elts;
|
|
Packit Service |
384592 |
for (i = 0; i < tarr->nelts; i++) {
|
|
Packit Service |
384592 |
msc_arg *arg = (msc_arg *)telts[i].val;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (strcasecmp(sargname, arg->name) == 0) {
|
|
Packit Service |
384592 |
apr_table_addn(msr->arguments_to_sanitize, arg->name, (void *)arg);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#define SANITISE_ARG 1
|
|
Packit Service |
384592 |
#define SANITISE_REQUEST_HEADER 2
|
|
Packit Service |
384592 |
#define SANITISE_RESPONSE_HEADER 3
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeMatched */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_sanitizeMatched_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
const char *sargname = NULL;
|
|
Packit Service |
384592 |
const apr_array_header_t *tarr;
|
|
Packit Service |
384592 |
const apr_table_entry_t *telts;
|
|
Packit Service |
384592 |
int i, type = 0;
|
|
Packit Service |
384592 |
msc_string *mvar = msr->matched_var;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (mvar->name_len == 0) return 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 We need to extract the variable name properly here,
|
|
Packit Service |
384592 |
* taking into account it may have been escaped.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
if ((mvar->name_len > 5) && (strncmp(mvar->name, "ARGS:", 5) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 5);
|
|
Packit Service |
384592 |
type = SANITISE_ARG;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if ((mvar->name_len > 11) && (strncmp(mvar->name, "ARGS_NAMES:", 11) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 11);
|
|
Packit Service |
384592 |
type = SANITISE_ARG;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if ((mvar->name_len > 16) && (strncmp(mvar->name, "REQUEST_HEADERS:", 16) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 16);
|
|
Packit Service |
384592 |
type = SANITISE_REQUEST_HEADER;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if ((mvar->name_len > 22) && (strncmp(mvar->name, "REQUEST_HEADERS_NAMES:", 22) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 22);
|
|
Packit Service |
384592 |
type = SANITISE_REQUEST_HEADER;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if ((mvar->name_len > 17) && (strncmp(mvar->name, "RESPONSE_HEADERS:", 17) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 17);
|
|
Packit Service |
384592 |
type = SANITISE_RESPONSE_HEADER;
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
if ((mvar->name_len > 23) && (strncmp(mvar->name, "RESPONSE_HEADERS_NAMES:", 23) == 0)) {
|
|
Packit Service |
384592 |
sargname = apr_pstrdup(msr->mp, mvar->name + 23);
|
|
Packit Service |
384592 |
type = SANITISE_RESPONSE_HEADER;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "sanitizeMatched: Don't know how to handle variable: %s",
|
|
Packit Service |
384592 |
mvar->name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
switch(type) {
|
|
Packit Service |
384592 |
case SANITISE_ARG :
|
|
Packit Service |
384592 |
tarr = apr_table_elts(msr->arguments);
|
|
Packit Service |
384592 |
telts = (const apr_table_entry_t*)tarr->elts;
|
|
Packit Service |
384592 |
for (i = 0; i < tarr->nelts; i++) {
|
|
Packit Service |
384592 |
msc_arg *arg = (msc_arg *)telts[i].val;
|
|
Packit Service |
384592 |
if (strcasecmp(sargname, arg->name) == 0) {
|
|
Packit Service |
384592 |
apr_table_addn(msr->arguments_to_sanitize, arg->name, (void *)arg);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
break;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
case SANITISE_REQUEST_HEADER :
|
|
Packit Service |
384592 |
apr_table_set(msr->request_headers_to_sanitize, sargname, "1");
|
|
Packit Service |
384592 |
break;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
case SANITISE_RESPONSE_HEADER :
|
|
Packit Service |
384592 |
apr_table_set(msr->response_headers_to_sanitize, sargname, "1");
|
|
Packit Service |
384592 |
break;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
default :
|
|
Packit Service |
384592 |
/* do nothing */
|
|
Packit Service |
384592 |
break;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeRequestHeader */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_sanitizeRequestHeader_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
apr_table_set(msr->request_headers_to_sanitize, action->param, "1");
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeResponseHeader */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_sanitizeResponseHeader_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
apr_table_set(msr->response_headers_to_sanitize, action->param, "1");
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setenv */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_setenv_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *data = apr_pstrdup(mptmp, action->param);
|
|
Packit Service |
384592 |
char *env_name = NULL, *env_value = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
msc_string *env = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Extract the name and the value. */
|
|
Packit Service |
384592 |
/* IMP1 We have a function for this now, parse_name_eq_value? */
|
|
Packit Service |
384592 |
s = strstr(data, "=");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
env_name = data;
|
|
Packit Service |
384592 |
env_value = "1";
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
env_name = data;
|
|
Packit Service |
384592 |
env_value = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Setting env variable: %s=%s", env_name, env_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand and escape any macros in the name */
|
|
Packit Service |
384592 |
env = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (env == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand name macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
env->value = env_name;
|
|
Packit Service |
384592 |
env->value_len = strlen(env->value);
|
|
Packit Service |
384592 |
expand_macros(msr, env, rule, mptmp);
|
|
Packit Service |
384592 |
env_name = log_escape_nq_ex(msr->mp, env->value, env->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Execute the requested action. */
|
|
Packit Service |
384592 |
if (env_name != NULL && env_name[0] == '!') {
|
|
Packit Service |
384592 |
/* Delete */
|
|
Packit Service |
384592 |
apr_table_unset(msr->r->subprocess_env, env_name + 1);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Unset env variable \"%s\".", env_name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
/* Set */
|
|
Packit Service |
384592 |
char * val_value = NULL;
|
|
Packit Service |
384592 |
msc_string *val = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (val == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand value macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand values in value */
|
|
Packit Service |
384592 |
val->value = env_value;
|
|
Packit Service |
384592 |
val->value_len = strlen(val->value);
|
|
Packit Service |
384592 |
expand_macros(msr, val, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* To be safe, we escape NULs as it goes in subprocess_env. */
|
|
Packit Service |
384592 |
val_value = log_escape_nul(msr->mp, (const unsigned char *)val->value, val->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_set(msr->r->subprocess_env, env_name, val_value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Set env variable \"%s\" to: %s",
|
|
Packit Service |
384592 |
env_name,
|
|
Packit Service |
384592 |
log_escape_nq(mptmp, val_value));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setvar */
|
|
Packit Service |
384592 |
apr_status_t msre_action_setvar_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, char *var_name, char *var_value)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *col_name = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
apr_table_t *target_col = NULL;
|
|
Packit Service |
384592 |
int is_negated = 0;
|
|
Packit Service |
384592 |
char *real_col_name = NULL;
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Setting variable: %s=%s", var_name, var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand and escape any macros in the name */
|
|
Packit Service |
384592 |
var = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand name macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
var->value = var_name;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Handle the exclamation mark. */
|
|
Packit Service |
384592 |
if (var_name != NULL && var_name[0] == '!') {
|
|
Packit Service |
384592 |
var_name = var_name + 1;
|
|
Packit Service |
384592 |
is_negated = 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH Not possible to use ! and = at the same time. */
|
|
Packit Service |
384592 |
/* ENH Not possible to change variable "KEY". */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Figure out the collection name. */
|
|
Packit Service |
384592 |
target_col = msr->tx_vars;
|
|
Packit Service |
384592 |
s = strstr(var_name, ".");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Asked to set variable \"%s\", but no collection name specified. ",
|
|
Packit Service |
384592 |
log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
col_name = var_name;
|
|
Packit Service |
384592 |
var_name = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (strcasecmp(col_name,"USER") == 0 || strcasecmp(col_name,"SESSION") == 0
|
|
Packit Service |
384592 |
|| strcasecmp(col_name, "RESOURCE") == 0) {
|
|
Packit Service |
384592 |
real_col_name = apr_psprintf(mptmp, "%s_%s", msr->txcfg->webappid, col_name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Locate the collection. */
|
|
Packit Service |
384592 |
if (strcasecmp(col_name, "tx") == 0) { /* Special case for TX variables. */
|
|
Packit Service |
384592 |
target_col = msr->tx_vars;
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
target_col = (apr_table_t *)apr_table_get(msr->collections, col_name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (target_col == NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Could not set variable \"%s.%s\" as the collection does not exist.",
|
|
Packit Service |
384592 |
log_escape(msr->mp, col_name), log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (is_negated) {
|
|
Packit Service |
384592 |
/* Unset variable. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH Refuse to remove certain variables, e.g. TIMEOUT, internal variables, etc... */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_unset(target_col, var_name);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Unset variable \"%s.%s\".", col_name, var_name);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
/* Set or change variable. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if ((var_value[0] == '+')||(var_value[0] == '-')) {
|
|
Packit Service |
384592 |
/* Relative change. */
|
|
Packit Service |
384592 |
msc_string *rec = NULL;
|
|
Packit Service |
384592 |
msc_string *val = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
int value = 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (val == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand value macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Retrieve variable or generate (if it does not exist). */
|
|
Packit Service |
384592 |
rec = (msc_string *)apr_table_get(target_col, var_name);
|
|
Packit Service |
384592 |
if (rec == NULL) {
|
|
Packit Service |
384592 |
rec = var; /* use the already allocated space for var */
|
|
Packit Service |
384592 |
rec->name = apr_pstrdup(msr->mp, var_name);
|
|
Packit Service |
384592 |
rec->name_len = strlen(rec->name);
|
|
Packit Service |
384592 |
value = 0;
|
|
Packit Service |
384592 |
rec->value = apr_psprintf(msr->mp, "%d", value);
|
|
Packit Service |
384592 |
rec->value_len = strlen(rec->value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
value = atoi(rec->value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Record the original value before we change it */
|
|
Packit Service |
384592 |
if (real_col_name == NULL) {
|
|
Packit Service |
384592 |
collection_original_setvar(msr, col_name, rec);
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
collection_original_setvar(msr, real_col_name, rec);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand values in value */
|
|
Packit Service |
384592 |
val->value = var_value;
|
|
Packit Service |
384592 |
val->value_len = strlen(val->value);
|
|
Packit Service |
384592 |
expand_macros(msr, val, rule, mptmp);
|
|
Packit Service |
384592 |
var_value = val->value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Relative change: %s=%d%s", var_name, value, var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Change value. */
|
|
Packit Service |
384592 |
value += atoi(var_value);
|
|
Packit Service |
384592 |
if (value < 0) value = 0; /* Counters never go below zero. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Put the variable back. */
|
|
Packit Service |
384592 |
rec->value = apr_psprintf(msr->mp, "%d", value);
|
|
Packit Service |
384592 |
rec->value_len = strlen(rec->value);
|
|
Packit Service |
384592 |
apr_table_setn(target_col, rec->name, (void *)rec);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Set variable \"%s.%s\" to \"%s\".",
|
|
Packit Service |
384592 |
col_name, rec->name,
|
|
Packit Service |
384592 |
log_escape_ex(mptmp, rec->value, rec->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
else {
|
|
Packit Service |
384592 |
/* Absolute change. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var->name = apr_pstrdup(msr->mp, var_name);
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_pstrdup(msr->mp, var_value);
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_setn(target_col, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Set variable \"%s.%s\" to \"%s\".",
|
|
Packit Service |
384592 |
log_escape(mptmp, col_name),
|
|
Packit Service |
384592 |
log_escape_ex(mptmp, var->name, var->name_len),
|
|
Packit Service |
384592 |
log_escape_ex(mptmp, var->value, var->value_len));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Make note of the change so that we know later
|
|
Packit Service |
384592 |
* we need to persist the collection.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
apr_table_set(msr->collections_dirty, col_name, "1");
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/*
|
|
Packit Service |
384592 |
* \brief Parse fuction for setvar input
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* \param msr Pointer to the engine
|
|
Packit Service |
384592 |
* \param mptmp Pointer to the pool
|
|
Packit Service |
384592 |
* \param rule Pointer to rule struct
|
|
Packit Service |
384592 |
* \param action input data
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* \retval -1 On failure
|
|
Packit Service |
384592 |
* \retval 0 On Collection failure
|
|
Packit Service |
384592 |
* \retval 1 On Success
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
static apr_status_t msre_action_setvar_parse(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *data = apr_pstrdup(mptmp, action->param);
|
|
Packit Service |
384592 |
char *var_name = NULL, *var_value = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Extract the name and the value. */
|
|
Packit Service |
384592 |
/* IMP1 We have a function for this now, parse_name_eq_value? */
|
|
Packit Service |
384592 |
s = strstr(data, "=");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = "1";
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
while ((*var_value != '\0')&&(isspace(*var_value))) var_value++;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return msre_action_setvar_execute(msr,mptmp,rule,var_name,var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* expirevar */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_expirevar_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *data = apr_pstrdup(mptmp, action->param);
|
|
Packit Service |
384592 |
char *col_name = NULL, *var_name = NULL, *var_value = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
apr_table_t *target_col = NULL;
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Extract the name and the value. */
|
|
Packit Service |
384592 |
/* IMP1 We have a function for this now, parse_name_eq_value? */
|
|
Packit Service |
384592 |
s = strstr(data, "=");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = "1";
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Expiring variable: %s=%s", var_name, var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand and escape any macros in the name */
|
|
Packit Service |
384592 |
var = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand name macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
var->value = var_name;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Choose the collection to work with. */
|
|
Packit Service |
384592 |
s = strstr(var_name, ".");
|
|
Packit Service |
384592 |
if (s != NULL) {
|
|
Packit Service |
384592 |
col_name = var_name;
|
|
Packit Service |
384592 |
var_name = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 No need to handle TX here because TX variables cannot expire,
|
|
Packit Service |
384592 |
* but we definitely need to have a better error message.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
target_col = (apr_table_t *)apr_table_get(msr->collections, col_name);
|
|
Packit Service |
384592 |
if (target_col == NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Could not expire variable \"%s.%s\" as the collection does not exist.",
|
|
Packit Service |
384592 |
log_escape(msr->mp, col_name), log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Asked to expire variable \"%s\", but no collection name specified. ",
|
|
Packit Service |
384592 |
log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* To expire a variable we just place a special variable into
|
|
Packit Service |
384592 |
* the collection. Expiry actually happens when the collection
|
|
Packit Service |
384592 |
* is retrieved from storage the next time.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = apr_psprintf(msr->mp, "__expire_%s", var_name);
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand macros in value */
|
|
Packit Service |
384592 |
var->value = var_value;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, msr->mp);
|
|
Packit Service |
384592 |
var_value = var->value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Calculate with the expanded value */
|
|
Packit Service |
384592 |
var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(msr->request_time)
|
|
Packit Service |
384592 |
+ atoi(var_value)));
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_setn(target_col, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Variable \"%s.%s\" set to expire in %s seconds.", col_name,
|
|
Packit Service |
384592 |
var_name, var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_set(msr->collections_dirty, col_name, "1");
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* deprecatevar */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_deprecatevar_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *data = apr_pstrdup(mptmp, action->param);
|
|
Packit Service |
384592 |
char *col_name = NULL, *var_name = NULL, *var_value = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
apr_table_t *target_col = NULL;
|
|
Packit Service |
384592 |
msc_string *var = NULL, *var_last_update_time = NULL;
|
|
Packit Service |
384592 |
apr_time_t last_update_time, current_time;
|
|
Packit Service |
384592 |
long current_value, new_value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Extract the name and the value. */
|
|
Packit Service |
384592 |
/* IMP1 We have a function for this now, parse_name_eq_value? */
|
|
Packit Service |
384592 |
s = strstr(data, "=");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = "1";
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
var_name = data;
|
|
Packit Service |
384592 |
var_value = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Deprecating variable: %s=%s", var_name, var_value);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand and escape any macros in the name */
|
|
Packit Service |
384592 |
var = apr_palloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to allocate space to expand name macros");
|
|
Packit Service |
384592 |
return -1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
var->value = var_name;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
var_name = log_escape_nq_ex(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand macros in value */
|
|
Packit Service |
384592 |
var->value = var_value;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, msr->mp);
|
|
Packit Service |
384592 |
var_value = var->value;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Choose the collection to work with. */
|
|
Packit Service |
384592 |
s = strstr(var_name, ".");
|
|
Packit Service |
384592 |
if (s != NULL) {
|
|
Packit Service |
384592 |
col_name = var_name;
|
|
Packit Service |
384592 |
var_name = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 Add message TX variables cannot deprecate in value. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
target_col = (apr_table_t *)apr_table_get(msr->collections, col_name);
|
|
Packit Service |
384592 |
if (target_col == NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Could not deprecate variable \"%s.%s\" as the collection does "
|
|
Packit Service |
384592 |
"not exist.", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 3) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Asked to deprecate variable \"%s\", but no collection name specified. ",
|
|
Packit Service |
384592 |
log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Find the current value. */
|
|
Packit Service |
384592 |
var = (msc_string *)apr_table_get(target_col, var_name);
|
|
Packit Service |
384592 |
if (var == NULL) {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Asked to deprecate variable \"%s.%s\", but it does not exist.",
|
|
Packit Service |
384592 |
log_escape(msr->mp, col_name), log_escape(msr->mp, var_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
current_value = atoi(var->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Find the last update time (of the collection). */
|
|
Packit Service |
384592 |
var_last_update_time = (msc_string *)apr_table_get(target_col, "LAST_UPDATE_TIME");
|
|
Packit Service |
384592 |
if (var_last_update_time == NULL) {
|
|
Packit Service |
384592 |
/* This is all right. If collection was created (and not restored from
|
|
Packit Service |
384592 |
* storage) then it won't have LAST_UPDATE_TIME - it was never updated.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
current_time = apr_time_sec(apr_time_now());
|
|
Packit Service |
384592 |
last_update_time = atoi(var_last_update_time->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
s = strstr(var_value, "/");
|
|
Packit Service |
384592 |
if (s == NULL) {
|
|
Packit Service |
384592 |
msr_log(msr, 3, "Incorrect format for the deprecatevar argument: \"%s\"",
|
|
Packit Service |
384592 |
log_escape(msr->mp, var_value));
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
s++;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Deprecate the value using the given speed and the
|
|
Packit Service |
384592 |
* time elapsed since the last update.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
new_value = current_value -
|
|
Packit Service |
384592 |
(atol(var_value) * ((current_time - last_update_time) / atol(s)));
|
|
Packit Service |
384592 |
if (new_value < 0) new_value = 0;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Only change the value if it differs. */
|
|
Packit Service |
384592 |
if (new_value != current_value) {
|
|
Packit Service |
384592 |
var->value = apr_psprintf(msr->mp, "%ld", new_value);
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Deprecated variable \"%s.%s\" from %ld to %ld (%" APR_TIME_T_FMT " seconds since "
|
|
Packit Service |
384592 |
"last update).", log_escape(msr->mp, col_name), log_escape(msr->mp, var_name),
|
|
Packit Service |
384592 |
current_value, new_value, (apr_time_t)(current_time - last_update_time));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
apr_table_set(msr->collections_dirty, col_name, "1");
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 9) {
|
|
Packit Service |
384592 |
msr_log(msr, 9, "Not deprecating variable \"%s.%s\" because the new value (%ld) is "
|
|
Packit Service |
384592 |
"the same as the old one (%ld) (%" APR_TIME_T_FMT " seconds since last update).",
|
|
Packit Service |
384592 |
log_escape(msr->mp, col_name), log_escape(msr->mp, var_name), current_value,
|
|
Packit Service |
384592 |
new_value, (apr_time_t)(current_time - last_update_time));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t init_collection(modsec_rec *msr, const char *real_col_name,
|
|
Packit Service |
384592 |
const char *col_name, const char *col_key, unsigned int col_key_len)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
apr_table_t *table = NULL;
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 Cannot initialise the built-in collections this way. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Does the collection exist already? */
|
|
Packit Service |
384592 |
if (apr_table_get(msr->collections, col_name) != NULL) {
|
|
Packit Service |
384592 |
/* ENH Warn about this. */
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Init collection from storage. */
|
|
Packit Service |
384592 |
table = collection_retrieve(msr, real_col_name, col_key, col_key_len);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (table == NULL) {
|
|
Packit Service |
384592 |
/* Does not exist yet - create new. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Creating collection (name \"%s\", key \"%s\").",
|
|
Packit Service |
384592 |
real_col_name, col_key);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
table = apr_table_make(msr->mp, 24);
|
|
Packit Service |
384592 |
if (table == NULL) return -1;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 Is the timeout hard-coded to 3600? */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if(msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Setting default timeout collection value %d.",msr->txcfg->col_timeout);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Add default timeout. */
|
|
Packit Service |
384592 |
var = (msc_string *)apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "__expire_KEY";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)(apr_time_sec(msr->request_time) + msr->txcfg->col_timeout));
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Remember the key. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "KEY";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_pstrmemdup(msr->mp, col_key, col_key_len);
|
|
Packit Service |
384592 |
var->value_len = col_key_len;
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* The timeout. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "TIMEOUT";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_psprintf(msr->mp, "%d", msr->txcfg->col_timeout);
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* We may want to allow the user to unset KEY
|
|
Packit Service |
384592 |
* but we still need to preserve value to identify
|
|
Packit Service |
384592 |
* the collection in storage.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* IMP1 Actually I want a better way to delete collections,
|
|
Packit Service |
384592 |
* perhaps a dedicated action.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "__key";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_pstrmemdup(msr->mp, col_key, col_key_len);
|
|
Packit Service |
384592 |
var->value_len = col_key_len;
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Peristence code will need to know the name of the collection. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "__name";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_pstrdup(msr->mp, real_col_name);
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Create time. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "CREATE_TIME";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = apr_psprintf(msr->mp, "%" APR_TIME_T_FMT, (apr_time_t)apr_time_sec(msr->request_time));
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Update counter. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "UPDATE_COUNTER";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = "0";
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* This is a new collection. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(msr->mp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->name = "IS_NEW";
|
|
Packit Service |
384592 |
var->name_len = strlen(var->name);
|
|
Packit Service |
384592 |
var->value = "1";
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
apr_table_setn(table, var->name, (void *)var);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Record the original counter value before we change it */
|
|
Packit Service |
384592 |
var = (msc_string *)apr_table_get(table, "UPDATE_COUNTER");
|
|
Packit Service |
384592 |
if (var != NULL) {
|
|
Packit Service |
384592 |
if (real_col_name == NULL) {
|
|
Packit Service |
384592 |
collection_original_setvar(msr, col_name, var);
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
collection_original_setvar(msr, real_col_name, var);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Add the collection to the list. */
|
|
Packit Service |
384592 |
apr_table_setn(msr->collections, apr_pstrdup(msr->mp, col_name), (void *)table);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (msr->txcfg->debuglog_level >= 4) {
|
|
Packit Service |
384592 |
if (strcmp(col_name, real_col_name) != 0) {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Added collection \"%s\" to the list as \"%s\".",
|
|
Packit Service |
384592 |
log_escape(msr->mp, real_col_name), log_escape(msr->mp, col_name));
|
|
Packit Service |
384592 |
} else {
|
|
Packit Service |
384592 |
msr_log(msr, 4, "Added collection \"%s\" to the list.",
|
|
Packit Service |
384592 |
log_escape(msr->mp, real_col_name));
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* initcol */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_initcol_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
char *data = apr_pstrdup(msr->mp, action->param);
|
|
Packit Service |
384592 |
char *col_name = NULL, *col_key = NULL;
|
|
Packit Service |
384592 |
unsigned int col_key_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
char *s = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Extract the name and the value. */
|
|
Packit Service |
384592 |
/* IMP1 We have a function for this now, parse_name_eq_value? */
|
|
Packit Service |
384592 |
s = strstr(data, "=");
|
|
Packit Service |
384592 |
if (s == NULL) return 0;
|
|
Packit Service |
384592 |
col_name = strtolower_inplace((unsigned char *)data);
|
|
Packit Service |
384592 |
col_key = s + 1;
|
|
Packit Service |
384592 |
*s = '\0';
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand the key and init collection from storage. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->value = col_key;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
col_key = var->value;
|
|
Packit Service |
384592 |
col_key_len = var->value_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return init_collection(msr, col_name, col_name, col_key, col_key_len);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setsid */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_setsid_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
char *real_col_name = NULL, *col_key = NULL;
|
|
Packit Service |
384592 |
unsigned int col_key_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct session ID. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
msr->sessionid = apr_pstrdup(msr->mp, var->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct collection name. */
|
|
Packit Service |
384592 |
col_key = var->value;
|
|
Packit Service |
384592 |
col_key_len = var->value_len;
|
|
Packit Service |
384592 |
real_col_name = apr_psprintf(mptmp, "%s_SESSION", msr->txcfg->webappid);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Initialise collection. */
|
|
Packit Service |
384592 |
return init_collection(msr, real_col_name, "SESSION", col_key, col_key_len);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setuid */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_setuid_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
char *real_col_name = NULL, *col_key = NULL;
|
|
Packit Service |
384592 |
unsigned int col_key_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct user ID. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
msr->userid = apr_pstrdup(msr->mp, var->value);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct collection name. */
|
|
Packit Service |
384592 |
col_key = var->value;
|
|
Packit Service |
384592 |
col_key_len = var->value_len;
|
|
Packit Service |
384592 |
real_col_name = apr_psprintf(mptmp, "%s_USER", msr->txcfg->webappid);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Initialise collection. */
|
|
Packit Service |
384592 |
return init_collection(msr, real_col_name, "USER", col_key, col_key_len);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setrsc */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_setrsc_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
char *real_col_name = NULL, *col_key = NULL;
|
|
Packit Service |
384592 |
unsigned int col_key_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct user ID. */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Construct collection name. */
|
|
Packit Service |
384592 |
col_key = var->value;
|
|
Packit Service |
384592 |
col_key_len = var->value_len;
|
|
Packit Service |
384592 |
real_col_name = apr_psprintf(mptmp, "%s_RESOURCE", msr->txcfg->webappid);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Initialise collection. */
|
|
Packit Service |
384592 |
return init_collection(msr, real_col_name, "RESOURCE", col_key, col_key_len);
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* exec */
|
|
Packit Service |
384592 |
static char *msre_action_exec_validate(msre_engine *engine, apr_pool_t *mp, msre_action *action) {
|
|
Packit Service |
384592 |
#if defined(WITH_LUA)
|
|
Packit Service |
384592 |
char *filename = (char *)action->param;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* TODO Support relative filenames. */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Process Lua scripts internally. */
|
|
Packit Service |
384592 |
if (strlen(filename) > 4) {
|
|
Packit Service |
384592 |
char *p = filename + strlen(filename) - 4;
|
|
Packit Service |
384592 |
if ((p[0] == '.')&&(p[1] == 'l')&&(p[2] == 'u')&&(p[3] == 'a')) {
|
|
Packit Service |
384592 |
/* It's a Lua script. */
|
|
Packit Service |
384592 |
msc_script *script = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Compile script. */
|
|
Packit Service |
384592 |
char *msg = lua_compile(&script, filename, mp);
|
|
Packit Service |
384592 |
if (msg != NULL) return msg;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
action->param_data = script;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
#endif
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return NULL;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
static apr_status_t msre_action_exec_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
#if defined(WITH_LUA)
|
|
Packit Service |
384592 |
if (action->param_data != NULL) { /* Lua */
|
|
Packit Service |
384592 |
msc_script *script = (msc_script *)action->param_data;
|
|
Packit Service |
384592 |
char *my_error_msg = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
if (lua_execute(script, NULL, msr, rule, &my_error_msg) < 0) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "%s", my_error_msg);
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
} else
|
|
Packit Service |
384592 |
#endif
|
|
Packit Service |
384592 |
{ /* Execute as shell script. */
|
|
Packit Service |
384592 |
char *script_output = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
int rc = apache2_exec(msr, action->param, NULL, &script_output);
|
|
Packit Service |
384592 |
if (rc != 1) {
|
|
Packit Service |
384592 |
msr_log(msr, 1, "Failed to execute: %s", action->param);
|
|
Packit Service |
384592 |
return 0;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* prepend */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_prepend_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand any macros in the text */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) return -1;
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH: Verify we really have to dup the data here. */
|
|
Packit Service |
384592 |
msr->content_prepend = apr_pstrndup(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
msr->content_prepend_len = var->value_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* append */
|
|
Packit Service |
384592 |
static apr_status_t msre_action_append_execute(modsec_rec *msr, apr_pool_t *mptmp,
|
|
Packit Service |
384592 |
msre_rule *rule, msre_action *action)
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
msc_string *var = NULL;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Expand any macros in the text */
|
|
Packit Service |
384592 |
var = apr_pcalloc(mptmp, sizeof(msc_string));
|
|
Packit Service |
384592 |
if (var == NULL) return -1;
|
|
Packit Service |
384592 |
var->value = (char *)action->param;
|
|
Packit Service |
384592 |
var->value_len = strlen(var->value);
|
|
Packit Service |
384592 |
expand_macros(msr, var, rule, mptmp);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ENH: Verify we really have to dup the data here. */
|
|
Packit Service |
384592 |
msr->content_append = apr_pstrndup(msr->mp, var->value, var->value_len);
|
|
Packit Service |
384592 |
msr->content_append_len = var->value_len;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
return 1;
|
|
Packit Service |
384592 |
}
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* -- */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/**
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
void msre_engine_register_default_actions(msre_engine *engine) {
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* id */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"id",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_id_validate,
|
|
Packit Service |
384592 |
msre_action_id_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* marker */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"marker",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_marker_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* rev */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"rev",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_rev_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* msg */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"msg",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_msg_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* logdata */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"logdata",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_logdata_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* accuracy */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"accuracy",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_accuracy_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* maturity */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"maturity",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_maturity_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ver */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"ver",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_ver_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* severity */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"severity",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_severity_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* chain */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"chain",
|
|
Packit Service |
384592 |
ACTION_FLOW,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_chain_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* log */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"log",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_LOG,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_log_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* nolog */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"nolog",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_LOG,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_nolog_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* auditlog */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"auditlog",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_AUDITLOG,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_auditlog_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* noauditlog */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"noauditlog",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_AUDITLOG,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_noauditlog_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* block */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"block",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_block_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* deny */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"deny",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_deny_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* status */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"status",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_status_validate,
|
|
Packit Service |
384592 |
msre_action_status_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* drop */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"drop",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_drop_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* pause */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"pause",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_pause_validate,
|
|
Packit Service |
384592 |
msre_action_pause_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* redirect */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"redirect",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
msre_action_redirect_validate,
|
|
Packit Service |
384592 |
msre_action_redirect_init,
|
|
Packit Service |
384592 |
msre_action_redirect_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* proxy */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"proxy",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
msre_action_proxy_validate,
|
|
Packit Service |
384592 |
msre_action_proxy_init,
|
|
Packit Service |
384592 |
msre_action_proxy_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* pass */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"pass",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_pass_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* skip */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"skip",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
msre_action_skip_validate,
|
|
Packit Service |
384592 |
msre_action_skip_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* skipAfter */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"skipAfter",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
msre_action_skipAfter_validate,
|
|
Packit Service |
384592 |
msre_action_skipAfter_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* allow */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"allow",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_DISRUPTIVE,
|
|
Packit Service |
384592 |
msre_action_allow_validate,
|
|
Packit Service |
384592 |
msre_action_allow_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* phase */
|
|
Packit Service |
384592 |
/* ENH: This should be ACTION_NON_DISRUPTIVE or ACTION_FLOW??? */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"phase",
|
|
Packit Service |
384592 |
ACTION_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_phase_validate,
|
|
Packit Service |
384592 |
msre_action_phase_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* t */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"t",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
ALLOW_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_t_validate,
|
|
Packit Service |
384592 |
msre_action_t_init,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* ctl */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"ctl",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_ctl_validate,
|
|
Packit Service |
384592 |
msre_action_ctl_init,
|
|
Packit Service |
384592 |
msre_action_ctl_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* xmlns */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"xmlns",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_xmlns_validate,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* capture */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"capture",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitiseArg */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitiseArg",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeArg_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitiseMatchedBytes */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitiseMatchedBytes",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatchedBytes_init,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatched_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeMatchedBytes */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitizeMatchedBytes",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatchedBytes_init,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatched_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeArg */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitizeArg",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeArg_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitiseMatched */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitiseMatched",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatched_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeMatched */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitizeMatched",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeMatched_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitiseRequestHeader */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitiseRequestHeader",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeRequestHeader_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeRequestHeader */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitizeRequestHeader",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeRequestHeader_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitiseResponseHeader */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitiseResponseHeader",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeResponseHeader_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* sanitizeResponseHeader */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"sanitizeResponseHeader",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_sanitizeResponseHeader_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setenv */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"setenv",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_setenv_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setvar */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"setvar",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_setvar_parse
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* expirevar */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"expirevar",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_expirevar_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* deprecatevar */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"deprecatevar",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_deprecatevar_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* initcol */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"initcol",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_initcol_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setsid */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"setsid",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_setsid_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setuid */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"setrsc",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_setrsc_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* setuid */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"setuid",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_setuid_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* exec */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"exec",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
msre_action_exec_validate,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_exec_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* multiMatch */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"multiMatch",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
0, 0,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* tag */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"tag",
|
|
Packit Service |
384592 |
ACTION_METADATA,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_MANY,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* prepend */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"prepend",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_prepend_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* append */
|
|
Packit Service |
384592 |
msre_engine_action_register(engine,
|
|
Packit Service |
384592 |
"append",
|
|
Packit Service |
384592 |
ACTION_NON_DISRUPTIVE,
|
|
Packit Service |
384592 |
1, 1,
|
|
Packit Service |
384592 |
NO_PLUS_MINUS,
|
|
Packit Service |
384592 |
ACTION_CARDINALITY_ONE,
|
|
Packit Service |
384592 |
ACTION_CGROUP_NONE,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
NULL,
|
|
Packit Service |
384592 |
msre_action_append_execute
|
|
Packit Service |
384592 |
);
|
|
Packit Service |
384592 |
}
|