kopia lustrzana https://github.com/alecmuffett/eotk
commit: more brevity in generated code
rodzic
c5b1a4cfa5
commit
446b79f61e
|
@ -39,7 +39,7 @@ sub blackwhite {
|
|||
push(@black, "$condition { %NGINX_ACTION_ABORT%; }\n");
|
||||
push(@black, "%%ENDCSV\n");
|
||||
push(@black, "%%ELSE\n");
|
||||
push(@black, "# no $lc_bl $warning\n");
|
||||
push(@black, "# no $lc_bl\n");
|
||||
push(@black, "%%ENDIF\n");
|
||||
|
||||
push(@white, "%%IF %$uc_wl%\n");
|
||||
|
@ -49,14 +49,14 @@ sub blackwhite {
|
|||
push(@white, "$condition { set $flag 0; }\n");
|
||||
push(@white, "%%ENDCSV\n");
|
||||
push(@white, "%%ELSE\n");
|
||||
push(@white, "# no $lc_wl $warning\n");
|
||||
push(@white, "# no $lc_wl\n");
|
||||
push(@white, "%%ENDIF\n");
|
||||
|
||||
push(@tail, "%%IF %$uc_wl%\n");
|
||||
push(@tail, "# check success of $lc_wl $warning\n");
|
||||
push(@tail, "if ( $flag ) { %NGINX_ACTION_ABORT%; }\n");
|
||||
push(@tail, "%%ELSE\n");
|
||||
push(@tail, "# no check for success of $lc_wl $warning\n");
|
||||
push(@tail, "# no $lc_wl\n");
|
||||
push(@tail, "%%ENDIF\n");
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ while (<DATA>) {
|
|||
push(@polite, "$condition { return 403 \"%BLOCK_ERR%\"; }\n");
|
||||
push(@polite, "%%ENDCSV\n");
|
||||
push(@polite, "%%ELSE\n");
|
||||
push(@polite, "# no polite block for $lc_what $warning\n");
|
||||
push(@polite, "# no $lc_what\n");
|
||||
push(@polite, "%%ENDIF\n");
|
||||
}
|
||||
elsif ($how eq "redirect") {
|
||||
|
@ -92,7 +92,7 @@ while (<DATA>) {
|
|||
push(@redirect, "$condition { return %3% %2%\$request_uri; }\n");
|
||||
push(@redirect, "%%ENDCSV\n");
|
||||
push(@redirect, "%%ELSE\n");
|
||||
push(@redirect, "# no redirect $lc_what $warning\n");
|
||||
push(@redirect, "# no $lc_what\n");
|
||||
push(@redirect, "%%ENDIF\n");
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
if ( $http_x_tor2web ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for suppress_tor2web (generated)
|
||||
# no suppress_tor2web
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_HOST%
|
||||
# polite block for block_host (generated)
|
||||
|
@ -15,7 +15,7 @@
|
|||
if ( $host = "%0%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_host (generated)
|
||||
# no block_host
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_HOST_RE%
|
||||
# polite block for block_host_re (generated)
|
||||
|
@ -23,7 +23,7 @@
|
|||
if ( $host ~* "%0%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_host_re (generated)
|
||||
# no block_host_re
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_PATH%
|
||||
# polite block for block_path (generated)
|
||||
|
@ -31,7 +31,7 @@
|
|||
if ( $uri = "%0%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_path (generated)
|
||||
# no block_path
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_PATH_RE%
|
||||
# polite block for block_path_re (generated)
|
||||
|
@ -39,7 +39,7 @@
|
|||
if ( $uri ~* "%0%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_path_re (generated)
|
||||
# no block_path_re
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_LOCATION%
|
||||
# polite block for block_location (generated)
|
||||
|
@ -47,7 +47,7 @@
|
|||
location %0% { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_location (generated)
|
||||
# no block_location
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_LOCATION_RE%
|
||||
# polite block for block_location_re (generated)
|
||||
|
@ -55,7 +55,7 @@
|
|||
location ~* "%0%" { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_location_re (generated)
|
||||
# no block_location_re
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_PARAM%
|
||||
# polite block for block_param (generated)
|
||||
|
@ -63,7 +63,7 @@
|
|||
if ( $arg_%1% = "%2%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_param (generated)
|
||||
# no block_param
|
||||
%%ENDIF
|
||||
%%IF %BLOCK_PARAM_RE%
|
||||
# polite block for block_param_re (generated)
|
||||
|
@ -71,7 +71,7 @@
|
|||
if ( $arg_%1% ~* "%2%" ) { return 403 "%BLOCK_ERR%"; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no polite block for block_param_re (generated)
|
||||
# no block_param_re
|
||||
%%ENDIF
|
||||
|
||||
# blacklists (generated)
|
||||
|
@ -81,7 +81,7 @@
|
|||
if ( $http_user_agent = "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no user_agent_blacklist (generated)
|
||||
# no user_agent_blacklist
|
||||
%%ENDIF
|
||||
%%IF %USER_AGENT_BLACKLIST_RE%
|
||||
# check user_agent_blacklist_re (generated)
|
||||
|
@ -89,7 +89,7 @@
|
|||
if ( $http_user_agent ~* "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no user_agent_blacklist_re (generated)
|
||||
# no user_agent_blacklist_re
|
||||
%%ENDIF
|
||||
%%IF %REFERER_BLACKLIST%
|
||||
# check referer_blacklist (generated)
|
||||
|
@ -97,7 +97,7 @@
|
|||
if ( $http_referer = "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no referer_blacklist (generated)
|
||||
# no referer_blacklist
|
||||
%%ENDIF
|
||||
%%IF %REFERER_BLACKLIST_RE%
|
||||
# check referer_blacklist_re (generated)
|
||||
|
@ -105,7 +105,7 @@
|
|||
if ( $http_referer ~* "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no referer_blacklist_re (generated)
|
||||
# no referer_blacklist_re
|
||||
%%ENDIF
|
||||
%%IF %HOST_BLACKLIST%
|
||||
# check host_blacklist (generated)
|
||||
|
@ -113,7 +113,7 @@
|
|||
if ( $http_host = "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no host_blacklist (generated)
|
||||
# no host_blacklist
|
||||
%%ENDIF
|
||||
%%IF %HOST_BLACKLIST_RE%
|
||||
# check host_blacklist_re (generated)
|
||||
|
@ -121,7 +121,7 @@
|
|||
if ( $http_host ~* "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no host_blacklist_re (generated)
|
||||
# no host_blacklist_re
|
||||
%%ENDIF
|
||||
%%IF %PATH_BLACKLIST%
|
||||
# check path_blacklist (generated)
|
||||
|
@ -129,7 +129,7 @@
|
|||
if ( $uri = "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no path_blacklist (generated)
|
||||
# no path_blacklist
|
||||
%%ENDIF
|
||||
%%IF %PATH_BLACKLIST_RE%
|
||||
# check path_blacklist_re (generated)
|
||||
|
@ -137,7 +137,7 @@
|
|||
if ( $uri ~* "%0%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no path_blacklist_re (generated)
|
||||
# no path_blacklist_re
|
||||
%%ENDIF
|
||||
%%IF %PARAM_BLACKLIST%
|
||||
# check param_blacklist (generated)
|
||||
|
@ -145,7 +145,7 @@
|
|||
if ( $arg_%1% = "%2%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no param_blacklist (generated)
|
||||
# no param_blacklist
|
||||
%%ENDIF
|
||||
%%IF %PARAM_BLACKLIST_RE%
|
||||
# check param_blacklist_re (generated)
|
||||
|
@ -153,7 +153,7 @@
|
|||
if ( $arg_%1% ~* "%2%" ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no param_blacklist_re (generated)
|
||||
# no param_blacklist_re
|
||||
%%ENDIF
|
||||
|
||||
# redirects (generated)
|
||||
|
@ -163,7 +163,7 @@
|
|||
if ( $host ~* "%1%" ) { return %3% %2%$request_uri; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no redirect redirect_host_csv (generated)
|
||||
# no redirect_host_csv
|
||||
%%ENDIF
|
||||
%%IF %REDIRECT_PATH_CSV%
|
||||
# redirect redirect_path_csv: 1=regexp,2=dest,3=code (generated)
|
||||
|
@ -171,7 +171,7 @@
|
|||
if ( $uri ~* "%1%" ) { return %3% %2%$request_uri; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no redirect redirect_path_csv (generated)
|
||||
# no redirect_path_csv
|
||||
%%ENDIF
|
||||
%%IF %REDIRECT_LOCATION_CSV%
|
||||
# redirect redirect_location_csv: 1=regexp,2=dest,3=code (generated)
|
||||
|
@ -179,7 +179,7 @@
|
|||
location ~* "%1%" { return %3% %2%$request_uri; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no redirect redirect_location_csv (generated)
|
||||
# no redirect_location_csv
|
||||
%%ENDIF
|
||||
|
||||
# whitelists (generated)
|
||||
|
@ -190,7 +190,7 @@
|
|||
if ( $http_user_agent = "%0%" ) { set $non_whitelist_user_agent 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no user_agent_whitelist (generated)
|
||||
# no user_agent_whitelist
|
||||
%%ENDIF
|
||||
%%IF %USER_AGENT_WHITELIST_RE%
|
||||
# check user_agent_whitelist_re (generated)
|
||||
|
@ -199,7 +199,7 @@
|
|||
if ( $http_user_agent ~* "%0%" ) { set $non_whitelist_user_agent 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no user_agent_whitelist_re (generated)
|
||||
# no user_agent_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %REFERER_WHITELIST%
|
||||
# check referer_whitelist (generated)
|
||||
|
@ -208,7 +208,7 @@
|
|||
if ( $http_referer = "%0%" ) { set $non_whitelist_referer 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no referer_whitelist (generated)
|
||||
# no referer_whitelist
|
||||
%%ENDIF
|
||||
%%IF %REFERER_WHITELIST_RE%
|
||||
# check referer_whitelist_re (generated)
|
||||
|
@ -217,7 +217,7 @@
|
|||
if ( $http_referer ~* "%0%" ) { set $non_whitelist_referer 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no referer_whitelist_re (generated)
|
||||
# no referer_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %HOST_WHITELIST%
|
||||
# check host_whitelist (generated)
|
||||
|
@ -226,7 +226,7 @@
|
|||
if ( $http_host = "%0%" ) { set $non_whitelist_host 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no host_whitelist (generated)
|
||||
# no host_whitelist
|
||||
%%ENDIF
|
||||
%%IF %HOST_WHITELIST_RE%
|
||||
# check host_whitelist_re (generated)
|
||||
|
@ -235,7 +235,7 @@
|
|||
if ( $http_host ~* "%0%" ) { set $non_whitelist_host 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no host_whitelist_re (generated)
|
||||
# no host_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %PATH_WHITELIST%
|
||||
# check path_whitelist (generated)
|
||||
|
@ -244,7 +244,7 @@
|
|||
if ( $uri = "%0%" ) { set $non_whitelist_path 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no path_whitelist (generated)
|
||||
# no path_whitelist
|
||||
%%ENDIF
|
||||
%%IF %PATH_WHITELIST_RE%
|
||||
# check path_whitelist_re (generated)
|
||||
|
@ -253,7 +253,7 @@
|
|||
if ( $uri ~* "%0%" ) { set $non_whitelist_path 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no path_whitelist_re (generated)
|
||||
# no path_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %PARAM_WHITELIST%
|
||||
# check param_whitelist (generated)
|
||||
|
@ -262,7 +262,7 @@
|
|||
if ( $arg_%1% = "%2%" ) { set $non_whitelist_param 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no param_whitelist (generated)
|
||||
# no param_whitelist
|
||||
%%ENDIF
|
||||
%%IF %PARAM_WHITELIST_RE%
|
||||
# check param_whitelist_re (generated)
|
||||
|
@ -271,7 +271,7 @@
|
|||
if ( $arg_%1% ~* "%2%" ) { set $non_whitelist_param 0; }
|
||||
%%ENDCSV
|
||||
%%ELSE
|
||||
# no param_whitelist_re (generated)
|
||||
# no param_whitelist_re
|
||||
%%ENDIF
|
||||
|
||||
# ---- END GENERATED CODE ----
|
||||
|
|
|
@ -5,61 +5,61 @@
|
|||
# check success of user_agent_whitelist (generated)
|
||||
if ( $non_whitelist_user_agent ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of user_agent_whitelist (generated)
|
||||
# no user_agent_whitelist
|
||||
%%ENDIF
|
||||
%%IF %USER_AGENT_WHITELIST_RE%
|
||||
# check success of user_agent_whitelist_re (generated)
|
||||
if ( $non_whitelist_user_agent ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of user_agent_whitelist_re (generated)
|
||||
# no user_agent_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %REFERER_WHITELIST%
|
||||
# check success of referer_whitelist (generated)
|
||||
if ( $non_whitelist_referer ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of referer_whitelist (generated)
|
||||
# no referer_whitelist
|
||||
%%ENDIF
|
||||
%%IF %REFERER_WHITELIST_RE%
|
||||
# check success of referer_whitelist_re (generated)
|
||||
if ( $non_whitelist_referer ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of referer_whitelist_re (generated)
|
||||
# no referer_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %HOST_WHITELIST%
|
||||
# check success of host_whitelist (generated)
|
||||
if ( $non_whitelist_host ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of host_whitelist (generated)
|
||||
# no host_whitelist
|
||||
%%ENDIF
|
||||
%%IF %HOST_WHITELIST_RE%
|
||||
# check success of host_whitelist_re (generated)
|
||||
if ( $non_whitelist_host ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of host_whitelist_re (generated)
|
||||
# no host_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %PATH_WHITELIST%
|
||||
# check success of path_whitelist (generated)
|
||||
if ( $non_whitelist_path ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of path_whitelist (generated)
|
||||
# no path_whitelist
|
||||
%%ENDIF
|
||||
%%IF %PATH_WHITELIST_RE%
|
||||
# check success of path_whitelist_re (generated)
|
||||
if ( $non_whitelist_path ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of path_whitelist_re (generated)
|
||||
# no path_whitelist_re
|
||||
%%ENDIF
|
||||
%%IF %PARAM_WHITELIST%
|
||||
# check success of param_whitelist (generated)
|
||||
if ( $non_whitelist_param ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of param_whitelist (generated)
|
||||
# no param_whitelist
|
||||
%%ENDIF
|
||||
%%IF %PARAM_WHITELIST_RE%
|
||||
# check success of param_whitelist_re (generated)
|
||||
if ( $non_whitelist_param ) { %NGINX_ACTION_ABORT%; }
|
||||
%%ELSE
|
||||
# no check for success of param_whitelist_re (generated)
|
||||
# no param_whitelist_re
|
||||
%%ENDIF
|
||||
|
||||
# ---- END GENERATED CODE ----
|
||||
|
|
Ładowanie…
Reference in New Issue