ASF Bugzilla – Attachment 34479 Details for
Bug 59765
provide a way to obfuscate/hash IP addresses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Mod status PrivacyMode directive (directory context aware version)
httpd-trunk-mod_status-privacy_mode_directory_context_aware.patch (text/plain), 4.67 KB, created by
Luca Toscano
on 2016-11-26 10:05:54 UTC
(
hide
)
Description:
Mod status PrivacyMode directive (directory context aware version)
Filename:
MIME Type:
Creator:
Luca Toscano
Created:
2016-11-26 10:05:54 UTC
Size:
4.67 KB
patch
obsolete
>Index: modules/generators/mod_status.c >=================================================================== >--- modules/generators/mod_status.c (revision 1771119) >+++ modules/generators/mod_status.c (working copy) >@@ -89,6 +89,10 @@ > static int server_limit, thread_limit, threads_per_child, max_servers, > is_async; > >+typedef struct { >+ int privacy_mode; >+} status_config; >+ > /* Implement 'ap_run_status_hook'. */ > APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap, STATUS, int, status_hook, > (request_rec *r, int flags), >@@ -674,6 +678,10 @@ > } > > if (ap_extended_status && !short_report) { >+ status_config *config = (status_config *) ap_get_module_config(r->per_dir_config, >+ &status_module); >+ if (config->privacy_mode) >+ ap_rputs("\nClient IP removed due to privacy mode set.\n\n", r); > if (no_table_report) > ap_rputs("<hr /><h2>Server Details</h2>\n\n", r); > else >@@ -687,7 +695,6 @@ > "<th>Conn</th><th>Child</th><th>Slot</th>" > "<th>Client</th><th>Protocol</th><th>VHost</th>" > "<th>Request</th></tr>\n\n", r); >- > for (i = 0; i < server_limit; ++i) { > for (j = 0; j < thread_limit; ++j) { > ap_copy_scoreboard_worker(ws_record, i, j); >@@ -800,9 +807,10 @@ > ap_rputs(")\n", r); > ap_rprintf(r, > " <i>%s {%s}</i> <i>(%s)</i> <b>[%s]</b><br />\n\n", >+ config->privacy_mode ? "" >+ : ap_escape_html(r->pool, >+ ws_record->client), > ap_escape_html(r->pool, >- ws_record->client), >- ap_escape_html(r->pool, > ap_escape_logitem(r->pool, > ws_record->request)), > ap_escape_html(r->pool, >@@ -887,9 +895,10 @@ > > ap_rprintf(r, "</td><td>%s</td><td>%s</td><td nowrap>%s</td>" > "<td nowrap>%s</td></tr>\n\n", >+ config->privacy_mode ? "" >+ : ap_escape_html(r->pool, >+ ws_record->client), > ap_escape_html(r->pool, >- ws_record->client), >- ap_escape_html(r->pool, > ws_record->protocol), > ap_escape_html(r->pool, > ws_record->vhost), >@@ -992,6 +1001,34 @@ > } > #endif > >+const char *privacy_mode_set_enabled(cmd_parms *cmd, void *cfg, const char *arg) >+{ >+ status_config *config = (status_config *) cfg; >+ if(!strcasecmp(arg, "on")) >+ config->privacy_mode = 1; >+ else >+ config->privacy_mode = 0; >+ return NULL; >+} >+ >+void *create_dir_conf(apr_pool_t *pool, char *dummy) >+{ >+ status_config *cfg = apr_pcalloc(pool, sizeof(status_config)); >+ if (cfg) { >+ cfg->privacy_mode = 0; >+ } >+ return cfg; >+} >+ >+void *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD) >+{ >+ status_config *add = (status_config *) ADD; >+ status_config *base = (status_config *) BASE; >+ status_config *conf = (status_config *) create_dir_conf(pool, NULL); >+ conf->privacy_mode = add->privacy_mode; >+ return add; >+} >+ > static void register_hooks(apr_pool_t *p) > { > ap_hook_handler(status_handler, NULL, NULL, APR_HOOK_MIDDLE); >@@ -1002,13 +1039,20 @@ > #endif > } > >+static const command_rec status_directives[] = >+{ >+ AP_INIT_TAKE1("PrivacyStatus", privacy_mode_set_enabled, NULL, RSRC_CONF|ACCESS_CONF, >+ "Enable or disable Privacy Mode for mod-status"), >+ { NULL } >+}; >+ > AP_DECLARE_MODULE(status) = > { > STANDARD20_MODULE_STUFF, >- NULL, /* dir config creater */ >- NULL, /* dir merger --- default is to override */ >+ create_dir_conf, /* dir config creater */ >+ merge_dir_conf, /* dir merger --- default is to override */ > NULL, /* server config */ > NULL, /* merge server config */ >- NULL, /* command table */ >+ status_directives, /* command table */ > register_hooks /* register_hooks */ > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59765
: 34479