Skip to content
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

255 security #275

Merged
merged 7 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/nginx/conf.d/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# nginx config for deployment on server, including SSL/TLS setup

server_tokens off;

server {
listen 8080;

server_name monitoring.localzero.net monitoring-test.localzero.net;

client_max_body_size 100m;
add_header Content-Security-Policy "default-src 'self'";
mdrie marked this conversation as resolved.
Show resolved Hide resolved
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
add_header Cache-Control "no-store";

location / {
# pass requests for dynamic content to gunicorn
Expand Down
3 changes: 3 additions & 0 deletions config/settings/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
CSRF_TRUSTED_ORIGINS = get_env("DJANGO_CSRF_TRUSTED_ORIGINS").split(",")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = get_env("DJANGO_DEBUG") == "True"
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
3 changes: 3 additions & 0 deletions cpmonitor/static/js/localzero.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
document.getElementById("nav-burger").addEventListener("click", toggleMobile);
document.getElementById("menu-item-toggleable").addEventListener("click", toggleSubmenu);

function toggleMobile() {
document.getElementById('site-menu').classList.toggle('shownow');
}
Expand Down
6 changes: 3 additions & 3 deletions cpmonitor/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</title>
<link rel="stylesheet" href="{% static 'tabler/css/tabler.css' %}">
<link rel="stylesheet" href="{% static 'css/localzero.css' %}">
<script src="{% static 'js/localzero.js' %}"></script>
<link rel="stylesheet" href="{% static 'css/main.css' %}">
<script src="{% static 'jquery/jquery.min.js' %}"></script>
<script src="{% static 'tabler/js/tabler.min.js' %}" defer></script>
Expand All @@ -42,7 +41,7 @@
<li class="menu-item">
<a href="{% url 'ueber-uns' %}">Über uns</a>
</li>
<li class="menu-item" onclick="toggleSubmenu(event)">
<li class="menu-item" id="menu-item-toggleable">
<a role="button">Kommunen</a>
<ul class="sub-menu">
{% for city in cities %}
Expand All @@ -60,7 +59,7 @@
href="{% url 'jetzt-spenden' %}"
type="button">Jetzt spenden</a>
</div>
<div id="nav-burger" class="nav-burger" onclick="toggleMobile()">
mdrie marked this conversation as resolved.
Show resolved Hide resolved
<div id="nav-burger" class="nav-burger">
<div>
<div class="hamburger"></div>
<div class="hamburger"></div>
Expand Down Expand Up @@ -112,5 +111,6 @@
</footer>
</div>
<script src="{% static 'js/main.js' %}"></script>
<script src="{% static 'js/localzero.js' %}"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions docker/reverseproxy/conf.d/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
server_names_hash_bucket_size 64;
server_tokens off;

server {
listen 443 ssl;
Expand All @@ -13,6 +14,7 @@ server {
proxy_pass http://$nginx:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

include /etc/nginx/conf.d/ssl.conf;
Expand All @@ -31,6 +33,7 @@ server {
proxy_pass http://$nginx:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

include /etc/nginx/conf.d/ssl.conf;
Expand Down