overseerr icon indicating copy to clipboard operation
overseerr copied to clipboard

Do we think is worth documenting how to run a local WAF in front of Overseerr?

Open sbe-arg opened this issue 3 years ago • 3 comments

Description

I feel that when exposing homelab servers on internet needs continuous reminding to people to add extra security practices when possible. I don't think almost anyone runs Overseerr with their users requiring vpn or static ip to reach the host:port.

Something like this works very nicely, stops some dangerous things without being overly fancy or overkill. Happy to open a pr. Seeking feedback.

create self-signed certificate

openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365

nginx.conf

map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
}
upstream overseerr_http {
        least_conn;
        server overseerr:5055;
}
server {
        listen 5055 ssl http2 default_server;
        ssl_certificate /etc/overseerr/cert/cert.pem;
        ssl_certificate_key /etc/overseerr/cert/key.pem;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_early_data off;
        location / {
		# other settings
		client_max_body_size 100M;
                proxy_pass http://overseerr_http;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                # WebSocket support
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_connection;

                # WebSocket ssl
                proxy_redirect off;
                proxy_cache_bypass $http_upgrade;
                proxy_set_header X-NginX-Proxy true;
                proxy_ssl_session_reuse off;
                proxy_ssl_verify off;

        }
}

compose.yaml

  overseerr:
    image: docker.io/sctx/overseerr:latest
    container_name: overseerr
    hostname: overseerr
    restart: unless-stopped
    environment:
      - LOG_LEVEL=debug
      - TZ=your/zone
    ports:
      - 5055/tcp # is behind nginx
    volumes:
      - /var/docker-services/overseerr/config:/app/config


  nginx-waf: # based on https://docs.nginx.com/nginx-waf/
    image: docker.io/owasp/modsecurity-crs:nginx-alpine
    restart: unless-stopped
    container_name: nginx-waf
    depends_on:
      - overseerr
    volumes:
      - ./dockerfiles/nginx-waf.conf:/etc/nginx/conf.d/proxy.conf:ro
      - ./dockerfiles/cert.pem:/etc/overseerr/cert/cert.pem:ro
      - ./dockerfiles/key.pem:/etc/overseerr/cert/key.pem:ro
    ports:
      - 5055:5055/tcp
    environment: # full list of env var options https://hub.docker.com/r/owasp/modsecurity-crs
      - PROXY=1
      - PARANOIA=1 # https://coreruleset.org/faq/#paranoialevel https://coreruleset.org/20211028/working-with-paranoia-levels/
      - EXECUTING_PARANOIA=2
      - LOGLEVEL=warn
      - MODSEC_RULE_ENGINE=on
      - ALLOWED_METHODS=GET HEAD POST OPTIONS DELETE
      - ANOMALY_INBOUND=10

Desired Behavior

Have some waf protection when exposing http/s services

Additional Context

Already detailed above.

Code of Conduct

  • [X] I agree to follow Overseerr's Code of Conduct

sbe-arg avatar Jun 12 '23 11:06 sbe-arg

Cloudflare Tunnel helps with this by encrypting the connection and hides your external IP.

sysopexos avatar Jun 16 '23 15:06 sysopexos

Cloudflare Tunnel helps with this by encrypting the connection and hides your external IP.

You need a domain for using cloudflare tunnels. For direct ip a local waf seems the easier route.

I have a few friends and family that are not savy enough to use a vpn to connect to my network either.

sbe-arg avatar Jun 17 '23 03:06 sbe-arg

I think this is out of scope for our docs.

TheCatLady avatar Jun 17 '23 05:06 TheCatLady