Private
Public Access
Add hardening and deployment: admin dashboard, security headers, install docs
Adds an admin-only dashboard (apps/core) surfacing feeds that are failing to fetch, with error messages, subscriber counts, and a one-click retry that resets backoff and re-queues the fetch. Hardens config/settings/prod.py with the remaining standard Django security settings (HSTS preload, nosniff, referrer-policy, frame-options, SameSite cookies) plus a Content-Security-Policy header via django-csp, as a second layer behind nh3's HTML sanitization of feed content. Adds docs/install.md (pip + gunicorn + systemd + nginx, SQLite and Postgres both covered) plus the systemd units and nginx snippet it references, LICENSE (AGPL-3.0-or-later, matching pyproject.toml), and an updated README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7577110238
commit
3f6474ce94
16 files changed
+1226
-6
No files matched your search
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Evection (Celery beat scheduler)
|
||||
After=network.target redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=evection
|
||||
Group=evection
|
||||
WorkingDirectory=/opt/evection/app
|
||||
EnvironmentFile=/opt/evection/app/.env
|
||||
Environment=DJANGO_SETTINGS_MODULE=config.settings.prod
|
||||
ExecStart=/opt/evection/venv/bin/celery -A config beat --loglevel=info \
|
||||
--schedule=/opt/evection/app/celerybeat-schedule
|
||||
Restart=on-failure
|
||||
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ReadWritePaths=/opt/evection/app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=Evection (Celery worker)
|
||||
After=network.target redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=evection
|
||||
Group=evection
|
||||
WorkingDirectory=/opt/evection/app
|
||||
EnvironmentFile=/opt/evection/app/.env
|
||||
Environment=DJANGO_SETTINGS_MODULE=config.settings.prod
|
||||
# Combine worker + beat on a single small host by adding "-B" here instead
|
||||
# of also running evection-celery-beat.service — see docs/install.md.
|
||||
ExecStart=/opt/evection/venv/bin/celery -A config worker --loglevel=info
|
||||
Restart=on-failure
|
||||
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ReadWritePaths=/opt/evection/app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=Evection (gunicorn)
|
||||
After=network.target redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=evection
|
||||
Group=evection
|
||||
WorkingDirectory=/opt/evection/app
|
||||
EnvironmentFile=/opt/evection/app/.env
|
||||
Environment=DJANGO_SETTINGS_MODULE=config.settings.prod
|
||||
RuntimeDirectory=evection
|
||||
ExecStart=/opt/evection/venv/bin/gunicorn \
|
||||
--workers 3 \
|
||||
--bind unix:/run/evection/gunicorn.sock \
|
||||
config.wsgi:application
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ReadWritePaths=/opt/evection/app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,45 @@
|
||||
# Reverse proxy for Evection. Copy to /etc/nginx/sites-available/evection,
|
||||
# adjust server_name and the certificate paths (certbot will fill those in
|
||||
# for you if you use `certbot --nginx`), then symlink into sites-enabled.
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name your-domain.example;
|
||||
|
||||
# certbot --nginx adds the HTTPS server block and redirects here
|
||||
# automatically; until then this serves plain HTTP.
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name your-domain.example;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/your-domain.example/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/your-domain.example/privkey.pem;
|
||||
|
||||
client_max_body_size 10M; # OPML uploads are small, but leave headroom
|
||||
|
||||
location /static/ {
|
||||
alias /opt/evection/app/staticfiles/;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# The service worker must be served from the domain root with the right
|
||||
# scope header for its Service-Worker-Allowed: / to take effect — it's
|
||||
# already a normal Django view (see apps.pwa), proxied like everything
|
||||
# else below, so no special-casing is needed here.
|
||||
|
||||
location / {
|
||||
proxy_pass http://unix:/run/evection/gunicorn.sock;
|
||||
proxy_set_header Host $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-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user