ansible/privfrontends/templates/Caddyfile.j2

310 lines
14 KiB
Caddyfile
Raw Normal View History

2023-08-15 14:33:56 +05:30
{
log {
output discard
}
}
2023-05-13 06:44:40 +05:30
(tor) {
header {
-Strict-Transport-Security
-Referrer-Policy
-X-XSS-Protection
-Content-Security-Policy
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
2023-07-13 23:16:07 +05:30
Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()";
2023-05-13 06:44:40 +05:30
# clickjacking protection
X-Frame-Options SAMEORIGIN
2023-08-09 16:26:58 +05:30
Onion-Location http://{args[0]}.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion{path}
2023-05-13 06:44:40 +05:30
defer
}
}
(torloc) {
2023-08-09 16:26:58 +05:30
header Onion-Location http://{args[0]}.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion{path}
2023-05-13 06:44:40 +05:30
}
(i2ploc) {
2023-08-09 16:26:58 +05:30
header X-I2P-Location http://{args[0]}{path}
2023-05-13 06:44:40 +05:30
}
(acmedns) {
tls {
dns rfc2136 {
key_name "dynupd"
key_alg "hmac-sha256"
key "{{ rfc2136_key }}"
server "107.189.12.96:53"
}
}
}
(def) {
header {
# disable FLoC tracking
Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()";
2023-05-13 06:44:40 +05:30
# enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# clickjacking protection
X-Frame-Options SAMEORIGIN
X-XSS-Protection "1; mode=block"
defer
2023-05-29 14:08:34 +05:30
}
2023-08-10 15:45:11 +05:30
2023-05-13 06:44:40 +05:30
{% if inventory_hostname == 'in' %}
import acmedns
{% endif %}
}
2023-09-03 21:30:20 +05:30
import ./*.Caddyfile
2023-09-14 14:42:16 +05:30
{{ inventory_hostname }}.projectsegfau.lt {% if inventory_hostname == 'eu' %} pizza1.projectsegfau.lt {% endif %} {
redir https://wiki.projectsegfau.lt/index.php?title={{ wiki_page }}
2023-05-13 06:44:40 +05:30
}
cdn.projectsegfau.lt cdn.{{ server_prefix }}.projectsegfau.lt {
2023-05-13 06:44:40 +05:30
encode zstd gzip
root * /var/cdn
file_server {
browse
}
}
lbry.{{ server_prefix }}.projectsegfau.lt lbry.projectsegfau.lt {
reverse_proxy :3550
import def
import torloc lbry
import i2ploc pjsf7uucpqf2crcmfo3nvwdmjhirxxjfyuvibdfp5x3af2ghqnaa.b32.i2p
2023-05-29 14:08:34 +05:30
}
nitter.{{ server_prefix }}.projectsegfau.lt nitter.projectsegfau.lt n.psf.lt n.{{ server_prefix }}.psf.lt {
import def
2023-09-03 21:30:20 +05:30
import banips
2023-08-31 17:38:01 +05:30
log {
# This is temporarily required to monitor nitter traffic due to scrapers being more active, so we need to monitor and rate limit them at a later date.
output file /var/log/caddy/nitter.log
format json
}
2023-05-29 14:08:34 +05:30
header {
X-Permitted-Cross-Domain-Policies none
Permissions-Policy "Permissions-Policy: accelerometer=(), ambient-light-sensor=(), autoplay=(self), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(self), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(self), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()"
header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline'; script-src-attr 'none'; img-src 'self'; style-src 'self' 'unsafe-inline'; style-src-elem 'self'; font-src 'self'; object-src 'none'; media-src 'self' blob:; worker-src 'self' blob:; base-uri 'self'; form-action 'self'; frame-ancestors 'self'; connect-src 'self' https://*.twimg.com; manifest-src 'self'"
2023-05-29 14:08:34 +05:30
}
reverse_proxy :8065
import torloc nitter
import i2ploc pjsfs4ukb6prmfx3qx3a5ef2cpcupkvcrxdh72kqn2rxc2cw4nka.b32.i2p
2023-05-13 06:44:40 +05:30
}
libreddit.{{ server_prefix }}.projectsegfau.lt libreddit.projectsegfau.lt lr.psf.lt lr.{{ server_prefix }}.psf.lt {
reverse_proxy :6464
2023-05-13 06:44:40 +05:30
import def
import torloc libreddit
import i2ploc pjsfkref7g66mji45kyccqnn5hmjtjp3cfodozabpyplj2rmv5sa.b32.i2p
2023-05-13 06:44:40 +05:30
}
teddit.{{ server_prefix }}.projectsegfau.lt teddit.projectsegfau.lt t.psf.lt t.{{ server_prefix }}.psf.lt {
reverse_proxy :9061
import def
import torloc teddit
2023-05-29 21:19:16 +05:30
}
2023-09-14 22:22:04 +05:30
inv.{{ server_prefix }}.projectsegfau.lt i.{{ server_prefix }}.psf.lt {
2023-11-02 16:09:33 +05:30
reverse_proxy :7573
2023-11-13 17:31:32 +05:30
@playback {
path /videoplayback
path /videoplayback/*
}
header @playback {
Access-Control-Allow-Origin "*"
}
2023-11-13 16:54:12 +05:30
@jpgRedirect path_regexp maxres2 /vi/(.+)/maxres.jpg
@thumbnailRedirect path_regexp ggpht /ggpht/(.+)
redir @jpgRedirect /vi/{re.maxres2.1}/maxres2.jpg
redir @thumbnailRedirect https://pipedproxy.{{server_prefix}}.projectsegfau.lt/{re.ggpht.1}?host=yt3.ggpht.com
redir /vi/* https://pipedproxy.{{server_prefix}}.projectsegfau.lt{uri}?host=i.ytimg.com
redir /videoplayback/* https://pipedproxy.{{server_prefix}}.projectsegfau.lt{uri}
redir /videoplayback https://pipedproxy.{{server_prefix}}.projectsegfau.lt{uri}
2023-05-13 06:44:40 +05:30
header {
# disable FLoC tracking
Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()";
2023-05-13 06:44:40 +05:30
# enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
2023-05-29 14:08:34 +05:30
-Content-Security-Policy
2023-05-13 06:44:40 +05:30
X-XSS-Protection "1; mode=block"
defer
}
2023-08-10 15:45:11 +05:30
@badbots {
header "User-Agent" "Go-http-client/2.0"
}
respond @badbots "Access to this route denied" 403
2023-08-09 16:26:58 +05:30
import torloc inv
{% if server_prefix == 'in' %}
2023-05-13 06:44:40 +05:30
import acmedns
{% endif %}
}
gothub.{{ server_prefix }}.projectsegfau.lt gothub.projectsegfau.lt gh.psf.lt gh.{{ server_prefix }}.psf.lt {
2023-09-14 14:42:16 +05:30
reverse_proxy :1024
2023-05-13 06:44:40 +05:30
import def
import torloc gothub
}
overflow.{{ server_prefix }}.projectsegfau.lt overflow.projectsegfau.lt o.psf.lt o.{{ server_prefix }}.psf.lt {
2023-09-14 14:42:16 +05:30
reverse_proxy :8694
2023-05-13 06:44:40 +05:30
import def
import torloc overflow
}
rimgo.{{ server_prefix }}.projectsegfau.lt rimgo.projectsegfau.lt rg.psf.lt rg.{{ server_prefix }}.psf.lt {
2023-09-14 14:42:16 +05:30
reverse_proxy :9016
2023-05-13 06:44:40 +05:30
import def
import torloc rimgo
}
bw.{{ server_prefix }}.projectsegfau.lt bw.projectsegfau.lt bw.psf.lt bw.{{ server_prefix }}.psf.lt {
2023-05-13 06:44:40 +05:30
import def
import torloc breezewiki
import i2ploc pjsfk4xvekoc7wx4pteevp3q2wy7jmzlem7rvl74nx33zkdr4vyq.b32.i2p
2023-09-14 14:42:16 +05:30
reverse_proxy :10416
2023-05-13 06:44:40 +05:30
}
scribe.{{ server_prefix }}.projectsegfau.lt scribe.projectsegfau.lt sc.psf.lt sc.{{ server_prefix }}.psf.lt {
2023-05-13 06:44:40 +05:30
import def
import torloc scribe
import i2ploc pjsflkkkcn33ahmzmpyq6idy2knkzh4atp7zaetqfsnenpyori6a.b32.i2p
2023-09-14 14:42:16 +05:30
reverse_proxy :8006
2023-05-13 06:44:40 +05:30
}
translate.{{ server_prefix }}.projectsegfau.lt translate.projectsegfau.lt tl.psf.lt tl.{{ server_prefix }}.psf.lt {
2023-06-05 14:36:49 +05:30
import def
2023-09-14 14:42:16 +05:30
reverse_proxy :5046
2023-08-09 16:26:58 +05:30
import torloc translate
2023-06-05 14:36:49 +05:30
}
safetwitch.{{ server_prefix }}.projectsegfau.lt safetwitch.projectsegfau.lt tw.psf.lt tw.{{ server_prefix }}.psf.lt {
2023-07-01 23:40:31 +05:30
import def
2023-09-14 14:42:16 +05:30
reverse_proxy :5070
2023-08-09 16:26:58 +05:30
import torloc safetwitch
2023-07-01 23:40:31 +05:30
}
api.safetwitch.{{ server_prefix }}.projectsegfau.lt {
reverse_proxy :5072
# Something is taking the port 5071, I've went ahead and changed it to 5072 temporarily, can be permanently kept.
2023-07-01 23:40:31 +05:30
}
hyperpipe.{{ server_prefix }}.projectsegfau.lt hyperpipe.projectsegfau.lt hp.psf.lt hp.{{ server_prefix }}.psf.lt {
2023-07-07 23:45:48 +05:30
import def
2023-09-14 14:42:16 +05:30
reverse_proxy :8843
2023-07-07 23:45:48 +05:30
}
hyperpipebackend.{{ server_prefix }}.projectsegfau.lt {
2023-09-14 14:42:16 +05:30
reverse_proxy :3536
2023-07-07 23:45:48 +05:30
}
search.{{ server_prefix }}.projectsegfau.lt search.projectsegfau.lt s.psf.lt s.{{ server_prefix }}.psf.lt {
2023-05-13 06:44:40 +05:30
import def
2023-08-09 16:26:58 +05:30
import torloc search
2023-10-13 19:39:26 +05:30
reverse_proxy :8081 {
header_up X-Real-IP {remote_host}
}
2023-05-13 06:44:40 +05:30
@api {
path /config
path /healthz
path /stats/errors
path /stats/checker
}
@static {
path /static/*
}
@notstatic {
not path /static/*
}
@imageproxy {
path /image_proxy
}
@notimageproxy {
not path /image_proxy
}
header {
# Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Enable cross-site filter (XSS) and tell browser to block detected attacks
X-XSS-Protection "1; mode=block"
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
X-Content-Type-Options "nosniff"
# Disable some features
Permissions-Policy "accelerometer=(),ambient-light-sensor=(),autoplay=(),camera=(),encrypted-media=(),focus-without-user-activation=(),geolocation=(),gyroscope=(),magnetometer=(),microphone=(),midi=(),payment=(),picture-in-picture=(),speaker=(),sync-xhr=(),usb=(),vr=()"
# Disable some features (legacy)
Feature-Policy "accelerometer 'none';ambient-light-sensor 'none'; autoplay 'none';camera 'none';encrypted-media 'none';focus-without-user-activation 'none'; geolocation 'none';gyroscope 'none';magnetometer 'none';microphone 'none';midi 'none';payment 'none';picture-in-picture 'none'; speaker 'none';sync-xhr 'none';usb 'none';vr 'none'"
# Referer
Referrer-Policy "no-referrer"
# X-Robots-Tag
X-Robots-Tag "noindex, noarchive, nofollow"
# Remove Server header
-Server
}
header @api {
Access-Control-Allow-Methods "GET, OPTIONS"
Access-Control-Allow-Origin "*"
}
# Cache
header @static {
# Cache
Cache-Control "public, max-age=31536000"
defer
}
header @notstatic {
# No Cache
Cache-Control "no-cache, no-store"
Pragma "no-cache"
}
# CSP (see http://content-security-policy.com/ )
header @imageproxy {
Content-Security-Policy "default-src 'none'; img-src 'self' data:"
}
header @notimageproxy {
Content-Security-Policy "upgrade-insecure-requests; default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; form-action 'self' https://github.com/searxng/searxng/issues/new; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self' https://overpass-api.de; img-src 'self' data: https://*.tile.openstreetmap.org; frame-src https://www.youtube-nocookie.com https://player.vimeo.com https://www.dailymotion.com https://www.deezer.com https://www.mixcloud.com https://w.soundcloud.com https://embed.spotify.com"
}
}
2023-09-15 22:58:53 +05:30
piped.{{ server_prefix }}.projectsegfau.lt pipedproxy.{{ server_prefix }}.projectsegfau.lt pipedapi.{{ server_prefix }}.projectsegfau.lt {
2023-11-02 16:09:33 +05:30
reverse_proxy :6970
header {
# disable FLoC tracking
Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()";
# enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
X-XSS-Protection "1; mode=block"
defer
}
2023-08-10 15:45:11 +05:30
@badbots {
header "User-Agent" "Go-http-client/2.0"
}
respond @badbots "Access to this route denied" 403
{% if server_prefix == 'in' %}
import acmedns
{% endif %}
}
2023-09-15 22:55:21 +05:30
pi.{{ server_prefix }}.psf.lt {
2023-11-02 16:09:33 +05:30
reverse_proxy :6970 {
2023-07-19 19:50:55 +05:30
header_up Host "{% if server_prefix == 'eu' %}piped.projectsegfau.lt{%else%}piped.{{ server_prefix }}.projectsegfau.lt{%endif%}"
}
header {
# disable FLoC tracking
Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), screen-wake-lock=(), serial=(), usb=(), sync-xhr=(), xr-spatial-tracking=()";
# enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
X-XSS-Protection "1; mode=block"
defer
}
2023-08-10 15:45:11 +05:30
@badbots {
header "User-Agent" "Go-http-client/2.0"
}
respond @badbots "Access to this route denied" 403
}