Linux firewall.
What it is?
Do you need?
How to set up and configure it.
Everything in this video.
Before I start I would like to let you know that I am not a computer security expert and
this video just presents my point of view.
I am just an average Linux user as you are.
If you follow my instruction, do it with caution.
So…
What is a firewall?
A firewall is a network security program that controls the incoming and outgoing connections
based on the rules that are set.
In simple words, it is a sort of wall between your computer and outside network.
Do you need a firewall?
You may think it is good to have.
And you will be right!
However, all Linux distribution come without a firewall.
To be more correct with inactive firewall.
Because the Linux kernel has build-in firewall, so technically all Linux distros have a firewall
but it is not configured and activated.
I believe it is because using a firewall require some expertise.
But don't worry, you Linux is still secure even without an active firewall.
By default, most of the distributions such as Ubuntu and Linux Mint have no open ports,
so your computer cannot be accessed by intruders.
Nevertheless, I recommend to activate a firewall.
It is better to be safe than sorry.
It doesn't use many resources, but it adds extra layer of security.
An inexperienced user can accidentally open some ports without knowing it.
For example, by installing samba, ssh, apache.
In this case, firewall will still protect the system.
How to set up a firewall?
I will show you two ways to set up a firewall.
UFW – which is probably the most user friendly firewall available in Linux.
and iptables - which is a more advanced but probably a proper way to configure the Linux Firewall.
Do you use a firewall?
What firewall do you use?
Let's collect some stats by voting here!
UFW If you prefer to have graphical interface,
simply install GUFW.
Open it and enable.
That's it.
Your firewall is active and the default settings to deny incoming and allow outgoing connections
is fine for most users.
No one will be able to connect to your computer, while any application in your computer would
be able to reach the outside world.
If you need to open some ports to be able to conned to your computer from the outside,
you go to the rules tab and open ports for specific application.
For example, if you need to access you computer remotely through ssh, you select ssh.
GUFW is a very simple and effective firewall application.
You can use UFW from terminal too.
Enable it.
Check its status:
Here are the same rules to deny incoming and allow outgoing.
If you need to open some ports.
It is as simple as to run
to allow ssh access to your computer.
If you check the status again,
You can see ssh is allowed.
You can read more about settings of UFW in its man page.
I believe 99% of users can stop here, because UFW will be more than enough for them.
But if you want some hard core Linux experience, you can try to configure and use iptables.
Iptables iptables are not easy to understand.
Honestly, I tried to use iptables many times on my system, and I always come back to UFW.
You need to read a lot to understand how iptables works and how to configure it for your needs.
For example, this is the iptables process flow.
Quite complicated, isn't it?
Without going to deep, I will just say that for beginners it is important to know that
Input is a chain is used to control the behavior for incoming connections.
This is where you mostly deny connections.
Output is a chain used for outgoing connections.
This is used to access internet website, so you mostly keep it open.
There is also a forward chain.
Unless you're doing some kind of routing, or something else on your system that requires
forwarding, you won't even use this chain.
So, to keep things simple I will show you only Simple stateful firewall configuration
I learned from Arch Linux wiki I believe it is a good start to learn iptables.
First create necessary chains
Next, if you use Arch Linux enable iptables in systemctl, so it starts with your system.
To keep this video short, I have copied all these commands to a shell script iptables_ArchLinux.sh.
You can download it from the description.
I will make it executable
and run it.
It will implement all these rules.
You can go to this Arch Wiki page and read about them.
Now, a Simple stateful firewall is configured.
Không có nhận xét nào:
Đăng nhận xét