Merge branch 'feature/disallow_dotfiles' into 'master'
disallow access to dotfiles besides .well-known by default Closes infra/documentation#115 See merge request infra/ansible/roles/nginx!2
This commit is contained in:
commit
3ef51e3be1
3 changed files with 13 additions and 0 deletions
|
|
@ -102,6 +102,9 @@ key: ~
|
|||
|
||||
# SSL certificat, mutally exclusive with letsencrypt option
|
||||
crt: ~
|
||||
|
||||
# Disallow access to dotfiles besides .well-known by default
|
||||
disallow_dotfiles: True
|
||||
```
|
||||
|
||||
**locationconfig**:
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ nginx_vhosts_defaults:
|
|||
add_proxy_headers: {}
|
||||
hide_proxy_headers: {}
|
||||
backend: ~
|
||||
disallow_dotfiles: True
|
||||
|
||||
nginx_streams_defaults:
|
||||
listen:
|
||||
|
|
|
|||
|
|
@ -86,6 +86,15 @@ server {
|
|||
}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% if vhost.disallow_dotfiles %}
|
||||
# disallow every path starting with a dot except .well-known/
|
||||
location ~ /\.(?!well-known\/).* {
|
||||
deny all;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if vhost.auth.enable %}
|
||||
auth_basic "restricted area";
|
||||
auth_basic_user_file {{ vhost.auth.path }};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue