Network Security
Network Security
In securing your hosts and networks, you strive to let nobody gain unau-
thorized access to your hosts and networks, e.g. somebody log in using
someone else’s account. Because nothing is absolutely secure, you also have
to keep up to date to the latest security threats. This way you know whether
your hosts and networks are vulnerable or not, and if so, you can immedi-
ately take the necessary measures to close the vulnerability by, for example,
applying patches to your software or enforcing a firewall rule. In this tutorial
you will find practical measures to secure your hosts and networks.
The first step to achieve network security is to have a security policy.
The AI3 network has such policy, and each SOI-ASIA partner, as part of
the AI3 network, has to follow the policy.
1
2
Network servers
You should confirm that network servers running on your hosts are secure.
To ensure this, the best policy is not to run a network server unless it is
necessary and it doesn’t have a security vulnerability. Two commands that
can be used to check which network servers are running are:
• netstat -na shows the active Internet connections.
Below is an example of the results.
The Proto column shows the connection protocol, e.g. tcp6 is TCP
for IPv6. Local and Foreign addresses columns are in address.port
format. Pay attention to the ones whose Foreign Address is *.*; these
are entries of local ports opened network servers.
• sockstat -46 shows the processes that have Internet connections.
An example is shown below. You can see for example that root is
running zebra that is listening on TCP port 2601.
You can then decide whether to kill the network servers based on the
results of both utilities.
Network servers are usually run at boot time by inetd and local startup
scripts at /usr/local/etc/rc.d directory. To minimize network servers:
Firewall
Firewall can secure your networks by blocking packets. For example, you
want to give access to your web server only from your your networks. You
can do it by giving Access Control List to your web server, or you filter
packets to your web server using firewall.
You have to enable IPFIREWALL kernel options to active firewall ca-
pability on FreeBSD. The procedure is
1. As root, edit the startup configuration /etc/rc.conf and add the fol-
lowing lines to use firewall with open access.
firewall_enable="YES"
firewall_type="open"
cd /usr/src/sys/i386/conf
cp GENERIC MYFIREWALL
options IPFIREWALL
4
Secure Shell
Secure shell (SSH) is a remote access service that uses encryption, thus it
is secure from eavesdropping. FreeBSD 4.x, and many other Unix based
OSes, uses SSH as the default remote access service. The commonly used
implementation is OpenSSH (http://www.openssh.org/). From time to time
OpenSSH upgrade its package for improvements or vulnerability patches.
You should update your SSH package whenever a security problem is found
on the OpenSSH version that are running in your host. Below is how to
install OpenSSH on FreeBSD:
3. Read file named INSTALL and check the requirement for OpenSSH.
less INSTALL
In general, you need a working installation of Zlib and OpenSSL with
the version that is stated in INSTALL file.
./configure
make
make install
sshd_program="/usr/local/sbin/sshd"
sshd_flags="-f /usr/local/etc/sshd_config"
Exercise
Ex. 1 Account security
1. Check who logged in recently.
last
2. Check the following files to know who can access root via su.
/etc/passwd
/etc/group
List users who are in wheel group.
Ex. 3 Firewall
1. Add firewall capability to your kernel. Follow the procedure explained
in the Firewall section.
3. Create a firewall rule to deny access to the SSH port of your host.