ssl config creation in nginx role
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
vincent 2022-02-20 15:17:38 +01:00
parent a56ef7e007
commit 1d8469863f
3 changed files with 22 additions and 4 deletions

View File

@ -86,7 +86,9 @@ nginx_log_format: |-
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"' '"$http_user_agent" "$http_x_forwarded_for"'
nginx_realIP_Proxy: nginx_realIP_Proxy:
nginx_logrotate_number: 4 nginx_logrotate_number: 4
## weekly,dailly.. ## weekly,dailly..
nginx_logrotate_period: "weekly" nginx_logrotate_period: "weekly"
nginx_ssl_cert_name:
nginx_conf_path: /etc/nginx/conf.d/

View File

@ -55,12 +55,18 @@
- name: Apply logrotate file - name: Apply logrotate file
template: template:
dest: /etc/logrotate.d/nginx dest: /etc/logrotate.d/nginx
src: logrotate/nginx.j2 src: logrotate/nginx.j2
- name: create nginx config ssl file
template:
mode: 0750
dest: "{{ nginx_conf_path }}/{{ nginx_ssl_cert_name }}.ssl"
src: nginx_ssl_config.j2
when: nginx_ssl_cert_name is defined
- name: Ensure nginx is started and enabled to start at boot. - name: Ensure nginx is started and enabled to start at boot.
service: service:
name: nginx name: nginx
state: started state: started
enabled: yes enabled: yes

View File

@ -0,0 +1,10 @@
ssl_certificate /etc/ssl/{{ nginx_ssl_cert_name }}/fullchain.pem;
ssl_certificate_key /etc/ssl/{{ nginx_ssl_cert_name }}/privkey.pem;
ssl_session_cache shared:le_nginx_SSL:10m;
ssl_session_timeout 1440m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;