僕のブログへようこそ!

Welcome to my blog!

  • This is a place for me to share anything that I’m interested in.

UFW Cheatsheet

Making a ufw cheatsheet since I’m always searching how to do this everytime I need to setup the firewall. Basics Command Description sudo ufw enable Enable UFW firewall sudo ufw disable Disable UFW firewall sudo ufw status Show current rules (simple) sudo ufw status verbose Show detailed rule info sudo ufw reload Reload UFW rules sudo ufw reset Reset all UFW rules (starts fresh) Default Policies Command Description sudo ufw default deny incoming Block all incoming connections sudo ufw default allow outgoing Allow all outgoing connections sudo ufw default deny outgoing Block all outgoing connections Allow Rules Command Example Description sudo ufw allow 22 Allow SSH on all interfaces sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp Allow SSH from LAN only sudo ufw allow in on eth0 to any port 80 proto tcp Allow HTTP on interface eth0 sudo ufw allow out to any port 443 proto tcp Allow HTTPS outbound Deny Rules Command Example Description sudo ufw deny 22 Block SSH sudo ufw deny out to any port 80 proto tcp Block HTTP outbound Delete Rules Command Example Description sudo ufw status numbered View rule numbers sudo ufw delete [number] Delete rule by number sudo ufw delete allow 22 Delete rule by definition Common Ports Service Port(s) SSH 22 HTTP 80 HTTPS 443 Cockpit 9090 Portainer 9443, 8000 Docker Registry 5000 Samba (SMB) 139, 445 DNS 53 NTP 123 ICMP (ping) (not a port, use proto) Advanced Command Example Description sudo ufw allow proto icmp Allow ping (ICMP) sudo ufw limit 22/tcp Rate-limit SSH (prevent brute-force) sudo ufw allow from 192.168.1.100 Allow all ports from one IP sudo ufw allow out to 8.8.8.8 port 53 proto udp Allow DNS to Google only UFW Command Keywords Keyword Description enable Turns on the firewall, applying the current rules. disable Turns off the firewall (all rules stop being enforced). allow Allows specific traffic based on your criteria. deny Denies or blocks specific traffic. delete Removes a rule. Often used with rule numbers (ufw status numbered shows these). from [IP/subnet] Specifies the source IP address or subnet the rule applies to. to any port [PORT] Specifies the destination port on your server that the rule targets. proto specifies the protocol in The rule applies to incoming traffic. out The rule applies to outgoing traffic. on [interface] Applies the rule only on a specific network interface. limit Enables rate limiting on a port to reduce brute-force attacks.

May 26, 2025 · 2 min · 407 words

Docker Registry With SSL And Basic Auth For Homelab

Got myself a mini pc this weekend and installed ubuntu server 24.04. One of the apps that I really wanted to host is a docker registry. This was the first time that I have done this so might as well document the process. Install Docker Since the docker registry will run on docker make sure that docker is installed. I know it’s obvious but putting it here just to be sure. ...

May 25, 2025 · 3 min · 438 words

Thinking About Starting a Homelab

I’ve been entertaining the idea of starting a homelab a few months ago but never found the time to really start one. And for a while It’s been out of my mind until recently the thought came back and I suddenly have this urge to make one. The Plan I’m planning to start with a single mini pc as the server. It would look like something like the image below. ...

May 23, 2025 · 2 min · 342 words

世界、こんにちは!

So, why start a blog? Nothing in particular. Like most of my hobbies, this too started on a whim. There’s no clear or practical goal aside from personal enjoyment. Speaking of hobbies, I have many. And I really like the idea of having somewhere to post anything about what I am currently interested in, curious about, or obsessing with without thinking of likes, algorithms, engagement or any other thing that comes with social media. ...

May 21, 2025 · 2 min · 271 words