Move webserver configuration to nginx state
This commit is contained in:
parent
9a557fa69f
commit
c4dcf12a0a
5 changed files with 50 additions and 50 deletions
|
@ -36,3 +36,52 @@ nginx-common:
|
|||
- group: root
|
||||
- mode: 0750
|
||||
- makedirs: True
|
||||
|
||||
generate-dhparam-nginx:
|
||||
cmd.run:
|
||||
- name: openssl dhparam -out {{ nginx_ssl_keydir }}/dhparams.pem 2048
|
||||
- umask: 022
|
||||
- runas: root
|
||||
- timeout: 300
|
||||
- output_loglevel: debug
|
||||
- creates: {{ nginx_ssl_keydir }}/dhparams.pem
|
||||
- require:
|
||||
- file: {{ nginx_ssl_keydir }}
|
||||
- require_in:
|
||||
- file: /etc/nginx/conf.d/ssl.conf
|
||||
- watch_in:
|
||||
- service: nginx
|
||||
|
||||
/etc/nginx/conf.d/ssl.conf:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0644
|
||||
- source: salt://nginx/nginx-ssl.conf
|
||||
- template: jinja
|
||||
- require:
|
||||
- pkg: nginx
|
||||
- watch_in:
|
||||
- service: nginx
|
||||
|
||||
/etc/nginx/snippets/security.conf:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0644
|
||||
- source: salt://nginx/nginx-security.conf
|
||||
- require:
|
||||
- pkg: nginx
|
||||
- watch_in:
|
||||
- service: nginx
|
||||
|
||||
/etc/nginx/conf.d/logformat.conf:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0644
|
||||
- source: salt://nginx/nginx-logformat.conf
|
||||
- require:
|
||||
- pkg: nginx
|
||||
- watch_in:
|
||||
- service: nginx
|
||||
|
|
4
states/nginx/nginx-logformat.conf
Normal file
4
states/nginx/nginx-logformat.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
log_format main '$remote_addr - $remote_user [$time_local] '
|
||||
'$server_name '
|
||||
'"$request" $status $body_bytes_sent '
|
||||
'"$http_referer" "$http_user_agent"';
|
19
states/nginx/nginx-security.conf
Normal file
19
states/nginx/nginx-security.conf
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Security - Basic configuration
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Deny access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
15
states/nginx/nginx-ssl.conf
Normal file
15
states/nginx/nginx-ssl.conf
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Default TLS settings
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers kEECDH+AESGCM:kEECDH+AES:kEECDH:EDH+AESGCM:kEDH+AES:kEDH:AESGCM:ALL:!LOW:!EXP:!MD5:!aNULL:!eNULL:!RC4:!DSS;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
|
||||
ssl_dhparam {{ salt['pillar.get']('nginx:sslkeydir', '/etc/nginx/ssl/private') }}/dhparams.pem;
|
||||
|
||||
# OCSP stapling
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
|
||||
# use Google's DNS
|
||||
resolver 8.8.8.8;
|
||||
resolver_timeout 5s;
|
Loading…
Add table
Add a link
Reference in a new issue