libapache-mod-removeip-1.0b/0000755000175000017500000000000010467430572014761 5ustar micahmicahlibapache-mod-removeip-1.0b/apache2.0/0000755000175000017500000000000010467430572016422 5ustar micahmicahlibapache-mod-removeip-1.0b/apache2.0/mod_removeip.c0000644000175000017500000000361710466650076021264 0ustar micahmicah#include "httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" #include "http_vhost.h" #include "apr_strings.h" module AP_MODULE_DECLARE_DATA removeip_module; typedef struct { int enable; } removeip_server_cfg; static void *removeip_create_server_cfg(apr_pool_t *p, server_rec *s) { removeip_server_cfg *cfg = (removeip_server_cfg *)apr_pcalloc(p, sizeof(removeip_server_cfg)); if (!cfg) return NULL; cfg->enable = 0; return (void *)cfg; } static const char *removeip_enable(cmd_parms *cmd, void *dummy, int flag) { server_rec *s = cmd->server; removeip_server_cfg *cfg = (removeip_server_cfg *)ap_get_module_config(s->module_config, &removeip_module); cfg->enable = flag; return NULL; } static int change_remote_ip(request_rec *r) { const char *fwdvalue; char *val; removeip_server_cfg *cfg = (removeip_server_cfg *)ap_get_module_config(r->server->module_config, &removeip_module); if (!cfg->enable) return DECLINED; r->connection->remote_ip = apr_pstrdup(r->connection->pool, "localhost"); r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr("127.0.0.1"); return DECLINED; } static const command_rec removeip_cmds[] = { AP_INIT_FLAG( "REMOVEIPenable", removeip_enable, NULL, RSRC_CONF, "Enable mod_removeip" ), { NULL } }; static void register_hooks(apr_pool_t *p) { ap_hook_post_read_request(change_remote_ip, NULL, NULL, APR_HOOK_MIDDLE); } module AP_MODULE_DECLARE_DATA removeip_module = { STANDARD20_MODULE_STUFF, NULL, NULL, removeip_create_server_cfg, NULL, removeip_cmds, register_hooks, }; libapache-mod-removeip-1.0b/apache2.0/Makefile0000644000175000017500000000124010466650076020061 0ustar micahmicah# Makefile for mod_removeip.c (gmake) # $Id:$ #APXS2=/path/to/your/apxs APXS2=`which apxs2` default: @echo mod_removeip: @echo author: andrew@scoop.co.nz @echo @echo following options available: @echo \"make removeip\" to compile the 2.0 version @echo \"make install\" to install the 2.0 version @echo @echo change path to apxs if this is not it: \"$(APXS2)\" removeip: mod_removeip.o @echo make done, type \"make install\" to install mod_removeip-2.0 mod_removeip.o: mod_removeip.c $(APXS2) -c -n $@ mod_removeip.c mod_removeip.c: install: mod_removeip.o $(APXS2) -i -n mod_removeip.so mod_removeip.la clean: rm -rf *~ *.o *.so *.lo *.la *.slo .libs/ libapache-mod-removeip-1.0b/apache1.3/0000755000175000017500000000000010467430572016424 5ustar micahmicahlibapache-mod-removeip-1.0b/apache1.3/mod_removeip.c0000644000175000017500000000507010466650076021261 0ustar micahmicah #include "httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" #include "http_vhost.h" module MODULE_VAR_EXPORT removeip_module; typedef struct { int enable; } removeip_server_cfg; static void *removeip_create_server_cfg(pool *p, server_rec *s) { removeip_server_cfg *cfg = (removeip_server_cfg *)ap_pcalloc(p, sizeof(removeip_server_cfg)); if (!cfg) return NULL; cfg->enable = 0; return (void *)cfg; } static const char *removeip_enable(cmd_parms *cmd, void *dummy, int flag) { server_rec *s = cmd->server; removeip_server_cfg *cfg = (removeip_server_cfg *)ap_get_module_config(s->module_config, &removeip_module); cfg->enable = flag; return NULL; } static int change_remote_ip(request_rec *r) { const char *fwdvalue; char *val; removeip_server_cfg *cfg = (removeip_server_cfg *)ap_get_module_config(r->server->module_config, &removeip_module); if (!cfg->enable) return DECLINED; r->connection->remote_ip = ap_pstrdup(r->connection->pool, "localhost"); r->connection->remote_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); return DECLINED; } static command_rec removeip_cmds[] = { { "REMOVEIPenable", removeip_enable, NULL, RSRC_CONF, FLAG, "Enable mod_removeip" }, { NULL } }; module MODULE_VAR_EXPORT removeip_module = { STANDARD_MODULE_STUFF, NULL, /* initializer */ NULL, /* dir config creator */ NULL, /* dir config merger */ removeip_create_server_cfg, /* server config */ NULL, /* merge server config */ removeip_cmds, /* command table */ NULL, /* handlers */ NULL, /* filename translation */ NULL, /* check_user_id */ NULL, /* check auth */ NULL, /* check access */ NULL, /* type_checker */ NULL, /* fixups */ NULL, /* logger */ NULL, /* header parser */ NULL, /* child_init */ NULL, /* child_exit */ change_remote_ip /* post read-request */ }; libapache-mod-removeip-1.0b/apache1.3/Makefile0000644000175000017500000000122610466650076020067 0ustar micahmicah# Makefile for mod_removeip.c (gmake) # $Id:$ #APXS=/path/to/your/apxs APXS=`which apxs` default: @echo mod_removeip: @echo author: andrew@scoop.co.nz @echo @echo following options available: @echo \"make removeip\" to compile the 1.3 version @echo \"make install\" to install the 1.3 version @echo @echo change path to apxs if this is not it: \"$(APXS)\" removeip: mod_removeip.so @echo make done, type \"make install\" to install mod_removeip mod_removeip.so: mod_removeip.c $(APXS) -c -o $@ mod_removeip.c mod_removeip.c: install: mod_removeip.so $(APXS) -i -n mod_removeip mod_removeip.so clean: rm -rf *~ *.o *.so *.lo *.la *.slo .libs/ libapache-mod-removeip-1.0b/CHANGES0000644000175000017500000000075210467427035015760 0ustar micahmicah1.0b Removed the debian folder 1.0a Arranged the apache 1.3 and 2.0 stuff into subdirectories so that the .c file could have the same name in each case. This is tidier since the .c file's name turns up in the apache config. This module has been running for a while now on cat.org.au's servers so I figure once the files have been tidied up just a little, it can be called a 1.0 release. 0.2 Added Apache 2 compatibility 0.1 first version to be distributed libapache-mod-removeip-1.0b/README0000644000175000017500000000275010466650076015647 0ustar micahmicahmod_removeip - remove information about the remote IP This module throws away the information on the remote IP and hostname right at the beginning of handling the request. That means its not logged, is not available to any web apps, and can't leak into error logs and the like. This is written for use on servers with a strict policy on protecting the identity of their users. If the Spooks come and demand that you hand over your server so they can try to identify one of your users, this should be enough that you can categorically state that there is no IP info to be found, and might mean your server doesn't go offline. There is currently no facility for enabling the module on a per site or per directory basis. It's an all or nothing thing. This is because the intent is to make sure IP info is not on the server at all. If people want more configurability, I might release an alternative version. I've included some configuration files as they'd appear on a typical debian apache installation. They may be instructive for other distributions. There's talk of getting a .deb file put together shortly. Compile and Install for apache 1.3 cd apache1.3 make removeip make install Compile and Install for 2.0: cd apache1.3 make removeip make install Configuration Directives: REMOVEIPenable On # Enable module. Nothing happens without this directive. Author: Andrew McNaughton Based on code from mod_rpaf by Thomas Eibner License: Apache License