A Firewall is designed to prevent unauthorized outside users from accessing a network or host. It is a device (software or hardware), installed between the internal network and the Internet. Firewall performs filtering of the packets that attempt to enter or leave a network. This is done by defining various policies that enforce control over the network traffic.
A Bastion Host defines a simple firewall implementation, where the bastion host is any computer that is fully exposed to attack by being on the public side of the DMZ, unprotected by a firewall or filtering router. [1]
It is also referred to as the, Bastion firewall. The bastion node, is usually a very powerful server with improved security measures and custom software.
It is also referred to as the, Bastion firewall. The bastion node, is usually a very powerful server with improved security measures and custom software.
A typical Bastion firewall implementation |
DMZ (Demilitarized Zone), also known as Perimeter Network, refers to the part of the network, that is neither private nor public. It introduces an additional layer of security, as external network has access to network devices and servers in the DMZ only.
Netfilter
Netfilter is the program that implements a firewall within the Linux kernel, either compiled directly into the kernel or included as a set of modules. It wouldn't be wrong to refer to netfilter as the super-set of a firewall implementation.
Netfilter may be referred to as a generalized framework of hooks in the network stack. Any kernel module can plug into one or more of these hooks and receive packets traversing through these hooks. [2]
Netfilter Hooks
1. NF_IP_PRE_ROUTING
NF_IP_PRE_ROUTING hook is triggered by any incoming packet. It is then passed to decide whether the packet is destined for another interface, or a local process. This refers as a routing decision.
2. NF_IP_LOCAL_IN
If the packet is destined for a local process, it is passed over to the NF_IP_LOCAL_IN hook.
3. NF_IP_FORWARD
If the packet is destined for another interface or host, NF_IP_FORWARD hook is called from the netfilter framework.
4. NF_IP_LOCAL_OUT
If the packet is created locally, it is passed on to this hook. The routing decision is made after the packets passes through this hook.
5. NF_IP_POST_ROUTING
NF_IP_POST_ROUTING is triggered after the routing decisions have been made. The packet passes this hook and sets off to the network again.
The kernel modules may register to one or more of these hooks, and for each packet passing through the hook. A function specified by the kernel module is called, which returns a decision for the netfilter framework to act upon. One of following five decisions is then processed by the netfilter:
1. NF_ACCEPT: Sustain the traversal as normal.
2. NF_DROP: Drop the packet; traversal is discontinued.
3. NF_STOLEN: Hook-registered module has taken over the packet; traversal discontinued.
4. NF_QUEUE: Packet is inserted into a dedicated queue inside the netfilter. It's then passed to an userspace process through a netlink socket, which further decides what to do with the packet.
5. NF_REPEAT: Hook is called again to process.
References:
- [1]Krutz, Ronald; Vines, Russell (May 2003). The CISM Prep Guide: Mastering the Five Domains of Information Security Management. Wiley. p. 12. ISBN 9780471455981.
- [2]KernelNewbies: Documents/Netfilter
- [3]Linux netfilter Hacking HOWTO
- "Linux Firewalls" by Steve Suehring
- "Mastering Linux Security and Hardening" by Donald A. Tevault
- Diagram credits: https://www.draw.io/
Very informative,Keep sharing your knowledge.
ReplyDeleteThanks a lot! Will do. :D
DeleteI like it!
ReplyDeleteGreat stuff!! Very informative!!! Thanks :)
ReplyDeleteLearned a bit about firewalls. Going great, blogger.
ReplyDelete