And yes, welcome to our first demonstration,
a demonstration where we're going to go through and examine some of the
basic configuration of our uncomplicated firewall.
We'll take a look at viewing the default file,
allowing inbound SSH traffic, and then, and only then,
do we enable our firewall just to make sure everything we
need to manage the system is all set up.
Hey, hey, and welcome.
Look at this, the command line of my Ubuntu system.
Let's raise my privileges.
Most things that I'm going to be doing with UFW will require root privileges,
so I'm going to open up my shell.
If I go through and check the status of the firewall,
we can see on this system, at any rate,
it's a brand‑new 2020 system from VirtualBox,
and we can see then the firewall is inactive.
Let's go through and check our default file so we know the
default rules are going to be in place.
If I go through and open this up, /etc/default/ufw,
one of the first things I can see that we work both with
IP version 4 and IP version 6 rules.
So this is most useful to me because even if I'm not using IP version 6,
it's good to block the traffic, especially if I don't think that I'm using it.
As we move further down, though,
we can see the next setting is our DEFAULT_INPUT_POLICY, which is to DROP.
Now there are no rules in place by default,
so that does mean then all inbound traffic is going to be dropped.
So we need to be very careful before we enable our firewall,
we need to make sure that any of our basic services,
such as SSH, is allowed through.
Now, if we do recall, this is the uncomplicated firewall,
so implementing rules should be relatively straightforward. So it's ufw allow,
and then I want to allow ssh traffic, and it's as simple as that.
We can see what it's done,
it's implemented both an allow rule for IP version 4 and IP version 6.
We can drill down on this a little more later,
but for the moment, let's go through and check our status.
The status won't have changed because our firewall
is still not active or enabled,
so we can now go through and safely enable our service.
It will warn me that potentially enabling a service is
going to disrupt existing SSH connections.
I can say yes because I know I've set up the allow rule.
And now, when we go through and take a look at our status,
we can see the two rules that we have in place.
Now we can see this in more detail if we want by including the option verbose.
When we look at the option verbose,
it's going to show me some of the default rules,
as well as the logging options.
And another way I can see the information is using a numbered format.
This becomes useful when I want to delete rules because I can
delete them by the rule name or the number.
So we can see now I've got two rules, rule number 1 and rule number 2.
I say this becomes really useful to me.
I use this all of the time for deleting rules.
We're going to take a look now at how we manage our rules in a little bit more detail.