Step 6 of 7 · lab · 35 min
Too much is visible from the network
The warehouse server runs a site, a database and an admin panel, and only the site and SSH should be visible from the network. Find what else is open to the outside and close it so that everything still works on the server itself, after a reboot too.
Situation
node1 runs the Sever warehouse. nginx serves the customer site on port 80. The stock is kept in the
PostgreSQL database stock and edited in the admin panel, the lab-admin service. The admin panel is used only
from the server itself, through an SSH tunnel, and only the admin panel needs the database. A security scanner has
sent a report: more than the site and SSH is visible on node1 from the network.
node2 is a neighbouring machine on the same network. From there node1 looks the way it does to any outside
address: ssh node2 'command'. sudo works without a password on both machines.
Task
- From the network, node1 answers only on SSH (port
22) and the site (port80). Everything else is closed to node2 and to other addresses on the network, over IPv4 and over IPv6. - SSH and the site
http://node1/are open to node2 and to other addresses on the network. - On node1 itself the database and the admin panel work as before:
curl http://127.0.0.1:8080/shows the stock from thestockdatabase. - It stays so after node1 reboots.
The lab has no internet access, only the network between node1 and node2. Everything you need is installed on both machines. You reach node2 from node1 over SSH, and so does the check: don't close that path.
Lab · on your own
No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.
Goals
0 of 4-
Everything on node1 except SSH (22) and the site (80) is closed to the network — to node2 and other addresses, over IPv4 and IPv6 — not done yet
-
SSH (22) and the site http://node1/ (80) are open to node2 and other addresses on the network — not done yet
-
The database and the admin panel work on node1 — curl http://127.0.0.1:8080/ shows the stock from the stock database — not done yet
-
It stays so after node1 reboots — the settings and rules are saved in files and the services are enabled — not done yet
The machine is starting
Hints
0 of 3Lab goals
0 of 4-
Everything on node1 except SSH (22) and the site (80) is closed to the network — to node2 and other addresses, over IPv4 and IPv6 — not done yet
-
SSH (22) and the site http://node1/ (80) are open to node2 and other addresses on the network — not done yet
-
The database and the admin panel work on node1 — curl http://127.0.0.1:8080/ shows the stock from the stock database — not done yet
-
It stays so after node1 reboots — the settings and rules are saved in files and the services are enabled — not done yet
Goals are checked on the machine after every command.