-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe2fd6
commit 6493c28
Showing
5 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
|
||
{% if cnf.security.restrict_methods | bool and cnf.security.allow_only_methods | length > 0 %} | ||
http-request deny status 405 default-errorfiles if !{ method {{ cnf.security.allow_only_methods | join(' ') }} } | ||
{% elif cnf.security.deny_dangerous_methods | bool %} | ||
http-request deny status 405 default-errorfiles if { method TRACE CONNECT } | ||
{% endif %} | ||
|
||
{% if cnf.security.block_script_bots | bool %} | ||
# block well-known script-bots | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if !{ req.fhdr(User-Agent) -m found } | ||
{% if HAPROXY_HC.user_agents.script.full | length > 0 %} | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m str -i {{ HAPROXY_HC.user_agents.script.full | ensure_list | join(' ') }} } | ||
{% endif %} | ||
{% if HAPROXY_HC.user_agents.script.sub | length > 0 %} | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m sub -i {{ HAPROXY_HC.user_agents.script.sub | ensure_list | join(' ') }} } | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m sub -i {{ HAPROXY_HC.user_agents.script.sub | ensure_list | join(' ') }} } | ||
{% endif %} | ||
{% endif %} | ||
{% if cnf.security.block_bad_crawler_bots | bool %} | ||
# block well-known bad-crawler-bots | ||
{% if HAPROXY_HC.user_agents.bad_crawlers.full | length > 0 %} | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m str -i {{ HAPROXY_HC.user_agents.bad_crawlers.full | ensure_list | join(' ') }} } | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m str -i {{ HAPROXY_HC.user_agents.bad_crawlers.full | ensure_list | join(' ') }} } | ||
{% endif %} | ||
{% if HAPROXY_HC.user_agents.bad_crawlers.sub | length > 0 %} | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m sub -i {{ HAPROXY_HC.user_agents.bad_crawlers.sub | ensure_list | join(' ') }} } | ||
http-request deny status {{ cnf.security.block_status_code }} default-errorfiles if { req.fhdr(User-Agent) -m sub -i {{ HAPROXY_HC.user_agents.bad_crawlers.sub | ensure_list | join(' ') }} } | ||
{% endif %} | ||
{% endif %} |