moved nginx, graylog to podman

This commit is contained in:
Bastian de Byl
2022-05-01 03:31:16 -04:00
parent 8e373896a6
commit c5bc5a91ac
49 changed files with 2556 additions and 580 deletions

View File

@@ -0,0 +1,24 @@
upstream hass {
server 127.0.0.1:8123;
}
server {
resolver 192.168.1.12 ipv6=off;
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80;
server_name {{ assistant_server_name }};
location / {
allow 192.168.1.0/24;
allow 127.0.0.1;
deny all;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
proxy_pass http://hass;
}
}

View File

@@ -0,0 +1,13 @@
server {
listen 80;
server_name {{ ci_server_name }};
location /.well-known {
root /srv/http/letsencrypt;
try_files $uri $uri/ =404;
}
location / {
return 301 https://$host$request_uri;
}
}

View File

@@ -0,0 +1,59 @@
upstream drone {
server 127.0.0.1:8080;
}
geo $local_access {
default 0;
192.168.1.1 1;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ ci_server_name }};
ssl_certificate /etc/letsencrypt/live/{{ ci_server_name }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ ci_server_name }}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/{{ ci_server_name }}/fullchain.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_session_timeout 1d;
ssl_stapling on;
ssl_stapling_verify on;
resolver 9.9.9.9 valid=60s ipv6=off;
location / {
if ($local_access = 1) {
access_log off;
}
add_header Allow "GET, POST, HEAD" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; img-src 'self' https://*.githubusercontent.com https://*.github.com; frame-ancestors 'self'; base-uri 'none',base-uri 'self'; form-action 'self'" always;
add_header Referrer-Policy "same-origin" always;
add_header Strict-Transport-Security "max-age=630720000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
# Sent from upstream:
# add_header X-Frame-Options "SAMEORIGIN";
# add_header X-XSS-Protection "1; mode=block";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://drone;
proxy_redirect off;
chunked_transfer_encoding off;
}
}

View File

@@ -0,0 +1,19 @@
geo $whitelisted {
default 0;
192.168.1.0/24 1;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80 default_server;
server_name {{ home_server_name }};
if ($whitelisted = 1) {
return 302 http://{{ ansible_default_ipv4.address }};
}
if ($whitelisted = 0) {
return 302 $scheme://bdebyl.net$request_uri;
}
}

View File

@@ -0,0 +1,32 @@
upstream graylog {
server 127.0.0.1:{{ graylog_port }};
}
geo $local_access {
default 0;
192.168.1.0/24 1;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80;
server_name {{ logs_server_name }};
location / {
if ($local_access = 1) {
access_log off;
}
allow 192.168.1.0/24;
allow 127.0.0.1;
deny all;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
proxy_pass http://graylog;
}
}

View File

@@ -0,0 +1,21 @@
geo $whitelisted {
default 0;
192.168.1.0/24 1;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80;
server_name {{ parts_server_name }};
location /.well-known {
root /srv/http/letsencrypt;
try_files $uri $uri/ =404;
}
location / {
return 302 https://$host$request_uri;
}
}

View File

@@ -0,0 +1,57 @@
geo $whitelisted {
default 0;
192.168.1.0/24 1;
}
upstream partkeepr {
server 127.0.0.1:8081;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
resolver 127.0.0.1 127.0.0.53 9.9.9.9 valid=60s;
listen 443 ssl http2;
server_name {{ parts_server_name }};
ssl_certificate /etc/letsencrypt/live/{{ parts_server_name }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ parts_server_name }}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/{{ parts_server_name }}/fullchain.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_session_timeout 1d;
ssl_stapling on;
ssl_stapling_verify on;
if ($whitelisted = 0) {
return 302 $scheme://bdebyl.net$request_uri;
}
location / {
add_header Referrer-Policy "same-origin" always;
# add_header Strict-Transport-Security "max-age=630720000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
# Sent from upstream:
# add_header X-Frame-Options "SAMEORIGIN";
# add_header X-XSS-Protection "1; mode=block";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://partkeepr;
proxy_redirect off;
chunked_transfer_encoding off;
}
}

View File

@@ -0,0 +1,57 @@
#
# /etc/nginx/conf.d/pihole.conf
#
# https://github.com/pi-hole/pi-hole/wiki/Nginx-Configuration
#
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80;
root /srv/http/pihole;
server_name {{ pi_server_name }};
autoindex off;
proxy_intercept_errors on;
error_page 404 /pihole/index.php;
index pihole/index.php index.php index.html index.htm;
allow 192.168.1.0/24;
allow 127.0.0.1;
deny all;
location / {
expires max;
try_files $uri $uri/ =404;
add_header X-Pi-hole "A black hole for Internet advertisements";
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param VIRTUAL_HOST open_basedir="/srv/http/pihole:run/pihole-ftl/pihole-FTL.port:run/log/pihole/pihole.log:run/log/pihole-ftl/pihole-FTL.log:etc/pihole:etc/hosts:etc/hostname:etc/dnsmasq.d/02-pihole-dhcp.conf:etc/dnsmasq.d/03-pihole-wildcard.conf:etc/dnsmasq.d/04-pihole-static-dhcp.conf:var/log/lighttpd/error.log:proc/meminfo:proc/cpuinfo:sys/class/thermal/thermal_zone0/temp:tmp";
}
location /admin {
root /srv/http/pihole;
index index.php index.html index.htm;
add_header X-Pi-hole "The Pi-hole Web interface is working!";
add_header X-Frame-Options "DENY";
}
location ~ /\.ttf {
add_header Access-Control-Allow-Origin "*";
}
location ~ /admin/\. {
deny all;
}
location ~ /\.ht {
deny all;
}
}

View File

@@ -0,0 +1,24 @@
upstream shinobi {
server 127.0.0.1:8085;
}
server {
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec_includes.conf;
listen 80;
server_name {{ video_server_name }};
location / {
allow 192.168.1.0/24;
allow 127.0.0.1;
deny all;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
proxy_pass http://shinobi;
}
}