Linux.com

Securing Ubuntu

Link to this post 19 Jan 10

I ran Lynis auditing software and it gave me back some things I need to do to my computer. Some of these I just cannot figure out. Can someone please help? Here is the output of Lynis:

-[ Lynis 1.2.9 Results ]-

Tests performed: 160
Warnings:
----------------------------
- [10] Warning: Couldn't find 2 responsive nameservers [test:NETW-2705] [impact:L]
- [10] Warning: iptables module(s) loaded, but no rules active [test:FIRE-4512] [impact:L]

Suggestions:
----------------------------
- [10] Suggestion: Configure password aging limits to enforce password changing on a regular base [test:AUTH-9286]
- [10] Suggestion: To decrease the impact of a full /tmp file system, place /tmp on a separated partition [test:FILE-6310]
- [10] Suggestion: Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft [test:STRG-1840]
- [10] Suggestion: Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft [test:STRG-1846]
- [10] Suggestion: Install package apt-show-versions for patch management purposes [test:PKGS-7394]
- [10] Suggestion: Check your resolv.conf file and fill in a backup nameserver if possible [test:NETW-2705]
- [10] Suggestion: Disable iptables kernel module if not used or make sure rules are being used [test:FIRE-4512]
- [10] Suggestion: Configure a firewall/packet filter to filter incoming and outgoing traffic [test:FIRE-4590]
- [10] Suggestion: Enable logging to an external logging host for archiving purposes and additional protection [test:LOGG-2154]
- [10] Suggestion: Enable auditd to collect audit information [test:ACCT-9628]
- [10] Suggestion: Check ntpq peers output for time source candidates [test:TIME-3128]
- [10] Suggestion: Install a file integrity tool [test:FINT-4350]
- [10] Suggestion: Harden the system by removing unneeded compilers. This can decrease the chance of customized trojans, backdoors and rootkits to be compiled and installed [test:HRDN-7220]

Link to this post 19 Jan 10

Warnings:
1. This is referring to DNS servers, It is stating that 2 nameservers listed in /etc/resolve.conf are unresponsive. depending on your distro you may not have updated the necessary package to update the nameservers.
2. I'm not currently entirely sure how to see if a nf_ module is being used, but this brings up a good point and I am reviewing it now to find the answer.

Suggestions:
1. Password aging is a questionable practice, if you choose not to employ it then you can disable the associated test as outlined in http://www.rootkit.nl/files/lynis-documentation.html.
2. It is recommended your /tmp directory be placed on an external partition, this heps because /tmp is independent so if your root partition fills /tmp will still be open and the system won't crash from lack of /tmp space.
3. Disabling the USB drivers when not in use is good practice for servers and workstations, but not necessary on home systems, you can disable that test if you like.
4. refer to #3
5. The show versions package is not truly necessary because it is intended to prompt you when a new version of an app is available, the synaptic package manager already does that and downloads the package, you can turn off this test.
6. review your firewall rules "iptables -L", it is recommending to disable iptables to converse resources if it now not used or remove packet rules that are not being used. This can speed up network packets.
7. Tist, Tist... your firewall is not being used, it wants you to setup packet filtering using iptables. What is your IP, I can have fun with you? ;)
8. Logging to an external host is advisable for workstations and servers for auditing purposes, but not necessary for a home system. IF you determine it is not necessary for your system then you can turn off this test.
9. The auditd process seems to write notifications when disk space is limited, if you routinely check your system with "df -h" then it is not needed and you can turn off the test.
10. This is stating that you don't have any network time protocol syncing servers setup, having your system sync the time is quite useful for security logging so I recommend that you read ntpdate to figure out how to setup the system to sync the time.
11. file integrity tools are useful for determine if system of config siles have been modified, you can find a short list of tools at http://www.hackinglinuxexposed.com/resources/ in the "file integrity tools" section. I highly recommend that you set this up, it will help you to identify if you have been hacked and will simplify recovery .
12. Unless you compile apps on your system (most buntu users don't) removing the compiler programs is beneficial because it can stop a script from running on your system and auto-compiling malicious programs.

I hope this helps.

Link to this post 19 Jan 10

Thanks for helping me. Right after I posted that I installed a firewall but now it keeps giving me this: Found possible unused iptables rules (1 2 3 4 5 3 6 1 1 5 6 7 8 9 10 12 1 4 5 1 1 2 1).

Link to this post 19 Jan 10

Most likely the order of your firewall rules is what is rendering some of them unused.

All Linux based systems have iptables installed by default, it is up to the user to generate the rule sets, this can be done by hand (as I do) or by using a user interface, which you probably installed. Can you please tell us what user interface you installed?

Additionally if you feel safe enough you can post the output of "sudo iptable -L" so we can evaluate the listed rules and find which are not being used and also recommend improvements.

Link to this post 19 Jan 10

Here is the output of iptables -L : Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere

Chain FORWARD (policy DROP)
target prot opt source destination
ufw-before-logging-forward all -- anywhere anywhere
ufw-before-forward all -- anywhere anywhere
ufw-after-forward all -- anywhere anywhere
ufw-after-logging-forward all -- anywhere anywhere
ufw-reject-forward all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ufw-before-logging-output all -- anywhere anywhere
ufw-before-output all -- anywhere anywhere
ufw-after-output all -- anywhere anywhere
ufw-after-logging-output all -- anywhere anywhere
ufw-reject-output all -- anywhere anywhere
ufw-track-output all -- anywhere anywhere

Chain ufw-after-forward (1 references)
target prot opt source destination

Chain ufw-after-input (1 references)
target prot opt source destination
RETURN udp -- anywhere anywhere udp dpt:netbios-ns
RETURN udp -- anywhere anywhere udp dpt:netbios-dgm
RETURN tcp -- anywhere anywhere tcp dpt:netbios-ssn
RETURN tcp -- anywhere anywhere tcp dpt:microsoft-ds
RETURN udp -- anywhere anywhere udp dpt:bootps
RETURN udp -- anywhere anywhere udp dpt:bootpc
RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target prot opt source destination

Chain ufw-after-logging-input (1 references)
target prot opt source destination

Chain ufw-after-logging-output (1 references)
target prot opt source destination

Chain ufw-after-output (1 references)
target prot opt source destination

Chain ufw-before-forward (1 references)
target prot opt source destination
ufw-user-forward all -- anywhere anywhere

Chain ufw-before-input (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ufw-logging-deny all -- anywhere anywhere state INVALID
DROP all -- anywhere anywhere state INVALID
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
ufw-not-local all -- anywhere anywhere
ACCEPT all -- BASE-ADDRESS.MCAST.NET/4 anywhere
ACCEPT all -- anywhere BASE-ADDRESS.MCAST.NET/4
ufw-user-input all -- anywhere anywhere

Chain ufw-before-logging-forward (1 references)
target prot opt source destination

Chain ufw-before-logging-input (1 references)
target prot opt source destination

Chain ufw-before-logging-output (1 references)
target prot opt source destination

Chain ufw-before-output (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ufw-user-output all -- anywhere anywhere

Chain ufw-logging-allow (0 references)
target prot opt source destination

Chain ufw-logging-deny (2 references)
target prot opt source destination

Chain ufw-not-local (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
DROP all -- anywhere anywhere

Chain ufw-reject-forward (1 references)
target prot opt source destination

Chain ufw-reject-input (1 references)
target prot opt source destination

Chain ufw-reject-output (1 references)
target prot opt source destination

Chain ufw-track-input (1 references)
target prot opt source destination

Chain ufw-track-output (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere state NEW
ACCEPT udp -- anywhere anywhere state NEW

Chain ufw-user-forward (1 references)
target prot opt source destination

Chain ufw-user-input (1 references)
target prot opt source destination

Chain ufw-user-limit (0 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix `[UFW LIMIT BLOCK] '
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain ufw-user-logging-forward (0 references)
target prot opt source destination

Chain ufw-user-logging-input (0 references)
target prot opt source destination

Chain ufw-user-logging-output (0 references)
target prot opt source destination

Chain ufw-user-output (1 references)
target prot opt source destination

Link to this post 19 Jan 10

This is a complexed chain, did you do this by hand or with a script/GUI tool?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board