From c71791eea611179b6a7e977a2a0114b529e2d9c3 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 16:32:51 +0200 Subject: [PATCH 01/10] init --- docs/SELF_HOSTING_HTTPS.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docs/SELF_HOSTING_HTTPS.md diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md new file mode 100644 index 0000000..263158b --- /dev/null +++ b/docs/SELF_HOSTING_HTTPS.md @@ -0,0 +1,33 @@ +# Selfhosting with HTTPS + +Since we handling a rather complex topic with this, it is separate from the [SELF_HOSTING.md](./SELF_HOSTING.md) which is focusing on how to run openGym. +This document is takes a more general approach on how to achieve "https at home", it is not necessarily focused on openGym and applies to self hosting in general. + +When self hosting it is often thought of that one needs to expose their services to the internet, this is not necessarily the case. +We can have https certificates without having to expose our precious hosts to the world. You can still do that if you want to access your applications from the internet without any VPN, but it's not necessary to take the risk. + +Since VPN is a beast of it's own we'll only handle the certificates for now and grant https traffic to our local network hosts. + +## Components + +Given we have the following setup: +- a little server (e.g. a Raspberry Pi or mini PC) that runs our applications. +- a client (your PC, mobile, tablet, etc.) +- your router (the thing that provides internet access, wifi, etc.) + +flowchart TD + A[Router] + A -->B[Laptop] + A -->C[homelab] + +simple, right? + +### DNS + +### Let's encrypt! + +#### nginx proxy + +#### caddy + + From 36f7558cc3c0f83751e0344777ba504225217c09 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 16:34:11 +0200 Subject: [PATCH 02/10] graph --- docs/SELF_HOSTING_HTTPS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index 263158b..a8c4c3a 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -15,10 +15,12 @@ Given we have the following setup: - a client (your PC, mobile, tablet, etc.) - your router (the thing that provides internet access, wifi, etc.) -flowchart TD +```mermaid +graph TD A[Router] A -->B[Laptop] A -->C[homelab] +``` simple, right? From dc8fcec4bec331ad89d58914ba2870b041443973 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 16:42:00 +0200 Subject: [PATCH 03/10] test mermaid shape --- docs/SELF_HOSTING_HTTPS.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index a8c4c3a..e00cf28 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -17,9 +17,10 @@ Given we have the following setup: ```mermaid graph TD - A[Router] - A -->B[Laptop] - A -->C[homelab] + A@{ shape: cloud, label: "Internet"} + A <--> B[Router] + B <-->C[Laptop] + B <-->D[homelab] ``` simple, right? From 118205bc75151238d3f3c063438723e194b6c660 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 17:17:35 +0200 Subject: [PATCH 04/10] save progress --- docs/SELF_HOSTING_HTTPS.md | 53 ++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index e00cf28..2fa4917 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -19,18 +19,61 @@ Given we have the following setup: graph TD A@{ shape: cloud, label: "Internet"} A <--> B[Router] - B <-->C[Laptop] + B <-->C[PC] + B <-->E[Mobile] B <-->D[homelab] ``` -simple, right? - ### DNS +In most cases the router also provides DNS for the local network and forwards all requests to the internet provider DNS. +(If you set up your own DNS server on your homelab, you probably know what you're doing.) + +The clients (PC, mobile phone, ...) will ask the local DNS for adress translation and if the local DNS can't provide the target adress, it will forward the request. +Usually the DNS servers out there translate DNS names to public IP adresses. +Since we do not own a plublic DNS server, we need a DNS provider that does this for us. +You probably heard of dyndns, duckdns and the like. This is what they do: provide a public DNS for us. + +In order to make the public DNS servers out there resolve the local IP adress of our homelab we will set up the DNS provider. +It is strongly adviced to check which DNS providers are supported by the tools you choose (we'll get to that later). + ### Let's encrypt! -#### nginx proxy +Let's encrypt is free to use, they provide certificates for everyone to make the internet safer. Read [here](https://letsencrypt.org/docs/why-all-https/) for more information. +They provide tools to automatically create certificates with a challenge to ensure your request is valid. +Therefore the tool needs to have access to the DNS provider to generate temporary TXT entries on the DNS entry. +If all is checked, the certificate authority of Let's encrypt singns the certificate and it can be used. -#### caddy +### proxy +A proxy is optional but desirable. It acts as sort of a gateway to our service and can be a single entrypoint to multiple services on our homelab. +Let's say we have three services running on our instance. Since a TCP port can be used only once on a host we would have three ports that access our individual services. +It would not be very nice to have to remember all the ports when we adress our services, so we let the proxy do it. +Port 443 (https) can only be used once so we would let our proxy answer to that port. +We configure the proxy to forward requests to our individual services like so: +```mermaid +graph TD + A[proxy] + A <-->B[openGym :8080] + A <-->C[openGym-api :3000] + A <-->D[Nextcloud :8081] +``` +Now we have a nice URL and can forget about the ports. The proxy reads the URL request and forwards it to the target service/host. + +## How?! + +So how does it all come together? + +1. DNS provider translates name to our local IP +1. the proxy listens to the local IP and provides HTTPS +1. Let's encrypt provides certificates + +### Tools + +- DNS provider: +- let's encrypt client: +- reverse proxy: + +This is the tools I picked and that I know to work, your choice may be different and the setup is different as well. +But the main tasks are the same, so you can adapt to your choice. From c1b8ef3190afe054656d5dd27a32a85d17ab833b Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 17:57:02 +0200 Subject: [PATCH 05/10] save progress --- docs/SELF_HOSTING_HTTPS.md | 60 +++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index 2fa4917..57abed2 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -1,7 +1,7 @@ # Selfhosting with HTTPS Since we handling a rather complex topic with this, it is separate from the [SELF_HOSTING.md](./SELF_HOSTING.md) which is focusing on how to run openGym. -This document is takes a more general approach on how to achieve "https at home", it is not necessarily focused on openGym and applies to self hosting in general. +This document takes a more general approach on how to achieve "https at home", it is not necessarily focused on openGym and applies to self hosting in general. When self hosting it is often thought of that one needs to expose their services to the internet, this is not necessarily the case. We can have https certificates without having to expose our precious hosts to the world. You can still do that if you want to access your applications from the internet without any VPN, but it's not necessary to take the risk. @@ -71,9 +71,61 @@ So how does it all come together? ### Tools -- DNS provider: -- let's encrypt client: -- reverse proxy: +- DNS provider: https://desec.io/ free and supports IPv6 and a certbot plugin +- let's encrypt client: certbot, officially supported by LE +- reverse proxy: caddy, lightweight and hackable. This is the tools I picked and that I know to work, your choice may be different and the setup is different as well. But the main tasks are the same, so you can adapt to your choice. + +1. register with desec.io and choose a name + 1. create a new A record that points to your service, e.g.: opengym.myhomelab.dedyn.io (desired name) - 192.168.0.100 (the ip of your homelab) + 2. create an API token for updating the domain settings (`Can create domains` and `Can delete domains` activated), be sure to note the token, it is only displayed once. +2. install certbot on your host + 1. most linux distributions provide the packages for this, e.g. debian: `apt install certbot python3-certbot-dns-desec` check the [docs](https://desec.readthedocs.io/en/latest/integrations/lets-encrypt.html) + 3. create a config file in `/etc/letsencrypt`: `desec.ini` `dns_desec_token = YOUR_TOKEN` + 3. run certbot to register + ```bash + certbot certonly \ + --authenticator dns-desec \ + --dns-desec-credentials /etc/letsencrypt/desec.ini \ + -m YOUR_EMAIL@HOST.TLD \ + --agree-tos \ + --no-eff-email \ + -d "opengym.myhomelab.dedyn.io" + ``` + 2. the certbot will also create a systemd service that checks and renews the certificates automatically. +3. install caddy + 1. most linux distributions provide the packages for this, e.g. debian: `apt install caddy` check the [docs](https://caddyserver.com/docs/install) + 2. create the caddy config, this is an example that should work: + ```jsonc + :443 { + header Content-Type text/html + respond < + caddy +

caddy works.

+ + HTML 200 + } + # define desec configuration + (desec) { + tls /etc/letsencrypt/live/opengym.myhomelab.dedyn.io/fullchain.pem /etc/letsencrypt/live/opengym.myhomelab.dedyn.io/privkey.pem { + protocols tls1.3 + } + } + # reverse proxy config + opengym.myhomelab.dedyn.io { + import desec + reverse_proxy http://192.168.0.100:8080 + } + ``` + be sure to check the docs for details. + +And that's about it. Now you should be able to access your opengym instance via https with working passkeys. Be sure to update the opengym config accordingly. + +### Alternatives + +- DNS providers: [certbot provider list](https://certbot.eff.org/hosting_providers) so many options... +- Let's encrypt clients: see [here](https://letsencrypt.org/docs/client-options/) +- reverse proxy: nginx proxymanager, easier with web GUI From 2ddcee00e0f37343c0792819b085dff1d53bb0ed Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 18:08:01 +0200 Subject: [PATCH 06/10] finalize --- docs/SELF_HOSTING_HTTPS.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index 57abed2..df379ac 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -8,6 +8,8 @@ We can have https certificates without having to expose our precious hosts to th Since VPN is a beast of it's own we'll only handle the certificates for now and grant https traffic to our local network hosts. +This guide assumes that you are running a Linux host, everything else is not covered. + ## Components Given we have the following setup: @@ -44,6 +46,8 @@ They provide tools to automatically create certificates with a challenge to ensu Therefore the tool needs to have access to the DNS provider to generate temporary TXT entries on the DNS entry. If all is checked, the certificate authority of Let's encrypt singns the certificate and it can be used. +We will make use of a wildcard certificate, so we can serve all our services with one certificate. + ### proxy A proxy is optional but desirable. It acts as sort of a gateway to our service and can be a single entrypoint to multiple services on our homelab. @@ -79,7 +83,8 @@ This is the tools I picked and that I know to work, your choice may be different But the main tasks are the same, so you can adapt to your choice. 1. register with desec.io and choose a name - 1. create a new A record that points to your service, e.g.: opengym.myhomelab.dedyn.io (desired name) - 192.168.0.100 (the ip of your homelab) + 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab) + 2. A wildcard certificate handles all certificates for that given host. e.g.: `opengym.myhomelab.dedyn.io` and `immich.myhomelab.dedyn.io` can share the same certificates. 2. create an API token for updating the domain settings (`Can create domains` and `Can delete domains` activated), be sure to note the token, it is only displayed once. 2. install certbot on your host 1. most linux distributions provide the packages for this, e.g. debian: `apt install certbot python3-certbot-dns-desec` check the [docs](https://desec.readthedocs.io/en/latest/integrations/lets-encrypt.html) @@ -92,7 +97,7 @@ But the main tasks are the same, so you can adapt to your choice. -m YOUR_EMAIL@HOST.TLD \ --agree-tos \ --no-eff-email \ - -d "opengym.myhomelab.dedyn.io" + -d "*.myhomelab.dedyn.io" ``` 2. the certbot will also create a systemd service that checks and renews the certificates automatically. 3. install caddy @@ -110,22 +115,35 @@ But the main tasks are the same, so you can adapt to your choice. } # define desec configuration (desec) { - tls /etc/letsencrypt/live/opengym.myhomelab.dedyn.io/fullchain.pem /etc/letsencrypt/live/opengym.myhomelab.dedyn.io/privkey.pem { + tls /etc/letsencrypt/live/myhomelab.dedyn.io/fullchain.pem /etc/letsencrypt/live/myhomelab.dedyn.io/privkey.pem { protocols tls1.3 } } - # reverse proxy config + # reverse proxy config for opengym opengym.myhomelab.dedyn.io { import desec reverse_proxy http://192.168.0.100:8080 } + # config for some other service + nextcloud.myhomelab.dedyn.io { + import desec + reverse_proxy http://192.168.0.100:8081 + } ``` be sure to check the docs for details. -And that's about it. Now you should be able to access your opengym instance via https with working passkeys. Be sure to update the opengym config accordingly. +And that's about it. Now you should be able to access your opengym instance from your local network via https with working passkeys. Be sure to update the opengym config accordingly. + + ### Alternatives - - DNS providers: [certbot provider list](https://certbot.eff.org/hosting_providers) so many options... - Let's encrypt clients: see [here](https://letsencrypt.org/docs/client-options/) - reverse proxy: nginx proxymanager, easier with web GUI + +## Conclusion + +We created a local-network-only access to our services with HTTPS using Let's encrypt, certbot and caddy. + +Next time we'll handle a VPN connection with wireguard, desec and automatic IP updater, so we can access our services from the internet. + From 39ffb44332e537507f7e524fdc73ffba16dcc2dc Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 18:15:27 +0200 Subject: [PATCH 07/10] doc links --- docs/SELF_HOSTING_HTTPS.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index df379ac..e7f4f3a 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -71,7 +71,7 @@ So how does it all come together? 1. DNS provider translates name to our local IP 1. the proxy listens to the local IP and provides HTTPS -1. Let's encrypt provides certificates +1. Let's encrypt provides certificates with certbot ### Tools @@ -82,9 +82,9 @@ So how does it all come together? This is the tools I picked and that I know to work, your choice may be different and the setup is different as well. But the main tasks are the same, so you can adapt to your choice. -1. register with desec.io and choose a name +1. register with desec.io and choose a name (we take `myhomelab` as example) 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab) - 2. A wildcard certificate handles all certificates for that given host. e.g.: `opengym.myhomelab.dedyn.io` and `immich.myhomelab.dedyn.io` can share the same certificates. + 2. A wildcard certificate handles all certificates for that given host. e.g.: `opengym.myhomelab.dedyn.io` and `nextcloud.myhomelab.dedyn.io` can share the same certificates. 2. create an API token for updating the domain settings (`Can create domains` and `Can delete domains` activated), be sure to note the token, it is only displayed once. 2. install certbot on your host 1. most linux distributions provide the packages for this, e.g. debian: `apt install certbot python3-certbot-dns-desec` check the [docs](https://desec.readthedocs.io/en/latest/integrations/lets-encrypt.html) @@ -130,10 +130,9 @@ But the main tasks are the same, so you can adapt to your choice. reverse_proxy http://192.168.0.100:8081 } ``` - be sure to check the docs for details. - -And that's about it. Now you should be able to access your opengym instance from your local network via https with working passkeys. Be sure to update the opengym config accordingly. +And that's about it. Now you should be able to access your opengym instance from your local network via https with working passkeys. +Be sure to update the opengym config accordingly. ### Alternatives @@ -143,7 +142,12 @@ And that's about it. Now you should be able to access your opengym instance from ## Conclusion -We created a local-network-only access to our services with HTTPS using Let's encrypt, certbot and caddy. +We created a local-network-only access to our services with HTTPS using Let's encrypt, certbot and caddy. +If something does not work, please check the corresponding documentation: +- [desec](https://desec.readthedocs.io/en/latest/index.html) +- [caddy](https://caddyserver.com/docs/) +- [Let's encrypt](https://letsencrypt.org/docs/) +- [certbot](https://certbot.eff.org/) Next time we'll handle a VPN connection with wireguard, desec and automatic IP updater, so we can access our services from the internet. From 28b10fbd1b9860b9ea7979114ea6f22423f01920 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 19:07:41 +0200 Subject: [PATCH 08/10] add info --- docs/SELF_HOSTING_HTTPS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index e7f4f3a..8067e78 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -82,6 +82,12 @@ So how does it all come together? This is the tools I picked and that I know to work, your choice may be different and the setup is different as well. But the main tasks are the same, so you can adapt to your choice. +Additional info: +- homelab host: 192.168.0.100 + running services: + - opengym on port 8080 + - nextcloud on port 8081 + 1. register with desec.io and choose a name (we take `myhomelab` as example) 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab) 2. A wildcard certificate handles all certificates for that given host. e.g.: `opengym.myhomelab.dedyn.io` and `nextcloud.myhomelab.dedyn.io` can share the same certificates. @@ -134,6 +140,12 @@ But the main tasks are the same, so you can adapt to your choice. And that's about it. Now you should be able to access your opengym instance from your local network via https with working passkeys. Be sure to update the opengym config accordingly. +usable URLs in this example: +- https://opengym.myhomelab.dedyn.io -> http://192.168.0.100:8080 +- https://nextcloud.myhomelab.dedyn.io -> http://192.168.0.100:8081 + +Note that the SSL/HTTPS termination is only at the proxy, the service does not have any certificates whatsoever. + ### Alternatives - DNS providers: [certbot provider list](https://certbot.eff.org/hosting_providers) so many options... From 41712200679950a908128207ff46f3ad5cd9a65e Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 19:08:54 +0200 Subject: [PATCH 09/10] indent [ci skip] --- docs/SELF_HOSTING_HTTPS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index 8067e78..098671e 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -84,9 +84,9 @@ But the main tasks are the same, so you can adapt to your choice. Additional info: - homelab host: 192.168.0.100 - running services: - - opengym on port 8080 - - nextcloud on port 8081 + running services: + - opengym on port 8080 + - nextcloud on port 8081 1. register with desec.io and choose a name (we take `myhomelab` as example) 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab) From d65b7cb9a42eb22b982804876d8fd28ba51e4543 Mon Sep 17 00:00:00 2001 From: andi242 Date: Sat, 29 Aug 2026 20:45:25 +0200 Subject: [PATCH 10/10] add explanations [ci skip] --- docs/SELF_HOSTING_HTTPS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/SELF_HOSTING_HTTPS.md b/docs/SELF_HOSTING_HTTPS.md index 098671e..8ed4aa4 100644 --- a/docs/SELF_HOSTING_HTTPS.md +++ b/docs/SELF_HOSTING_HTTPS.md @@ -69,7 +69,7 @@ Now we have a nice URL and can forget about the ports. The proxy reads the URL r So how does it all come together? -1. DNS provider translates name to our local IP +1. DNS provider translates name to the local IP of homelab (e.g.: `https://opengym.myhomelab.dedyn.io -> http://192.168.0.100:8080`) 1. the proxy listens to the local IP and provides HTTPS 1. Let's encrypt provides certificates with certbot @@ -89,7 +89,7 @@ Additional info: - nextcloud on port 8081 1. register with desec.io and choose a name (we take `myhomelab` as example) - 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab) + 1. create a new A record that points to your service, e.g.: `*.myhomelab.dedyn.io` (Wildcard!) - 192.168.0.100 (the ip of your homelab/mini PC/Raspberry Pi running the proxy) 2. A wildcard certificate handles all certificates for that given host. e.g.: `opengym.myhomelab.dedyn.io` and `nextcloud.myhomelab.dedyn.io` can share the same certificates. 2. create an API token for updating the domain settings (`Can create domains` and `Can delete domains` activated), be sure to note the token, it is only displayed once. 2. install certbot on your host @@ -141,8 +141,8 @@ And that's about it. Now you should be able to access your opengym instance from Be sure to update the opengym config accordingly. usable URLs in this example: -- https://opengym.myhomelab.dedyn.io -> http://192.168.0.100:8080 -- https://nextcloud.myhomelab.dedyn.io -> http://192.168.0.100:8081 +- `https://opengym.myhomelab.dedyn.io -> http://192.168.0.100:8080` +- `https://nextcloud.myhomelab.dedyn.io -> http://192.168.0.100:8081` Note that the SSL/HTTPS termination is only at the proxy, the service does not have any certificates whatsoever.