GUIDE

Self-hosted honeypot on a dedicated VPS

A complete first-run path: register the sensor, lock down admin SSH, and publish the decoy on the ports attackers actually scan.

On this page

  1. What you are building
  2. How it works
  3. 1. Register the honeypot
  4. 2. Copy the token once
  5. 3. Prepare the VPS
  6. 4. Install an SSH key
  7. 5. Open the provider firewall
  8. 6. Install Docker
  9. 7. Move admin SSH to 2222
  10. 8. Start the container
  11. 9. Verify
  12. First-run lessons

What you are building

Most installs sit behind a router or firewall. Docker publishes unprivileged ports on the host; NAT in front owns 22 / 23 / 80. Host SSH can stay on 22.

  • 9022 / 9023 / 9080 — decoy SSH, Telnet and HTTP on the host (container 22 / 23 / 8080).
  • WAN 22 / 23 / 80 — forwarded by the router or firewall in front. Do not steal host 22 unless this box has no NAT.
  • Attackers never get a shell or a cookie. Captured credentials go to jarnis.io over HTTPS.

Image: jarnis/honeypot:latest on Docker Hub (linux/amd64, arm64, arm/v7). Public — no login to pull. The only required environment variable is HONEYPOT_TOKEN.

How it works

The container is capture-only. Every SSH, Telnet and HTTP login fails. Nothing inside the decoy can become a foothold.

  1. You register a sensor in the app and copy the one-time token.
  2. Docker publishes host 9022 to container 22, 9023 to 23, and 9080 to 8080. NAT in front forwards WAN 22 / 23 / 80.
  3. The sensor checks in to jarnis.io over HTTPS, reports its public IP and process uptime (shown when you open the sensor in the app), and pulls banners and HTTP designs.
  4. Failed logins — username, password, source IP, service — are posted to your account. Domain credentials trigger an alert.

That is the default. Dedicated VPS with no NAT in front: publish 22:22, 23:23, 80:8080 and move admin SSH to 2222 (steps 5 and 7).

1. Register the honeypot

In the app open Honeypots, add a sensor, give it a name (for example Hostinger Honeypot) and optional notes. Leave the public IP empty — the container reports it on first check-in, including when the WAN address later changes. Check-in also reports process uptime, shown when you open the sensor in the app.

2. Copy the token once

Shown once. JARNIS stores only a hash. If you close the dialog without copying, rotate the token in the honeypot configuration. Never commit the token, paste it into a ticket, or leave it in shell history.

The secret looks like hpt_ plus hex. The configuration panel only shows the prefix afterwards.

3. Prepare the VPS

A small KVM is enough: 1 vCPU, 2–4 GiB RAM, 20 GB disk, public IPv4, Ubuntu 24.04 or 26.04 amd64. Confirm you can reach the provider’s browser console (VNC) before you touch SSH — that is the recovery path if a socket restart goes wrong.

4. Install an SSH key

Log in once with the panel password and install your public key. After that, prefer key login from every machine that administers the box. Do not copy one private key between laptops.

root@vps
mkdir -p /root/.ssh && chmod 700 /root/.ssh
echo 'ssh-ed25519 AAAA… you@admin-workstation' >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys

5. Open the provider firewall

Hostinger and similar panels often filter inbound traffic in front of the VM. Opening ufw on the guest is not enough. Allow TCP 22, 23, 80 and 2222 in the panel before you move SSH. Probe the new ports from another host before you drop port 22.

from your workstation
nc -zv YOUR_VPS_IP 22
nc -zv YOUR_VPS_IP 2222   # only after something is listening

6. Install Docker

On current Ubuntu the distro packages are enough. Do this while SSH is still on port 22.

root@vps
apt-get update
apt-get install -y docker.io docker-compose-v2 ca-certificates curl
systemctl enable --now docker
docker --version

7. Move admin SSH to 2222

Ubuntu 24.04 and 26.04 enable ssh.socket. Changing Port in sshd_config alone does nothing — systemd owns port 22. Add 2222 first, keep 22, confirm a new login, then drop 22.

Do not restart ssh.socket while anything else is bound to 2222. If the unit fails to listen, systemd can drop port 22 as well and you are locked out until the provider console or a reboot. Kill probe listeners first. ss -tlnp | grep 2222 must be empty.
root@vps — add 2222, keep 22
mkdir -p /etc/systemd/system/ssh.socket.d
cat > /etc/systemd/system/ssh.socket.d/listen.conf << 'EOF'
[Socket]
ListenStream=
ListenStream=0.0.0.0:22
ListenStream=[::]:22
ListenStream=0.0.0.0:2222
ListenStream=[::]:2222
BindIPv6Only=ipv6-only
EOF
ss -tlnp | grep 2222   # must print nothing
systemctl daemon-reload
systemctl restart ssh.socket
ss -tlnp | grep ssh

From a second terminal, log in on 2222 before you continue. Only then switch the socket to 2222 only:

root@vps — 2222 only (after a working login)
cat > /etc/systemd/system/ssh.socket.d/listen.conf << 'EOF'
[Socket]
ListenStream=
ListenStream=0.0.0.0:2222
ListenStream=[::]:2222
BindIPv6Only=ipv6-only
EOF
systemctl daemon-reload
systemctl restart ssh.socket

Update your SSH config on the workstation: Port 2222. Keep the provider console open until that login works.

8. Start the container

Put the token in a root-only env file. Default publish is 9022:22, 9023:23, 9080:8080. NAT WAN 22 / 23 / 80 to those host ports. The image listens on 22 / 23 / 8080 inside the container.

/root/jarnis-honeypot.env
HONEYPOT_TOKEN=hpt_paste_the_full_secret
root@vps
chmod 600 /root/jarnis-honeypot.env
docker pull jarnis/honeypot:latest
docker run -d --name jarnis-honeypot --restart unless-stopped \
  --memory 64m --cpus 0.25 --pids-limit 64 \
  --read-only --cap-drop ALL --security-opt no-new-privileges:true \
  --tmpfs /tmp:size=8m,mode=1777 \
  -v jarnis-honeypot-state:/var/lib/jarnis-honeypot \
  --env-file /root/jarnis-honeypot.env \
  -p 9022:22 -p 9023:23 -p 9080:8080 \
  jarnis/honeypot:latest
docker logs -f --tail 50 jarnis-honeypot

# Auto-update (part of a normal install; daily including weekends)
# Host timer — the container cannot pull Hub. Guide: /guides/honeypot-auto-update.html
# Compare the sums with the honeypot README on GitHub first — the script runs daily as root.
d=$(mktemp -d) && cd "$d"
for f in jarnis-honeypot-update.sh jarnis-honeypot-update.service jarnis-honeypot-update.timer; do
  curl -fsSL "https://jarnis.io/guides/$f" -o "$f"
done
cat > SHA256SUMS <<'EOF'
4a6951382267586225129d65cff6b0f57d0c780d35fe68a36bca9e4b1af16808  jarnis-honeypot-update.sh
d3d16961a46f16b432bd5f58e29a3f1bc50225e0a2ebb166a7c0bde73da56baa  jarnis-honeypot-update.service
04453fcb41355927022705b881f0ad145750f10cd3d8b4fb28103d8166e4e03c  jarnis-honeypot-update.timer
EOF
if sha256sum -c SHA256SUMS; then
  install -m 755 jarnis-honeypot-update.sh /usr/local/sbin/jarnis-honeypot-update
  install -m 644 jarnis-honeypot-update.service jarnis-honeypot-update.timer /etc/systemd/system/
  systemctl daemon-reload
  systemctl enable --now jarnis-honeypot-update.timer
else
  echo 'CHECKSUM MISMATCH — nothing installed'
fi
cd / && rm -rf "$d"
# Fallback without systemd:
# printf '%s\n' '20 4 * * * root /usr/local/sbin/jarnis-honeypot-update' > /etc/cron.d/jarnis-honeypot-update

The named volume jarnis-honeypot-state keeps the SSH host key and the last good sensor config (/var/lib/jarnis-honeypot, owner-only). The root filesystem is read-only, so without it every recreate shows scanners a new fingerprint — an easy honeypot tell — and the sensor cannot start with its banners while jarnis.io is unreachable. Keep the volume when you recreate or update.

The ports bind on all interfaces (0.0.0.0) on purpose: the decoy must be reachable from the internet. That is why admin SSH moves to 2222 first (step 7). Docker-published ports bypass ufw — ufw rules on the VPS do not hide or restrict them. Filter in the provider panel if you need to, and do not publish anything else from this host that you would not expose.

The SHA-256 sums in the block only catch transfer errors (they come from jarnis.io, like the files). Compare them with the honeypot README on GitHub before you install — the script runs daily as root.

The timer is part of a normal install. A stopped sensor with the current image makes the daily run fail — set ALLOW_STOPPED=1 in /etc/jarnis-honeypot-update.conf if you stopped it on purpose; the script never starts a stopped sensor (on a new image it is replaced but stays stopped). Full notes: keep the sensor current.

The 20 4 cron line and the 04:20 timer use the host timezone. On a host set to UTC that is 05:20 Europe/Vienna in winter. Every run (timer, cron, or manual) appends to /var/log/jarnis-honeypot-update.log. jarnis-honeypot-update --help or -h prints usage and does nothing else.

Fixed. A deliberately stopped sensor is replaced on update but stays stopped (updater SHA-256 4a695138…). If you disabled the timer because of this issue, install the updated script with the block above and re-enable it: sudo systemctl enable --now jarnis-honeypot-update.timer. Details.
Release note (update from Sept 2026). With this update each sensor's SSH banner (version string) changes once to a new value chosen per install, then stays stable. The SSH host key stays the same, so known_hosts entries do not change. A stopped sensor now makes the daily update run fail; set ALLOW_STOPPED=1 in /etc/jarnis-honeypot-update.conf if you stopped it on purpose.

No NAT and you need the decoy on host 22 / 23 / 80? Use -p 22:22 -p 23:23 -p 80:8080 instead, after admin SSH is on 2222.

9. Verify

  • ssh -p 2222 root@YOUR_VPS_IP still opens a real shell.
  • ssh user@YOUR_VPS_IP (port 22) is denied. That is the decoy.
  • curl -sI http://YOUR_VPS_IP/ returns the honeypot login page, not a directory listing.
  • Within a minute the honeypot leaves pending, the public IP appears, and a test login shows up under Events.

First-run lessons (do not skip)

  • The token cannot be read back from the database. Rotate if you lost it; the old container will stop authenticating.
  • Ubuntu’s socket-activated SSH is the #1 lockout. Dual-listen, confirm, then drop 22. Never combine a port probe on 2222 with systemctl restart ssh.socket.
  • If you do lock yourself out: reboot from the provider panel (not reinstall). If the 2222 drop-in is valid and the port is free, SSH comes back. Otherwise use the browser VNC console and remove /etc/systemd/system/ssh.socket.d/listen.conf, then systemctl daemon-reload && systemctl start ssh.socket.
  • Scanners hit WAN 80. NAT that to host 9080. Do not publish only 9080 to the internet unless that is what you intend.
  • Leave the endpoint empty for a VPS with a changing WAN address. JARNIS learns the reporter IP on the config poll.
  • Live sensor uses ~6 MB RAM. A 64 MB limit leaves room for other services without a 20× over-reserve.
  • The Docker Hub image jarnis/honeypot:latest is public (amd64, arm64, arm/v7). You do not log in to pull.
  • If logs show config fetch failed / i/o timeout to jarnis.io:443, the decoy is up but cannot check in. Outbound HTTPS to other sites can still work. Allow the VPS IP on the office / ISP firewall in front of jarnis.io, or put the API behind a public anycast (Cloudflare). Until then the sensor stays pending.
Also see the image on Docker Hub and the Installation tab of the honeypot in the app. Questions: hello@jarnis.io.