From 312f029c8a2507eb4345f7c42ab5ded867255d08 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Wed, 20 Dec 2017 14:36:29 -0300 Subject: [PATCH 1/2] Updates the CHANGES files --- CHANGES | 7 ++++--- src/ngx_http_modsecurity_common.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index a669e53..a1ba664 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ -DD mmm YYYY - 1.0.0 + +v1.0.0 - 2017-Dec-20 -------------------- - * First version of the ModSecurity-nginx - [Felipe Zimmerle] + - First version of ModSecurity-nginx connector + diff --git a/src/ngx_http_modsecurity_common.h b/src/ngx_http_modsecurity_common.h index f2a4aa8..7d8ebcd 100644 --- a/src/ngx_http_modsecurity_common.h +++ b/src/ngx_http_modsecurity_common.h @@ -26,6 +26,34 @@ #include #include + +/** + * TAG_NUM: + * + * Alpha - 001 + * Beta - 002 + * Dev - 010 + * Rc1 - 051 + * Rc2 - 052 + * ... - ... + * Release- 100 + * + */ + +#define MODSECURITY_NGINX_MAJOR "1" +#define MODSECURITY_NGINX_MINOR "0" +#define MODSECURITY_NGINX_PATCHLEVEL "0" +#define MODSECURITY_NGINX_TAG "" +#define MODSECURITY_NGINX_TAG_NUM "100" + +#define MODSECURITY_NGINX_VERSION MODSECURITY_NGINX_MAJOR "." \ + MODSECURITY_NGINX_MINOR "." MODSECURITY_NGINX_PATCHLEVEL \ + MODSECURITY_NGINX_TAG + +#define MODSECURITY_NGINX_VERSION_NUM MODSECURITY_NGINX_MAJOR \ + MODSECURITY_NGINX_MINOR MODSECURITY_NGINX_PATCHLEVEL \ + MODSECURITY_NGINX_TAG_NUM + typedef struct { ngx_str_t name; ngx_str_t value; From 4e5e09ba3cddf53c9c64d8ef0d1fc3ab0261b360 Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Mon, 25 Dec 2017 12:31:30 +0300 Subject: [PATCH 2/2] Emit connector version in error log While here, fixed msc_set_connector_info() to use consistent version string. This fixes #85. --- src/ngx_http_modsecurity_common.h | 3 +++ src/ngx_http_modsecurity_module.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ngx_http_modsecurity_common.h b/src/ngx_http_modsecurity_common.h index 7d8ebcd..1a21f78 100644 --- a/src/ngx_http_modsecurity_common.h +++ b/src/ngx_http_modsecurity_common.h @@ -54,6 +54,9 @@ MODSECURITY_NGINX_MINOR MODSECURITY_NGINX_PATCHLEVEL \ MODSECURITY_NGINX_TAG_NUM +#define MODSECURITY_NGINX_WHOAMI "ModSecurity-nginx v" \ + MODSECURITY_NGINX_VERSION + typedef struct { ngx_str_t name; ngx_str_t value; diff --git a/src/ngx_http_modsecurity_module.c b/src/ngx_http_modsecurity_module.c index 6d6ee7a..46924fb 100644 --- a/src/ngx_http_modsecurity_module.c +++ b/src/ngx_http_modsecurity_module.c @@ -496,6 +496,8 @@ ngx_http_modsecurity_create_main_conf(ngx_conf_t *cf) { ngx_http_modsecurity_conf_t *conf; + ngx_log_error(NGX_LOG_NOTICE, cf->log, 0, MODSECURITY_NGINX_WHOAMI); + /* ngx_pcalloc already sets all of this scructure to zeros. */ conf = ngx_http_modsecurity_create_conf(cf); @@ -515,7 +517,7 @@ ngx_http_modsecurity_create_main_conf(ngx_conf_t *cf) } /* Provide our connector information to LibModSecurity */ - msc_set_connector_info(conf->modsec, "ModSecurity-nginx v0.1.1-beta"); + msc_set_connector_info(conf->modsec, MODSECURITY_NGINX_WHOAMI); msc_set_log_cb(conf->modsec, ngx_http_modsecurity_log); return conf;