|
1 | 1 | #### nginx-globals - https://github.com/philcryer/nginx-globals
|
2 | 2 |
|
3 | 3 | #### Security headers configured to protect against XSS and other web threats
|
4 |
| -#### Guided by Voices, I mean Securityheaders.com https://securityheaders.com/ - Thanks! |
5 |
| -add_header Cache-Control "public"; |
6 |
| -add_header X-Frame-Options "DENY"; |
7 |
| -add_header X-Frame-Options "SAMEORIGIN"; |
8 |
| -add_header X-XSS-Protection "1; mode=block"; |
9 |
| -add_header X-Content-Type-Options "nosniff"; |
10 |
| -add_header Content-Type "text/html; charset=UTF-8"; |
11 |
| -add_header X-Permitted-Cross-Domain-Policies "master-only"; |
| 4 | +#### these options setup with Securityheaders help. Thanks! https://securityheaders.com/ |
| 5 | +add_header Cache-Control "public"; |
| 6 | +add_header X-Frame-Options "DENY"; |
| 7 | +add_header X-Frame-Options "SAMEORIGIN"; |
| 8 | +add_header X-XSS-Protection "1; mode=block"; |
| 9 | +add_header X-Content-Type-Options "nosniff"; |
| 10 | +add_header Content-Type "text/html; charset=UTF-8"; |
| 11 | +add_header X-Permitted-Cross-Domain-Policies "master-only"; |
12 | 12 |
|
13 | 13 |
|
14 | 14 | #### Drop the Server: header
|
15 | 15 | #### install nginx-extras (debian, ubuntu) to add the more set headers module
|
16 |
| -#more_clear_headers 'Server:*'; |
| 16 | +#more_clear_headers 'Server:*'; |
17 | 17 | #### Bonus, reset the Server: header to whatever you want to mess with people
|
18 |
| -#more_set_headers 'Server: fak3r.com'; |
| 18 | +#more_set_headers 'Server: tehgoogle.com'; |
19 | 19 | # or
|
20 |
| -#more_set_headers 'Server: IIS 4.0 (Windows NT 4.0)'; |
| 20 | +#more_set_headers 'Server: IIS 4.0 (Windows NT 4.0)'; |
21 | 21 |
|
22 | 22 |
|
23 | 23 | #### Content Security Policy
|
24 | 24 | #### http://tautt.com/best-nginx-configuration-for-security/
|
25 |
| -#+ add_header Content-Security-Policy |
26 |
| - |
27 |
| -#add_header Content-Security-Policy "default-src https: connect-src https: font-src https: data: frame-src https: img-src https: data: media-src https: object-src https: script-src 'unsafe-inline' 'unsafe-eval' https: style-src 'unsafe-inline' https:"; |
28 |
| - |
29 |
| -#more specific... |
30 |
| - #add_header Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; frame-src 'self'; connect-src 'self' https://apis.google.com; connect-src 'self' https://fonts.googleapis.com; object-src 'none' "; |
31 |
| -#add_header Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; frame-src 'self'; connect-src 'self' https://apis.google.com; object-src 'none' "; |
32 |
| -#add_header Content-Security-Policy "style-src https://cdnjs.cloudflare.com; "; |
33 |
| -#add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://cdnjs.cloudflare.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'"; |
34 |
| -#add_header Content-Security-Policy "style-src 'https://cdnjs.cloudflare.com'; default-src 'self'; object-src 'none'"; |
35 |
| -#add_header Content-Security-Policy "default-src 'self'"; |
| 25 | +add_header Content-Security-Policy |
| 26 | +add_header Content-Security-Policy "default-src 'self'"; |
| 27 | +#### these can get very specific, options below. To really lock things down will take some time to get right |
| 28 | +#add_header Content-Security-Policy "default-src https: connect-src https: font-src https: data: frame-src https: img-src https: data: media-src https: object-src https: script-src 'unsafe-inline' 'unsafe-eval' https: style-src 'unsafe-inline' https:"; |
| 29 | +#add_header Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; frame-src 'self'; connect-src 'self' https://apis.google.com; connect-src 'self' https://fonts.googleapis.com; object-src 'none' "; |
| 30 | +#add_header Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; frame-src 'self'; connect-src 'self' https://apis.google.com; object-src 'none' "; |
| 31 | +#add_header Content-Security-Policy "style-src https://cdnjs.cloudflare.com; "; |
| 32 | +#add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://cdnjs.cloudflare.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'"; |
| 33 | +#add_header Content-Security-Policy "style-src 'https://cdnjs.cloudflare.com'; default-src 'self'; object-src 'none'"; |
0 commit comments