-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSL encryption #43
Open
heatray
wants to merge
20
commits into
master
Choose a base branch
from
feature/ssl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
SSL encryption #43
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8c46e97
Add compose override config
heatray 5fe367e
Add nginx ssl config
heatray 75b7fdb
Fix configuration
heatray e3a4f11
Fix compose config
heatray 6eaf4d3
Refactor nginx config
heatray 5e19d0a
Update README.md
heatray 7f77b09
Fix typo README.md
heatray 63265af
Fix docker compose config
heatray d82f860
Fix storage protocol set
heatray 88621bb
Update README.md
hellonadya dbc8437
Merge pull request #44 from ONLYOFFICE/hellonadya-patch-1
agolybev 0b2a655
Revert "Fix docker compose config"
heatray f822f03
Fix nginx configurtion
heatray dd52439
Revert set_configuration.sh
heatray 810d7a9
Fix README.md
heatray 5dc9b9a
Add ssl config read-only
heatray 1b7f5bb
Fix ssl.yml
heatray 2529546
Merge branch 'master' into feature/ssl
heatray a964c80
Revert "Fix ssl.yml"
heatray 563f514
Rename certificate files
heatray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
certs | ||
|
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Add headers to serve security related headers | ||
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; | ||
add_header X-Content-Type-Options nosniff; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-Robots-Tag none; | ||
add_header X-Download-Options noopen; | ||
add_header X-Permitted-Cross-Domain-Policies none; | ||
|
||
root /var/www/html; | ||
client_max_body_size 10G; # 0=unlimited - set max upload size | ||
fastcgi_buffers 64 4K; | ||
|
||
gzip off; | ||
|
||
index index.php; | ||
error_page 403 /core/templates/403.php; | ||
error_page 404 /core/templates/404.php; | ||
|
||
rewrite ^/.well-known/carddav /remote.php/dav/ permanent; | ||
rewrite ^/.well-known/caldav /remote.php/dav/ permanent; | ||
|
||
location = /robots.txt { | ||
allow all; | ||
log_not_found off; | ||
access_log off; | ||
} | ||
|
||
location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ { | ||
deny all; | ||
} | ||
|
||
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { | ||
deny all; | ||
} | ||
|
||
location / { | ||
rewrite ^/remote/(.*) /remote.php last; | ||
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; | ||
try_files $uri $uri/ =404; | ||
} | ||
|
||
location ~* ^/ds-vpath/ { | ||
rewrite /ds-vpath/(.*) /$1 break; | ||
proxy_pass http://onlyoffice-document-server; | ||
proxy_redirect off; | ||
|
||
client_max_body_size 100m; | ||
|
||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
|
||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $the_host/ds-vpath; | ||
proxy_set_header X-Forwarded-Proto $the_scheme; | ||
} | ||
|
||
location ~ \.php(?:$|/) { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
fastcgi_param HTTPS off; | ||
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice | ||
fastcgi_pass backend; | ||
fastcgi_intercept_errors on; | ||
} | ||
|
||
# Adding the cache control header for js and css files | ||
# Make sure it is BELOW the location ~ \.php(?:$|/) { block | ||
location ~* \.(?:css|js)$ { | ||
add_header Cache-Control "public, max-age=7200"; | ||
# Add headers to serve security related headers | ||
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; | ||
add_header X-Content-Type-Options nosniff; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-Robots-Tag none; | ||
add_header X-Download-Options noopen; | ||
add_header X-Permitted-Cross-Domain-Policies none; | ||
# Optional: Don't log access to assets | ||
access_log off; | ||
} | ||
|
||
# Optional: Don't log access to other assets | ||
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ { | ||
access_log off; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
user www-data; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
|
||
upstream backend { | ||
server app-server:9000; | ||
} | ||
|
||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
map $http_host $this_host { | ||
"" $host; | ||
default $http_host; | ||
} | ||
|
||
map $http_x_forwarded_proto $the_scheme { | ||
default $http_x_forwarded_proto; | ||
"" $scheme; | ||
} | ||
|
||
map $http_x_forwarded_host $the_host { | ||
default $http_x_forwarded_host; | ||
"" $this_host; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name nginx-server; | ||
|
||
include /etc/nginx/common.conf; | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
|
||
ssl_certificate /etc/nginx/certs/fullchain.pem; | ||
ssl_certificate_key /etc/nginx/certs/privkey.pem; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
|
||
include /etc/nginx/common.conf; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
user www-data; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
|
||
upstream backend { | ||
server app-server:9000; | ||
} | ||
|
||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
map $http_host $this_host { | ||
"" $host; | ||
default $http_host; | ||
} | ||
|
||
map $http_x_forwarded_proto $the_scheme { | ||
default $http_x_forwarded_proto; | ||
"" $scheme; | ||
} | ||
|
||
map $http_x_forwarded_host $the_host { | ||
default $http_x_forwarded_host; | ||
"" $this_host; | ||
} | ||
|
||
server { | ||
listen 80; | ||
|
||
include /etc/nginx/common.conf; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3' | ||
services: | ||
onlyoffice-document-server: | ||
environment: | ||
- USE_UNAUTHORIZED_STORAGE=true | ||
nginx: | ||
volumes: | ||
- ./certs:/etc/nginx/certs:ro | ||
- ./nginx/nginx-ssl.conf:/etc/nginx/nginx.conf:ro |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nextcloud's security warnings page (
/index.php/settings/admin/overview
) was complaining that the X-Frame-Options "SAMEORIGIN" header wasn't set. I'm not an nginx expert, so I'm not sure if this is the best place to add it, but adding this line here fixed the warning for me. For some reason, adding it incommon.conf
didn't seem to work.