liveBook · Manning

Firewall

As explained in Road to Kubernetes

A firewall is a network security system that filters traffic according to configured rules governing hosts, protocols, or ports.

A firewall filters network traffic so a virtual machine exposes only the ports it needs. In a manual deployment, it closes the application ports while leaving NGINX and SSH reachable. section 3.6.2 section 3.7

Configure UFW in this order:

  • Install Uncomplicated Firewall (UFW) with apt. section 3.6.2
  • Allow SSH on port 22 so remote administration and Git pushes continue to work. section 3.6.2
  • Allow Nginx Full, which permits HTTP on port 80 and HTTPS on port 443. section 3.6.2
  • Review the added rules, then enable the firewall and confirm the activation prompt. section 3.6.2

Protecting the deployed applications

After NGINX routes the root URL to the Python application and /js to the Node.js application, UFW blocks direct access to their ports while preserving web access through NGINX. Forgetting the SSH rule can terminate the current session and remove remote access. section 3.6.1 section 3.6.2

sudo ufw allow ssh
sudo ufw allow 'Nginx Full'

Use the UFW rules to allow SSH and NGINX traffic before enabling the firewall. section 3.6.2

How Road to Kubernetes covers it

How deep it goes
Provides a procedural UFW setup with installation, allow rules, verification, activation, and an SSH lockout warning.
Examples
Uses UFW commands to allow SSH and Nginx Full, inspect added rules, and enable protection on a VM hosting Python and Node.js applications.
What it assumes
Assumes a remote VM, SSH access, and NGINX configuration; teaches firewall installation and rules from the beginning.
What you can do after
Operate/configure it with UFW to expose ports 22, 80, and 443 while blocking other unnecessary access.
How it connects
Connects firewalls with ports, NGINX, reverse proxies, HTTP, HTTPS, SSH, and virtual machines.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.