In computing, a firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules. A firewall typically establishes a barrier between a trusted network and an untrusted network, such as the Internet.
As explained in the web stack debuggingtelnet is a very good tool to check if sockets are open with telnet IP PORT. For example, if you want to check if port 22 is open on web-02 or on your web server:
user@ubuntu$ telnet web-02.holberton.online 22
Trying 54.89.38.100...
Connected to web-02.holberton.online.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
Protocol mismatch.
Connection closed by foreign host.
user@ubuntu$
We can see for this example that the connection is successful: Connected to web-02.holberton.online.
Now let’s try connecting to port 2222:
user@ubuntu$ telnet web-02.holberton.online 2222
Trying 54.89.38.100...
^C
user@ubuntu$
We can see that the connection never succeeds, so after some time I just use ctrl+c to kill the process.
This can be used for any debugging situation where two pieces of software need to communicate over sockets.
Warning
Containers on demand cannot be used for this project (Docker container limitation)
Be very careful with firewall rules! For instance, if you ever deny port 22/TCP and log out of your server, you will not be able to reconnect to your server via SSH, and we will not be able to recover it. When you install UFW, port 22 is blocked by default, so you should unblock it immediately before logging out of your server.