Server security, simply
How a server with no doors on the street works, explained with one building.
The 14 slides
the street = the internet
my server
Self-hosting, explained
Is my server safe?
Server security, explained with one building.
the street = the internet
my server
← about 20 shops: my apps
Hetzner owns the building. I run everything inside.
The server
My server is a building I rent
Hetzner owns it. Everything inside is mine to run. About 20 apps are inside, like shops. The people using them are the customers.
Server = building · apps = shops · users = customers
the street = the internet
my server
Server St. 1
bots, 24/7
IP address
Anyone can find the address
The street address is public. And these days, bots walk every street, day and night, trying every door they see.
IP address = the street address
the street = the internet
my server
front door: for customers (HTTPS, port 443)
service door: only for me (SSH, port 22)
Open ports
Every open port is a door on the street
Each door is a way in. A typical server has a front door where customers come in for the websites, and a service door where the owner comes in to manage everything.
Port = a door ·
443 = HTTPS (websites) ·
22 = SSH (admin)
The whole setup
Two entrances, nothing else
Customer entrance
Protected by Cloudflare
The websites, for everyone
Admin entrance
Protected by Tailscale
SSH and my own tools, only my devices
the street = the internet
my server
the master key
SSH
SSH is the master key
Whoever gets in through the service door can do anything inside. So the real question is: who can even reach that door?
SSH (port 22) = the master key
the street = the internet
my server
bricked up
my laptop + phone only
private corridor
Tailscale
I bricked up the service door
The only way to the master-key door is now a private corridor. Only my own laptop and phone know it exists.
Tailscale = a private network (VPN) for my devices
the street = the internet
my server
Cloudflare’s front desk
pipe from inside
Cloudflare tunnel
Customers go to the front desk
Customers never come to my building. They go to a front desk across the street. My building collects their messages through a pipe it opened from the inside.
Front desk = reverse proxy ·
pipe = outbound tunnel
the street = the internet
my server
Cloudflare’s front desk
knock knock… nothing
The result
No doors on the street
The front door is gone too: websites come in through the pipe. Inside, every shop’s door opens onto the hallway, not the street. Knock on the building and nothing answers.
Firewall: no open ports ·
apps listen on localhost
Where do you put your apps?
Hotel room, or an empty building?
Vercel · Heroku · Fly
A hotel room
Bring only your suitcase: your code. Everything else is done for you, but you pay per room and follow their rules.
Doors: they guard them.
Hetzner (me)
An empty building
No services, one fixed low rent. Room for 20 shops. Everything inside I do myself.
Doors: I guard them.
Q&A
The questions people asked me
How do they find me? Can't they just break in? Isn't the problem just moved?
Q&A · 1 of 3
How do they find me?
An IP address is public, but how do they find mine?
Bots knock on every address on the internet, all of them, in minutes. Registers also show which addresses belong to Hetzner. So assume they find the building. What matters is that it doesn't answer.
Why is the front door number 443?
Just an agreement. Every browser knocks on 443 for https. In my setup that door is at Cloudflare's front desk, not at my building.
And the back door, 22? What is SSH?
SSH = Secure Shell: a command line inside the server, so the master key. Port 22 is also just an agreement, which is why every bot tries it first.
Q&A · 2 of 3
Can't they just break in?
Can bots crack SSH? If not, why hide the door?
With a key instead of a password: not by guessing. But every few years someone finds a flaw in the lock itself (2024: twice). Then every visible door gets tried within hours. A door that isn't there can't be tried.
Why can't anyone see the Tailscale door?
It has an address that only exists inside my private network. On the public address the admin door stays silent: knock, and you hear nothing.
What's a forgotten door, and what's a bad lock?
Forgotten door: a test database left open. Now it's simply unreachable. Bad lock: a live app with a weak login. That one is still my job.
Q&A · 3 of 3
Isn't the problem just moved?
Isn't Cloudflare now the weak spot?
Partly moved, mostly smaller. Ten doors to guard became one, guarded by a company that does nothing else. The trade-off: Cloudflare sees the traffic pass.
If everything goes through Cloudflare, why Tailscale?
Cloudflare handles customers, Tailscale handles me. Separate, so if the front desk is down I can still get in to fix it.
What are a reverse proxy and an outbound tunnel?
Reverse proxy = the front desk that takes requests and passes them on. Outbound tunnel = a pipe my building opened from the inside.
Want this set up with your team in one day? Training: Set up your own Hetzner VPS, $1,490.