Mole
← ~john | SSH port forwarding, Caddy reverse proxy & DDNS daemon
about
Mole (moled) is a lightweight, zero-dependency background daemon written in C for managing SSH port forwards, reverse tunnels, Caddy reverse proxy routes, and Dynamic DNS updates through a responsive WebUI.
- Remote Reverse Tunneling (
-R): Expose internal ports (localhost:20128,192.168.1.1:8080) to remote SSH endpoints. - Local Forwarding (
-L) & SOCKS5 (-D): Local mapping and dynamic proxy tunneling. - Dynamic DNS (DDNS) Sync: Native scheduled IP sync for Cloudflare (v4 API), DuckDNS, No-IP, and custom webhook HTTP endpoints.
- Process Supervisor: Native keepalive loop auto-restarts dropped connections.
- Caddy Integration: Generates reverse-proxy configuration blocks and reloads Caddy dynamically.
- Multi-Init Ready: Includes service manifests for systemd, OpenRC, SysVinit, runit, dinit, and launchd.
install via apk (alpine linux)
Add the repository and signing key:
wget -P /etc/apk/keys/ https://tilde.horse/~john/repo/alpine/john.rsa.pub echo "https://tilde.horse/~john/repo/alpine" >> /etc/apk/repositories apk update apk add mole mole-openrc
Packages available for x86_64 and aarch64 (ARM64).
quick start
Run daemon in foreground or as a background service:
moled -p 8888 -u admin -w secret123 # Open http://localhost:8888 in browser
CLI options:
Usage: moled [options] -d, --daemon Run in background as Unix daemon -p, --port <port> HTTP WebUI port (default: 8888) -b, --bind <ip> Bind IP address (default: 0.0.0.0) -u, --user <user> Basic Auth user (default: admin) -w, --pass <pass> Basic Auth password (default: admin123) -D, --db <path> SQLite database path (default: /var/lib/moled/mole.db) -P, --pidfile <path> PID file path (default: /run/moled.pid) -c, --caddy <path> Caddy snippet path (default: /etc/caddy/Caddyfile.d/mole.caddy)
source code
- Forgejo: git.tilde.horse/john/mole
- Clone:
git clone ssh://forgejo@git.tilde.horse/john/mole.git
Build from source (requires GCC and SQLite3):
git clone https://git.tilde.horse/john/mole.git cd mole make sudo make install