> ## Content Index
> Fetch the complete content index at: https://blog.sudowl.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Self-Hosted One-Time Secret Links With Hemmelig, Docker and Apache
- URL: https://blog.sudowl.com/self-hosted-one-time-secret-links/
- Published: 2026-11-13T10:00:00.000Z
- Updated: 2026-11-18T12:34:02.000Z
- Description: Hemmelig v7 in Docker behind an Apache proxy for sending passwords to clients and getting theirs back. Setup, rate limit, backup and the archived repo.
- Author: Lukas
- Tags: Docker, Security, Linux

I send passwords to clients. Clients send passwords to me. For years that happened over mail and chat, which means every one of those passwords is still sitting in some inbox or chat history today.

So I set up a one-time secret service on my own server. I paste a password, get a link, send the link. The client opens it once and it's gone. And the part I actually wanted: I can send a client a request link, and they put their credentials in on their side.

**TL;DR:** Hemmelig v7 (`hemmeligapp/hemmelig:v7`) in Docker compose, bound to `127.0.0.1`, behind Apache as a reverse proxy on a small VPS running KeyHelp. SQLite, registration off, anonymous secrets allowed, rate limit 30 requests per 60 seconds, trusted proxy set to the Docker range so the rate limit sees real visitor IPs. Nightly local backup, kept 14 days. Offsite backup is still missing. Big caveat: the Hemmelig repo was archived on 5 October 2026, so no more security fixes. I'm using it for now and looking at alternatives.

## Why Hemmelig

Two directions, both matter to me:

- **Me to the client.** I create a secret, get a link. Default is 1 view and 72 hours. After that it's gone.
- **Client to me.** Hemmelig has "Secret Requests". In the dashboard I create a request link and send it to the client. They type their credentials in, it gets encrypted in their browser, and I read it in my dashboard. The client gets a decryption key after submitting and has to send me that key on a different channel, for example by SMS. Without the key I can't open it either.

I had used a Hemmelig instance someone else ran, so I knew how it feels for the person on the other end. That second direction was the reason I picked it.

## The compose file

```yaml
services:
  hemmelig:
    image: hemmeligapp/hemmelig:v7
    container_name: hemmelig
    restart: unless-stopped
    env_file: .env
    ports:
      - "127.0.0.1:3070:3000"
    volumes:
      - ./database:/app/database
      - ./uploads:/app/uploads

```

The container listens on 3000\. I map it to `127.0.0.1:3070` on the host, so it's only reachable through the proxy. The SQLite database lives in `/app/database`, uploaded files in `/app/uploads`. Both need a volume or they're gone with the next container update.

The `.env`, with the secret replaced:

```bash
BETTER_AUTH_SECRET=generate-with-openssl-rand-base64-48
BETTER_AUTH_URL=https://secrets.example.com
HEMMELIG_BASE_URL=https://secrets.example.com
HEMMELIG_ANALYTICS_ENABLED=false
HEMMELIG_INSTANCE_NAME=My Secrets
HEMMELIG_DEFAULT_THEME=light
HEMMELIG_TRUSTED_PROXIES=172.16.0.0/12

```

Generate the auth secret with `openssl rand -base64 48`, `chmod 600 .env`, then `docker compose up -d`. On first start the container runs its database migrations and then answers on `/api/health/ready`:

```bash
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:3070/

```

If you don't have Docker on the box yet, that's [Docker on Ubuntu](/docker-install-ubuntu/). If you're on KeyHelp like me, read [KeyHelp's firewall breaking Docker](/keyhelp-firewall-breaks-docker/) first.

## Finding the settings that actually exist

The docs and the README didn't agree on everything. They even used two different image names. So I asked the image itself which environment variables it reads:

```bash
docker exec hemmelig sh -c \
  'grep -rho "HEMMELIG_[A-Z_]*" /app --exclude-dir=node_modules | sort -u'

```

That gave me 56 names, from `HEMMELIG_ALLOW_REGISTRATION` to `HEMMELIG_RATE_LIMIT_REQUESTS` and `HEMMELIG_TRUSTED_PROXIES`. The defaults are in `/app/api/config.ts`. That's where I saw that registration is on by default and the rate limit is 100 requests per 60 seconds.

Most of these are only starting values. Once the admin saves settings in the UI, they live in the SQLite database. There is a managed mode where environment variables control everything. I didn't use it.

## Admin account, registration off

I signed up my own account through the API, then gave it the admin role directly in SQLite:

```bash
sqlite3 database/hemmelig.db \
  "update user set role='admin' where email='admin@example.com';"

```

After that, in the admin settings: registration off. I tested it with a sign-up request for a fake account. The answer was "Registration is disabled". New users can only come in through me.

## Gotcha: anonymous secrets, yes or no

My first setup required login to create secrets. Then I changed my mind the same day. The instance I knew from the client side lets anyone create a link without an account, and that's the point for a client who just wants to send me something quickly without a request link.

So now: registration off, anonymous secrets on. Nobody can get an account, but anyone can create a one-time link. I tested that over the public URL and deleted the test secret afterwards.

The honest downside: an open form like that can be used by strangers as a storage drop. The rate limit makes it annoying, not impossible. If I see that happening, the next step is to turn off file uploads for people without a login.

## Gotcha: the rate limit needs the real IP

Rate limit in the admin settings: on, 30 requests per 60 seconds.

But behind a reverse proxy, every request reaches the container from the same address. Apache runs on the host and talks to the container through the Docker bridge gateway, on my box `172.17.0.1`. Without telling Hemmelig to trust that, all visitors share one counter, and 30 requests per minute for the whole internet is nothing.

That's what `HEMMELIG_TRUSTED_PROXIES=172.16.0.0/12` is for. It covers the private range Docker uses for its default networks. Requests from there may set the forwarded client IP header, and the rate limit counts per real visitor again. Check your own gateway with:

```bash
docker inspect hemmelig --format '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}'

```

## Apache in front

In KeyHelp I created the domain and put these into the HTTPS directives field:

```apache
ProxyPreserveHost On
ProxyPass /.well-known/acme-challenge !
ProxyPass / http://127.0.0.1:3070/
ProxyPassReverse / http://127.0.0.1:3070/
RequestHeader set X-Forwarded-Proto "https"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "no-referrer"
Header always set X-Robots-Tag "noindex, nofollow"

```

The ACME exclusion keeps Let's Encrypt validation away from the app. `no-referrer` because nothing from a secrets page should leak into another site's logs. And `noindex`, because a secrets tool has no business in search results.

Without KeyHelp, the same lines go into a normal `<VirtualHost *:443>`. More on that in [Apache as a reverse proxy for Docker apps](/apache-reverse-proxy-docker-apps/).

## Gotcha: no HTTPS vhost before the certificate

KeyHelp only writes the HTTPS vhost once Let's Encrypt is on for the domain, and Let's Encrypt only works once DNS points at the server. So the order is: DNS record first, then Let's Encrypt in the panel, then test. Until then the directives are saved but do nothing.

And don't force the cert job by hand. The day before, I did that on the same server and [took Apache down for 21 minutes](/keyhelp-letsencrypt-race-apache-down/). This time I turned on Let's Encrypt and let the panel do it.

## Backup

```cron
# /etc/cron.d/hemmelig-backup
20 3 * * * root sqlite3 /opt/hemmelig/database/hemmelig.db ".backup /opt/hemmelig/backups/hemmelig-$(date +\%F).db" && gzip -f /opt/hemmelig/backups/hemmelig-$(date +\%F).db && find /opt/hemmelig/backups -name "*.gz" -mtime +14 -delete

```

`sqlite3 .backup` makes a consistent copy while the app is running, unlike copying the file. Gzip, keep 14 days.

Two honest gaps. The backup stays on the same server, so if the server dies, the backup dies with it. Offsite is still on my list. And the `uploads` folder isn't in it, only the database. For short-lived secrets I can live with that for now. My reminder to myself on why "it runs every night" is not enough: [my backups were silently dead for 7 weeks](/backups-silently-dead-check-backup-freshness/).

## The big caveat: the project is archived

While I was reading the docs, I saw the GitHub repo is archived since 5 October 2026\. Read-only, no more fixes, no more releases. The image I'm running was built on 25 September 2026\. It works. But it won't get security fixes anymore, and it's a tool for passwords, open on the internet.

I decided to use it anyway for now, because the request links are the feature I wanted. But it's on my list to evaluate alternatives. Yopass is the one I'll look at first. It's actively maintained and small. As far as I can tell it only does the "me to the client" direction and has no request links, so I'd lose that.

Until then: the container only listens on localhost, Apache is the only way in, registration is off, and the data in it is meant to disappear after one view anyway.

---

### Related posts

- [My Hosting Panel's Firewall Kept Wiping Docker's iptables Chains](https://blog.sudowl.com/keyhelp-firewall-breaks-docker/)
- [Headscale — Self-Hosted Tailscale Control Plane on Ubuntu](https://blog.sudowl.com/headscale-self-hosted-tailscale/)
- [KeyHelp Let's Encrypt Race: Two Cert Jobs Took Apache Down for 21 Minutes](https://blog.sudowl.com/keyhelp-letsencrypt-race-apache-down/)