Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

Just in case, make sure you can obtain console access before running this. If using virtual hosting most providers have a feature to emulate a console mode through their administration systems.

Code Block
languagebash
# enables the the firewall and provided the command executed properly allows #allows ssh traffic in one step
sudo ufw enable && sudo ufw allow 22
Note

Note to self, consider modifying the command to run in background process.

...

Code Block
languagebash
sudo ufw allow 80 # Web Server
sudo ufw allow 443 # SSL over Web Server

Before starting UFW make sure you have port 22 open you can check by running the allow 22 command again and if the rule is added should output.

"Skipping adding existing rule"

After you have confirmed 22 is open you can go ahead and enable UFW.

Code Block
languagebash
sudo ufw enable

Finally check that all your rules are in place,

Code Block
sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing)
New profiles: skip

To                         Action      From
--                         ------      ----
22                         ALLOW IN    Anywhere
80                         ALLOW IN    Anywhere
443                        ALLOW IN    Anywhere

ufw status verbose does not work if UFW is not enabled.

There is much more to ufw but the above steps should get you going.

...