Skip to content

Document and check ssl file permissions for non-root misp-nginx - #491

Merged
ostefano merged 3 commits into
MISP:masterfrom
gotshell:docs/nginx-ssl-key-permissions
Nov 2, 2026
Merged

ostefano merged 3 commits into
MISP:masterfrom
gotshell:docs/nginx-ssl-key-permissions

Conversation

@gotshell

@gotshell gotshell commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #488

Since #430, misp-nginx runs as uid/gid 101 with ./ssl mounted read-only. A key.pem owned by root with mode 600 is therefore not readable by nginx and HTTPS does not work.

Changes

  • README (Breaking changes): add a note stating that cert.pem and key.pem must be readable by uid/gid 101, with chgrp/chmod and setfacl examples (gid 101 may map to an unrelated group on the host, e.g. ssh_keys on RHEL).
  • nginx/files/04-ssl.sh: the script only checked that the certificate files exist (-f). It now also checks that they are readable (-r) and, if not, exits with an explicit error message instead of generating an SSL config that nginx cannot load.

Testing

Ran a copy of 04-ssl.sh (with the certs path pointed to a temporary directory) as a non-root user:

  • sh -n: no syntax errors
  • cert.pem not readable: error message referencing cert.pem, exit code 1
  • key.pem not readable: error message referencing key.pem, exit code 1
  • both readable: no error, ssl.conf generated as before, exit code 0

The check stops at the first unreadable file, so if both are unreadable only cert.pem is reported; the second one shows up after fixing the first and restarting.

Not tested inside a built misp-nginx image.

misp-nginx runs as uid/gid 101 with ./ssl mounted read-only, so a key.pem owned by root with mode 600 cannot be read and HTTPS does not work. Refs MISP#488.
04-ssl.sh only checked that cert.pem and key.pem exist (-f). If they exist but are not readable by the nginx user, the SSL config was generated anyway and nginx failed later on. Check readability (-r) and exit with an explicit error message instead. Refs MISP#488.
The hint always suggested fixing ssl/key.pem, even when cert.pem was the unreadable file. Use the name of the file that failed the check. Refs MISP#488.
@ostefano
ostefano merged commit 3339232 into MISP:master Nov 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breaking change not documented: ssl/key.pem must be readable by non-root nginx (uid 101)

2 participants