Allowing access to programs in SELinux through modules

This page is compiled from my experiences of researching the bare minimum to make stuff work. Since SELinux is made to be secure, this approach might create security vulnerabilities if you don’t know what you are doing. Resources Introduction to SELinux (GitHub blog) Locate the problem In this example. My nginx installation is unable to access a file called test.txt. This is the journal log: Sep 22 20:01:32 hermes.iix.se audit[23928]: AVC avc: denied { read } for pid=23928 comm="nginx" name="test....

Nginx: HTTP redirect to HTTPS

server { listen *:80; server_name _; return 301 https://$host$request_uri; }

June 10, 2017  |  🏷️Nginx

Nginx: HTTPS proxy pass to HTTP @ localhost

server { listen *:443; server_name iix.se; ssl on; ssl_certificate /etc/letsencrypt/live/iix.se/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/iix.se/privkey.pem; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; location / { 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; proxy_pass http://127.0.0.1; proxy_read_timeout 90; } }

June 10, 2017  |  🏷️Nginx 🏷️Ssl

Nginx: connect() failed while connecting to upstream

Spam in error.log: 2017/05/07 16:51:50 [error] 30504#0: *7089 connect() failed (111: Connection refused) while connecting to upstream, client: 169.54.244.93, server: iix.se, request: "GET / HTTP/1.1", upstream: "http://[::1]:8001/", host: "phoenix.iix.se" In your nginx configuration, replace hostnames with ip-addresses