Compare commits

..

8 Commits

Author SHA1 Message Date
fd21326401 dlink 2026-05-18 13:57:31 +02:00
d02573112e license 2026-05-10 13:53:56 +02:00
ea78fdcbab piholennetworkisolatfromtherestofthewebservices 2026-05-08 22:41:02 +02:00
0a40956981 settingupmail 2026-05-06 20:09:43 +02:00
a40b96e8de exampleenv2ndtry 2026-05-06 10:51:52 +02:00
3d14d51922 exampleenv 2026-05-06 10:50:04 +02:00
2942caba3a snippets&siteswork 2026-04-27 10:01:41 +02:00
32d373c96e confer 2026-04-27 09:52:45 +02:00
10 changed files with 135 additions and 30 deletions

2
.gitignore vendored
View File

@@ -51,5 +51,5 @@ Thumbs.db
# Git safety
# -------------------------
.env
*.env
*.secret

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Tord-Vincent Heggland
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,9 +1,11 @@
{
email {$ACME_EMAIL}
}
### FUNKSJONER ###
import snippets/*.caddy
(remote-ip) {
@internal remote_ip 10.10.10.0/24 172.16.0.0/12 127.0.0.1/8
@internal remote_ip 10.10.10.0/24 172.16.0.0/12 127.0.0.1/8 192.168.100.0/24
@external remote_ip 0.0.0.0/0
}
(common-auth) {
@@ -11,15 +13,6 @@
tvh {$HASH}
}
}
(rate-limit) {
rate_limit {
zone git_zone {
key {remote_host}
events 30
window 10s
}
}
}
(read-only) {
@readonly {
method POST PUT DELETE PATCH
@@ -36,9 +29,11 @@
git.{$DOMENESHOP_DNS} {
import remote-ip
handle @external {
redir / /tvh-linux
import rate-limit
reverse_proxy gitea:3000
}
respond "Forbidden" 403
}
lms.home.{$DOMENESHOP_DNS} {
import dns-tls
@@ -54,7 +49,10 @@ pihole.home.{$DOMENESHOP_DNS} {
import remote-ip
handle @internal {
redir / /admin
reverse_proxy pihole:80
reverse_proxy 192.168.100.156:18080
}
handle {
respond "Forbidden" 403
}
}
nextcloud.{$DOMENESHOP_DNS} {
@@ -64,6 +62,7 @@ nextcloud.{$DOMENESHOP_DNS} {
encode gzip zstd
reverse_proxy nextcloud-app:80
}
respond "Forbidden" 403
}
portainer.{$DOMENESHOP_DNS} {
import remote-ip
@@ -83,14 +82,6 @@ portainer.home.{$DOMENESHOP_DNS} {
}
respond "Forbidden" 403
}
kuma.home.{$DOMENESHOP_DNS} {
import dns-tls
import remote-ip
handle @internal {
reverse_proxy kuma:3001
}
respond "Forbidden" 403
}
vault.home.{$DOMENESHOP_DNS} {
import dns-tls
import remote-ip
@@ -101,3 +92,7 @@ vault.home.{$DOMENESHOP_DNS} {
}
import sites/*.caddy

8
caddy/sites/kuma.caddy Normal file
View File

@@ -0,0 +1,8 @@
kuma.home.{$DOMENESHOP_DNS} {
import dns-tls
import remote-ip
handle @internal {
reverse_proxy kuma:3001
}
respond "Forbidden" 403
}

29
caddy/sites/mailu.caddy Normal file
View File

@@ -0,0 +1,29 @@
mail.home.{$DOMENESHOP_DNS} {
import dns-tls
import remote-ip
handle @internal {
import mailu-proxy mail.home.{$DOMENESHOP_DNS}
}
}
mail.srv.{$DOMENESHOP_DNS} {
import dns-tls
import remote-ip
handle @external {
import mailu-proxy mail.srv.{$DOMENESHOP_DNS}
}
}
mailu.privix.no {
import dns-tls
import remote-ip
handle @external {
import mailu-proxy mail.srv.{$DOMENESHOP_DNS}
}
}
mail.{$DOMENESHOP_DNS} {
import common-auth
import remote-ip
handle @internal {
respond "mail endpoint" 200
}
}

26
caddy/sites/whoami.caddy Normal file
View File

@@ -0,0 +1,26 @@
whoami.srv.{$DOMENESHOP_DNS} {
respond <<EOF
remote_host: {remote_host}
remote_ip: {remote_ip}
client_ip: {client_ip}
host: {host}
x_forwarded_for: {header.X-Forwarded-For}
x_real_ip: {header.X-Real-IP}
proto: {scheme}
EOF 200
}
whoami.home.{$DOMENESHOP_DNS} {
import dns-tls
respond <<EOF
remote_host: {remote_host}
remote_ip: {remote_ip}
client_ip: {client_ip}
host: {host}
EOF 200
}

View File

@@ -0,0 +1,15 @@
(mailu-proxy) {
reverse_proxy https://mailu-front:443 {
header_up Host {args[0]}
header_up X-Forwarded-Host {args[0]}
header_up X-Forwarded-Proto https
header_up X-Real-IP {remote_host}
header_down Location https://mailu-front/ https://{args[0]}/
header_down Location https://mailu-front https://{args[0]}
transport http {
tls_server_name mail.tvheggland.no
}
}
}

View File

@@ -0,0 +1,9 @@
(rate-limit) {
rate_limit {
zone git_zone {
key {remote_host}
events 30
window 10s
}
}
}

View File

@@ -9,22 +9,18 @@ services:
env_file:
- .env
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./caddy:/etc/caddy:ro
- caddy_data:/data
- caddy_config:/config
networks:
- proxy_net
- edge_net
- proxy_swarm
proxy_net:
ipv4_address: 172.19.0.254
# proxy_swarm:
networks:
proxy_net:
external: true
edge_net:
external: true
proxy_swarm:
external: true
# proxy_swarm:
# external: true
volumes:
caddy_data:
caddy_config:

6
example.env Normal file
View File

@@ -0,0 +1,6 @@
ACME_EMAIL=you@example.com
DOMENESHOP_DNS=example.com
HASH=YOURHASH
DOMENESHOP_API_TOKEN=YOUR_TOKEN
DOMENESHOP_API_SECRET=YOUR_SECRET