"Get IP from HTTP_CLIENT IP or X-Forwarded-For"), AP_INIT_FLAG("GeoIPUseFirstNonPrivateXForwardedForIP", geoip_use_first_non_private_x_forwarded_for_ip, NULL, RSRC_CONF, "For more IP's in X-Forwarded-For, use the first non private IP"), AP_INIT_FLAG("GeoIPUseFirstXForwardedForIP", geoip_use_first_x_forwarded_for_ip, NULL, RSRC_CONF, "For more IP's in X-Forwarded-For, use the first"), AP_INIT_FLAG("GeoIPUseLastXForwardedForIP", geoip_use_last_x_forwarded_for_ip, NULL, RSRC_CONF, "For more IP's in X-Forwarded-For, use the last"), AP_INIT_FLAG("GeoIPEnable", set_geoip_enable, NULL, RSRC_CONF | OR_FILEINFO, "Turn on mod_geoip"), AP_INIT_FLAG("GeoIPEnableUTF8", set_geoip_enable_utf8, NULL, RSRC_CONF, "Turn on utf8 characters for city names"), AP_INIT_TAKE12("GeoIPDBFile", set_geoip_filename, NULL, RSRC_CONF, "Path to GeoIP Data File"), AP_INIT_ITERATE("GeoIPOutput", set_geoip_output_mode, NULL, RSRC_CONF, "Specify output method(s)"), {NULL} }; static void geoip_register_hooks(apr_pool_t * p) { /* make sure we run before mod_rewrite's handler */ static const char *const aszSucc[] = { "mod_setenvif.c", "mod_rewrite.c", NULL }; /* we have two entry points, the header_parser hook, right before * the authentication hook used for Dirctory specific enabled geoiplookups * or right before directory rewrite rules. */
dbm_auth_config_rec *conf = dir_config; conf->auth_dbmtype = apr_pstrdup(cmd->pool, arg); return NULL; } static const command_rec dbm_auth_cmds[] = { AP_INIT_TAKE1("AuthDBMUserFile", ap_set_file_slot, (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmpwfile), OR_AUTHCFG, "dbm database file containing user IDs and passwords"), AP_INIT_TAKE1("AuthDBMGroupFile", ap_set_file_slot, (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmgrpfile), OR_AUTHCFG, "dbm database file containing group names and member user IDs"), AP_INIT_TAKE12("AuthUserFile", set_dbm_slot, (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmpwfile), OR_AUTHCFG, NULL), AP_INIT_TAKE12("AuthGroupFile", set_dbm_slot, (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmgrpfile), OR_AUTHCFG, NULL), AP_INIT_TAKE1("AuthDBMType", set_dbm_type, NULL, OR_AUTHCFG, "what type of DBM file the user file is"), AP_INIT_FLAG("AuthDBMAuthoritative", ap_set_flag_slot, (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmauthoritative), OR_AUTHCFG, "Set to 'no' to allow access control to be passed along to lower modules, if the UserID is not known in this module"), {NULL} }; module AP_MODULE_DECLARE_DATA auth_dbm_module;
AP_INIT_TAKE12("mruby" #dir_name "Last", set_mod_mruby_##hook##_last, NULL, RSRC_CONF | ACCESS_CONF, "hook Ruby file for " #hook " last phase."), static const command_rec mod_mruby_cmds[] = { AP_INIT_TAKE1("mrubyHandlerCode", set_mod_mruby_handler_inline, NULL, RSRC_CONF | ACCESS_CONF, "hook inline code for handler phase."), MOD_MRUBY_SET_ALL_CMDS_INLINE(handler, Handler) MOD_MRUBY_SET_ALL_CMDS_INLINE(post_read_request, PostReadRequest) MOD_MRUBY_SET_ALL_CMDS_INLINE(translate_name, TranslateName) MOD_MRUBY_SET_ALL_CMDS_INLINE(map_to_storage, MapToStorage) MOD_MRUBY_SET_ALL_CMDS_INLINE(access_checker, AccessChecker) MOD_MRUBY_SET_ALL_CMDS_INLINE(check_user_id, CheckUserId) MOD_MRUBY_SET_ALL_CMDS_INLINE(auth_checker, AuthChecker) MOD_MRUBY_SET_ALL_CMDS_INLINE(fixups, Fixups) MOD_MRUBY_SET_ALL_CMDS_INLINE(log_transaction, LogTransaction) AP_INIT_TAKE12("mrubyHandler", set_mod_mruby_handler, NULL, RSRC_CONF | ACCESS_CONF, "hook for handler phase."), MOD_MRUBY_SET_ALL_CMDS(handler, Handler) MOD_MRUBY_SET_ALL_CMDS(post_config, PostConfig) MOD_MRUBY_SET_ALL_CMDS(child_init, ChildInit) MOD_MRUBY_SET_ALL_CMDS(post_read_request, PostReadRequest) MOD_MRUBY_SET_ALL_CMDS(quick_handler, QuickHandler) MOD_MRUBY_SET_ALL_CMDS(translate_name, TranslateName) MOD_MRUBY_SET_ALL_CMDS(map_to_storage, MapToStorage) MOD_MRUBY_SET_ALL_CMDS(access_checker, AccessChecker) MOD_MRUBY_SET_ALL_CMDS(check_user_id, CheckUserId) MOD_MRUBY_SET_ALL_CMDS(auth_checker, AuthChecker) MOD_MRUBY_SET_ALL_CMDS(fixups, Fixups) MOD_MRUBY_SET_ALL_CMDS(insert_filter, InsertFilter) MOD_MRUBY_SET_ALL_CMDS(log_transaction, LogTransaction) //AP_INIT_TAKE1("mrubyCacheSize", set_mod_mruby_cache_table_size, NULL, RSRC_CONF | ACCESS_CONF, "set mruby cache table size."),
} static const char *set_authz_groupfile_slot(cmd_parms *cmd, void *offset, const char *f, const char *t) { if (t && strcmp(t, "standard")) { return apr_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL); } return ap_set_file_slot(cmd, offset, f); } static const command_rec authz_groupfile_cmds[] = { AP_INIT_TAKE12("AuthGroupFile", set_authz_groupfile_slot, (void *)APR_OFFSETOF(authz_groupfile_config_rec, groupfile), OR_AUTHCFG, "text file containing group names and member user IDs"), {NULL} }; module AP_MODULE_DECLARE_DATA authz_groupfile_module; #define VARBUF_INIT_LEN 512 #define VARBUF_MAX_LEN (16*1024*1024) static apr_status_t groups_for_user(apr_pool_t *p, char *user, char *grpfile, apr_table_t ** out) { ap_configfile_t *f; apr_table_t *grps = apr_table_make(p, 15); apr_pool_t *sp; struct ap_varbuf vb;
conf->chain = savelink = newlink; } } } else if (add->chain) { conf->chain = add->chain; } else { conf->chain = base->chain; } return conf; } static const command_rec filter_cmds[] = { AP_INIT_TAKE12("FilterDeclare", filter_declare, NULL, OR_OPTIONS, "filter-name [filter-type]"), AP_INIT_TAKE3("FilterProvider", filter_provider, NULL, OR_OPTIONS, "filter-name provider-name match-expression"), AP_INIT_ITERATE("FilterChain", filter_chain, NULL, OR_OPTIONS, "list of filter names with optional [+-=!@]"), AP_INIT_TAKE2("FilterTrace", filter_debug, NULL, RSRC_CONF | ACCESS_CONF, "filter-name debug-level"), AP_INIT_TAKE_ARGV("AddOutputFilterByType", filter_bytype, NULL, OR_FILEINFO, "output filter name followed by one or more content-types"), #ifndef NO_PROTOCOL AP_INIT_TAKE23("FilterProtocol", filter_protocol, NULL, OR_OPTIONS, "filter-name [provider-name] protocol-args"), #endif { NULL } };
return caucho_status(r); } if (config->session_url_prefix) { return cse_strip(r); } return DECLINED; } /* * Only needed configuration is pointer to resin.conf */ static command_rec caucho_commands[] = { AP_INIT_TAKE12("ResinConfigServer", resin_config_server_command, NULL, RSRC_CONF|ACCESS_CONF, "Adds a configuration server."), AP_INIT_TAKE12("ResinHost", cse_host_command, NULL, RSRC_CONF|ACCESS_CONF, "Configures a cluster host for manual configuration."), AP_INIT_TAKE12("ResinBackup", cse_backup_command, NULL, RSRC_CONF|ACCESS_CONF, "Configures a cluster host for manual configuration."), AP_INIT_TAKE1("ResinConfigCacheDirectory", resin_config_cache_command, NULL, RSRC_CONF|ACCESS_CONF, "Configures the saved configuration file."), AP_INIT_TAKE1("ResinSessionCookie", resin_session_cookie_command, NULL, RSRC_CONF|ACCESS_CONF, "Configures the session cookie."), AP_INIT_TAKE1("ResinSessionSticky", resin_session_sticky_command, NULL, RSRC_CONF|ACCESS_CONF,
s = s->next; } } /*--------------------------------------------------------------------------*/ /* */ /* List of directives specific to our module. */ /* */ /*--------------------------------------------------------------------------*/ static const command_rec cmd_table[] = { AP_INIT_TAKE12( "ServerAdvertise", /* directive name */ cmd_advertise_m, /* config action routine */ NULL, /* argument to include in call */ RSRC_CONF, /* where available */ "Server advertise mode: On | Off [Address]" ), AP_INIT_TAKE1( "AdvertiseGroup", /* directive name */ cmd_advertise_g, /* config action routine */ NULL, /* argument to include in call */ RSRC_CONF, /* where available */ "Multicast group address" ), AP_INIT_TAKE1( "AdvertiseFrequency", /* directive name */ cmd_advertise_f, /* config action routine */ NULL, /* argument to include in call */ RSRC_CONF, /* where available */
static const char *set_authn_set_int(cmd_parms *cmd, void *offset, const char *f ) { return ap_set_int_slot(cmd, offset, f); } static const char *set_authn_set_string(cmd_parms *cmd, void *offset, const char *f ) { return ap_set_string_slot(cmd, offset, f); } static const command_rec authn_google_cmds[] = { AP_INIT_TAKE12("GoogleAuthUserPath", set_authn_google_slot, (void *)APR_OFFSETOF(authn_google_config_rec, pwfile), OR_AUTHCFG, "Directory containing Google Authenticator credential files"), AP_INIT_TAKE1("GoogleAuthCookieLife", set_authn_set_int, (void *)APR_OFFSETOF(authn_google_config_rec, cookieLife), OR_AUTHCFG, "Life (in seconds) authentication cookie before revalidation required"), AP_INIT_TAKE1("GoogleAuthLogLevel", set_authn_set_int, (void *)APR_OFFSETOF(authn_google_config_rec, debugLevel), OR_AUTHCFG, "Verbosity level of debug output (zero=off)"), AP_INIT_TAKE1("GoogleAuthEntryWindow", set_authn_set_int, (void *)APR_OFFSETOF(authn_google_config_rec, entryWindow), OR_AUTHCFG, "Enable authentication cookies with lifespan given in seconds"), AP_INIT_TAKE1("GoogleAuthDomain", set_authn_set_string, (void *)APR_OFFSETOF(authn_google_config_rec, domain), OR_AUTHCFG, "Custom domain to be set for the authentication cookie"), AP_INIT_TAKE1("GoogleAuthPath", set_authn_set_string, (void *)APR_OFFSETOF(authn_google_config_rec, path),
{ buffered_logs = flag; if (buffered_logs) { ap_log_set_writer_init(ap_buffered_log_writer_init); ap_log_set_writer(ap_buffered_log_writer); } return NULL; } static const command_rec config_log_cmds[] = { AP_INIT_TAKE23("CustomLog", add_custom_log, NULL, RSRC_CONF, "a file name, a custom log format string or format name, " "and an optional \"env=\" clause (see docs)"), AP_INIT_TAKE1("TransferLog", set_transfer_log, NULL, RSRC_CONF, "the filename of the access log"), AP_INIT_TAKE12("LogFormat", log_format, NULL, RSRC_CONF, "a log format string (see docs) and an optional format name"), AP_INIT_TAKE1("CookieLog", set_cookie_log, NULL, RSRC_CONF, "the filename of the cookie log"), AP_INIT_FLAG("BufferedLogs", set_buffered_logs_on, NULL, RSRC_CONF, "Enable Buffered Logging (experimental)"), {NULL} }; static config_log_state *open_config_log(server_rec *s, apr_pool_t *p, config_log_state *cls, apr_array_header_t *default_format) { if (cls->log_writer != NULL) { return cls; /* virtual config shared w/main server */ }
} static const char *set_authn_file_slot(cmd_parms *cmd, void *offset, const char *f, const char *t) { if (t && strcmp(t, "standard")) { return apr_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL); } return ap_set_file_slot(cmd, offset, f); } static const command_rec authn_file_cmds[] = { AP_INIT_TAKE12("AuthUserFile", set_authn_file_slot, (void *)APR_OFFSETOF(authn_file_config_rec, pwfile), OR_AUTHCFG, "text file containing user IDs and passwords"), {NULL} }; module AP_MODULE_DECLARE_DATA authn_file_module; static authn_status check_password(request_rec *r, const char *user, const char *password) { #ifndef APACHE2NGINX authn_file_config_rec *conf = ap_get_module_config(r->per_dir_config, &authn_file_module); ap_configfile_t *f; char l[MAX_STRING_LEN]; apr_status_t status;
} static const char *set_auth_slot(cmd_parms *cmd, void *offset, const char *f, const char *t) { if (t && strcmp(t, "standard")) { return apr_pstrcat(cmd->pool, "Invalid auth file type: ", t, NULL); } return ap_set_file_slot(cmd, offset, f); } static const command_rec auth_cmds[] = { AP_INIT_TAKE12("AuthUserFile", set_auth_slot, (void *)APR_OFFSETOF(auth_config_rec, auth_pwfile), OR_AUTHCFG, "text file containing user IDs and passwords"), AP_INIT_TAKE12("AuthGroupFile", set_auth_slot, (void *)APR_OFFSETOF(auth_config_rec, auth_grpfile), OR_AUTHCFG, "text file containing group names and member user IDs"), AP_INIT_FLAG("AuthAuthoritative", ap_set_flag_slot, (void *)APR_OFFSETOF(auth_config_rec, auth_authoritative), OR_AUTHCFG, "Set to 'no' to allow access control to be passed along to " "lower modules if the UserID is not known to this module"), {NULL} }; module AP_MODULE_DECLARE_DATA auth_module;
static void * createModAuthPredatorConfig(apr_pool_t *p, char *d) { AuthPredatorConfig * config = apr_palloc(p,sizeof(*config)); config->url = NULL; //Gdzie ma się łączyć config->port = 8443; //Standardowy port config->service = NULL; //Usługa do której ma być logowany return config; } static const command_rec authn_file_cmds[] = { AP_INIT_TAKE12("AuthUserFile", ap_set_string_slot, (void *)APR_OFFSETOF(AuthPredatorConfig, url), OR_AUTHCFG, "text file containing user IDs and passwords"), {NULL} }; //static const command_rec auth_predator_commands[] = //{ //AP_INIT_TAKE12("PredatorHost", ap_set_string_slot, //(*void)APR_OFFSETOF(AuthPredatorConfig,url),OR_AUTHCFG, //"Adres demona Predatora. Bez niego nie można wysyłać mu chikenów."), //AP_INIT_TAKE1("PredatorService", ap_set_string_slot, //(*void)APR_OFFSETOF(AuthPredatorConfig,service),OR_AUTHCFG, //"Nazwa usługi pod jaką ma być zautoryzowany"), //{NULL}
/* Always UnsetEnv FOO in the same context as {Set,Pass}Env FOO * only if this UnsetEnv follows the {Set,Pass}Env. The merge * will only apply unsetenv to the parent env (main server). */ apr_table_set(sconf->unsetenv, arg, NULL); apr_table_unset(sconf->vars, arg); return NULL; } static const command_rec env_module_cmds[] = { AP_INIT_ITERATE("PassEnv", add_env_module_vars_passed, NULL, OR_FILEINFO, "a list of environment variables to pass to CGI."), AP_INIT_TAKE12("SetEnv", add_env_module_vars_set, NULL, OR_FILEINFO, "an environment variable name and optional value to pass to CGI."), AP_INIT_ITERATE("UnsetEnv", add_env_module_vars_unset, NULL, OR_FILEINFO, "a list of variables to remove from the CGI environment."), {NULL}, }; static int fixup_env_module(request_rec *r) { env_dir_config_rec *sconf = ap_get_module_config(r->per_dir_config, &env_module); if (apr_is_empty_table(sconf->vars)) { return DECLINED; } r->subprocess_env = apr_table_overlay(r->pool, r->subprocess_env,
/* add a backend timeout */ static const char *add_backend_timeout(cmd_parms *cmd, void *dummy, const char *timeout_string); /* hook registering function */ static void wodan2_register_hooks(apr_pool_t *p); /* The content handler function. This is the main function of Wodan2 */ static int wodan2_handler(request_rec *r); /** * The configuration directives and their setup functions. */ static const command_rec wodan2_commands[] = { AP_INIT_TAKE12("WodanPass", add_pass, NULL, RSRC_CONF, "A path and a URL"), AP_INIT_TAKE12("WodanPassReverse", add_pass_reverse, NULL, RSRC_CONF, "A path and a URL"), AP_INIT_TAKE1("WodanCacheDir", add_cachedir, NULL, RSRC_CONF, "A path"), AP_INIT_TAKE1("WodanCacheDirLevels", add_cachedir_levels, NULL, RSRC_CONF, "A Number (> 0)"), AP_INIT_TAKE2("WodanDefaultCacheTime", add_default_cachetime, NULL, RSRC_CONF, "A path and a time string"), AP_INIT_TAKE2("WodanDefaultCacheTimeMatch", add_default_cachetime_regex, NULL, RSRC_CONF, "A regex pattern and a time string"), AP_INIT_TAKE3("WodanDefaultCacheTimeHeaderMatch", add_default_cachetime_header, NULL, RSRC_CONF, "A header, a regex pattern and a time string"), AP_INIT_FLAG("WodanRunOnCache", add_run_on_cache, NULL, RSRC_CONF, "run completely on cache"), AP_INIT_FLAG("WodanCache404s", add_cache_404s, NULL, RSRC_CONF,
} else { /* Per-server context */ scfg->type = SET_VLIMITFILE; scfg->file_limit = limit; scfg->full_path = apr_pstrdup(parms->pool, arg_opt1); } return NULL; } /* ------------------------ */ /* --- Command_rec Array--- */ /* ------------------------ */ static command_rec vlimit_cmds[] = { AP_INIT_TAKE12("VlimitIP", set_vlimitip, NULL, OR_LIMIT|RSRC_CONF, "maximum connections per IP address to DocumentRoot"), AP_INIT_TAKE12("VlimitFile", set_vlimitfile, NULL, OR_LIMIT|RSRC_CONF, "maximum connections per File to DocumentRoot"), {NULL}, }; /* ------------------------------------------- */ /* --- Init Routine or ap_hook_post_config --- */ /* ------------------------------------------- */ /* Set up startup-time initialization */ static int vlimit_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { VLIMIT_DEBUG_SYSLOG("vlimit_init: ", MODULE_NAME " " MODULE_VERSION " started.", p); if(apr_file_open(&vlimit_log_fp, VLIMIT_LOG_FILE, APR_WRITE|APR_APPEND|APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS){
lflags |= AP_REG_ICASE; } if ( rule->flags & M_NEWLINE ) { lflags |= AP_REG_NEWLINE; } rule->from.r = ap_pregcomp(cmd->pool, from, lflags) ; } else { lflags = (rule->flags & M_NOCASE) ? 0 : 1 ; rule->length = strlen(from) ; rule->from.s = apr_strmatch_precompile(cmd->pool, from, lflags) ; } return NULL; } static const command_rec line_edit_cmds[] = { AP_INIT_TAKE12("LELineEnd", line_edit_lineend, NULL, OR_ALL, "Use line ending: UNIX|MAC|DOS|ANY|NONE|CUSTOM [char]") , AP_INIT_TAKE23("LERewriteRule", line_edit_rewriterule, NULL, OR_ALL, "Line-oriented text rewrite rule: From-pattern, To-pattern [, Flags]") , {NULL} } ; static void* line_edit_cr_cfg(apr_pool_t* pool, char* x) { line_edit_cfg* ret = apr_palloc(pool, sizeof(line_edit_cfg)) ; ret->lineend = LINEEND_UNSET; ret->rewriterules = apr_array_make(pool, 8, sizeof(rewriterule)) ; ret->lechar = 0; return ret ; } static void* line_edit_merge(apr_pool_t* pool, void* BASE, void* ADD) { line_edit_cfg* base = (line_edit_cfg*) BASE ; line_edit_cfg* add = (line_edit_cfg*) ADD ; line_edit_cfg* conf = apr_palloc(pool, sizeof(line_edit_cfg)) ;
if (NULL != offs) { /* Offset in minutes */ ls->offset = APR_USEC_PER_SEC * 60 * (apr_time_t) atol(offs); } return NULL; } static const command_rec rotate_log_cmds[] = { AP_INIT_FLAG( "RotateLogs", set_rotated_logs, NULL, RSRC_CONF, "Enable rotated logging"), AP_INIT_FLAG( "RotateLogsLocalTime", set_localtime, NULL, RSRC_CONF, "Rotate relative to local time"), AP_INIT_TAKE12("RotateInterval", set_interval, NULL, RSRC_CONF, "Set rotation interval in seconds with" " optional offset in minutes"), {NULL} }; static void *make_log_options(apr_pool_t *p, server_rec *s) { log_options *ls; ls = (log_options *) apr_palloc(p, sizeof(log_options)); ls->enabled = 1; ls->interval = INTERVAL_DEFAULT; ls->offset = 0; ls->localt = 0; return ls; }
AP_INIT_ITERATE("CDNHTMLFromServers", set_fromservers, NULL, RSRC_CONF | ACCESS_CONF, "Set server names that will be replaced by CDNHTMLMapServer"), AP_INIT_TAKE1("CDNHTMLToServer", ap_set_string_slot, (void *)APR_OFFSETOF(cdn_conf, to_server), RSRC_CONF | ACCESS_CONF, "Set destination server name for CDNHTMLRemapURLServer"), AP_INIT_RAW_ARGS("CDNHTMLRemapURLServer", set_serverremap, NULL, RSRC_CONF | ACCESS_CONF, "Convert matching URLs to come from a different server"), AP_INIT_ITERATE("CDNHTMLContentType", set_content_type, NULL, RSRC_CONF | ACCESS_CONF, "Declare content types that will be parsed for CDNification as HTML"), AP_INIT_TAKE12("CDNHTMLDocType", set_doctype, NULL, RSRC_CONF|ACCESS_CONF, "(HTML|XHTML) [Legacy]"), AP_INIT_TAKE1("CDNHTMLCharsetDefault", set_charset_default, NULL, RSRC_CONF|ACCESS_CONF, "Set default input/output character set"), AP_INIT_ITERATE("CDNHTMLStartParse", set_skipto, NULL, RSRC_CONF | ACCESS_CONF, "Ignore anything in front of the first of these elements"), AP_INIT_ITERATE2("CDNHTMLLinks", set_links, NULL, RSRC_CONF | ACCESS_CONF, "Declare HTML Attributes"), AP_INIT_TAKE1("CDNHTMLBufSize", ap_set_int_slot, (void *) APR_OFFSETOF(cdn_conf, bufsz), RSRC_CONF | ACCESS_CONF, "Buffer size"), AP_INIT_TAKE1("CDNAuthKey", ap_set_string_slot,