From b6f142c6feb5209ee34b203679aa430d2003e080 Mon Sep 17 00:00:00 2001
From: Luke Smith ufw to restrict machines on the internet to only access the services (SSH, websites etc) you want them to, but it can also be used to prevent programs on the computer itself from accesing parts of the internet it shouldn't.
- If you're reading this, I'll assume you have set up a server on Vultr. -
-Log into your server by pulling up a terminal and typing:
-ssh root@yourdomain.com
+ ssh root@example.org
This command will attempt to log into your server and run a remote shell.
If you leave the settings default, it should prompt you for your password, and you can just copy or type in the password from Vultr's site.
- If you did not set up your DNS yet, replace yourdomain.com with the IP address that Vultr gives you.
- If you followed setting up your webserver, then you know that Vultr already installed ufw for you.
- If you don't use Vultr, then you can install it on a Debian system by running in your remote shell:
+ Some VPS providers automatically install ufw, but if you do not have it installed already, install it in the typical way:
apt-get update && apt-get install ufw
-
-
- The first command checks to see what packages can be installed, and the second command installs ufw.
- It's strung together by a && to run the second command as long as the first succeeded.
-
apt install ufw
Here is a list of a few common services: +ufw default deny incoming # block all incoming connections by default @@ -96,19 +84,6 @@ To Action From-ufw delete allow in 'WWW Full' ufw reloadRecovering SSH
- -- If you have accidentally firewalled yourself from logging on your computer, you can recover access by using Vultr's console. - Looking at your server in the Vultr menu, you should see a meatball menu on the right which gives you access to a console. -
- -- -
Log in through there, and disable ufw by typing:
- --ufw disableEnabling Common Services
@@ -117,10 +92,31 @@ ufw reload
Suppose you install a Gemini server, which must broadcast on port 1965. By default ufw blocks all incoming connections on all ports, so whenever you install a new service like this you will have to tell ufw to enable the desired port:
ufw allow 1985
+
ufw allow in 'WWW Full'
-ufw reload
+ HTTP uses port 80 and HTTPS uses port 443. We can enable them like this:
+ +ufw allow 80
+ufw allow 443
+
+ But ufw additionally knows the typical ports of common serives, so you can also run this:
ufw allow http
+ufw allow https
+
+ And that will do the same thing. There are also other abbreviations for common port lists:
+ +ufw allow in 'WWW Full'
+
+
+ To see these other "apps" that ufw knows by default, run ufw app list
You can view all applications ufw knows about by running:
ufw app list
+ufw allow in 'Mail Submission'
man ufw
+ + If you have accidentally firewalled yourself from logging on your computer, you can recover access by using your VPS's virtual console. + On Vultr, this is on your VPS's menu. To the right of the server name, It is the leftmost icon that looks like a monitor. +
+ +
+
+ Log in through there, and disable ufw by typing:
+ +ufw disable
+
+