1 Seven steps to increase Linux security - Security - Insight - ZDNet Australia

Seven steps to increase Linux security

Related gallery

Linux.conf.au 2012 photos

Linux.conf.au 2012 photos

TechRepublic

Ask a network administrator in any large organisation to compare Linux with network operating systems like Windows NT or Novell Open Enterprise Server, and chances are he'll admit that Linux is an inherently more stable and scalable solution. Chances are he'll also admit that when it comes to securing the system from outside attack, Linux is possibly the most difficult of the three to work with.

This perception is not an uncommon one -- many network administrators new to Linux find it hard to transition from a point-and-click security configuration interface to one based on editing complicated and hard-to-locate text files. Most administrators are well aware of the need to manually put in roadblocks and obstacles to trip up would-be hackers and ensure that your company's data stays secure; it's just that in the unfamiliar Linux world, they're not completely sure of their bearings or where to start.

That's where this document comes in. It outlines some easy things administrators can do to make their Linux server more secure and significantly reduce the risk they face. This tutorial lists seven such items.

1. Protect the root account
The root, or superuser, account on a Linux system is like a backstage pass at a Stones concert -- it allows you access to anything and everything. For this reason, it's well worth taking extra steps to protect it. Start by setting a hard-to-guess password for this account with the passwd command, change it on a regular basis, and restrict knowledge of the password to a few (ideally, only two) key people in the organisation.

Next, restrict the terminals that can be used for root access, by editing the file /etc/securetty. To avoid users leaving a root terminal "open", set a timeout for inactive root logins by setting the TMOUT local variable, and ensure that the root command history file (which might contain sensitive information) is disabled by setting the HISTFILESIZE local variable to 0. Finally, enforce a policy of using this account only to perform specific administrative tasks, and discourage users from logging in as root by default.

Tip: Once you've closed these holes, the next step is to require that every normal user account must have a password and ensure that passwords do not use easily-recognisable heuristics such as birthdays, user names or dictionary words.

2. Install a firewall
A firewall lets you filter data packets travelling in and out of your server and ensures that only those packets matching pre-defined rules are permitted to enter or exit. A number of excellent firewalls are available for Linux, and firewall code can even be compiled directly into the kernel. Begin by defining input, output and forwarding rules for packets leaving and entering your network, using the ipchains or iptables commands. Rules may be specified on the basis of IP addresses, network interfaces, ports, protocols or combinations of these attributes; these rules also specify what action (accept, reject, forward) to take when a match occurs. Once the rules are installed, test the firewall extensively to ensure that no holes exist in it. A good firewall is your first line of defence against common attacks like the distributed denial of service (DDoS) attack.

3. Use OpenSSH for network transactions
An important issue in client-server architecture involves the security of data being transmitted over the network. If network transactions take place in plaintext, it is possible for a hacker to "sniff" the data packets being transmitted and thus gain access to sensitive information. You can close this hole by using a secure shell utility like OpenSSH to create a secure encrypted "tunnel" for your data to pass through. Encrypting your connections in this manner makes it extremely hard for unauthorised users to read the data going back and forth between network hosts.

4. Disable unwanted services
Most Linux systems are installed with a wide variety of different services enabled, such as FTP, telnet, UUCP, ntalk and so on. In most cases, these services are rarely used and leaving them active is like leaving your windows open for a burglar to slip in. You can disable these services by commenting them out in the /etc/inetd.conf or /etc/xinetd.conf files and then restarting the inetd or xinetd daemon. Additionally, some services (for example, database servers) may start up by default during the boot process; you can disable these by editing the /etc/rc.d/* directory hierarchy. Many experienced administrators disable all system services, only leaving SSH communication ports open.

5. Use a spam and anti-virus filter
Junk e-mail and viruses annoy your users and can sometimes cause critical network failures. Linux is surprisingly resistant to viruses, but client machines running Windows may be more susceptible. Therefore, it's a good idea to install a spam and virus filter on your mail server itself, to "defang" suspicious messages and reduce the risk of a chain of collapses.

Begin by installing SpamAssassin, a leading open-source tool that uses a combination of different techniques to identify and flag spam; the program also supports user-based whitelisting and graylisting for greater accuracy. Next, install procmail for user-level filtering based on regular expressions; this tool allows automatic filtering of received email into mailboxes, at both a user and system level. Finally, install Clam Anti-Virus, a free anti-virus toolkit that integrates with sendmail and SpamAssassin and supports on-access scanning of email attachments.

6. Install an intrusion detection system
Intrusion detection systems (IDS) are early warning systems that let you know if changes occur on your network. They're a great way to identify (and prove) attempts to break into your system, although at the cost of increased resource consumption and potential red herrings. There are two fairly well-known IDS' you can try: tripwire, which tracks file signatures to detect modifications; and snort, which use rules-based directives to perform real-time packet analysis and search and identify attempts to probe or attack your system. Both packets can generate e-mail alerts (among other actions) and are useful when you suspect your network is being compromised but need definitive proof.

7. Perform regular security audits
When it comes to securing your network, this final step is possibly the most important. Here, you put on a black hat and do your best to circumvent the defences you erected in the previous steps. Doing this provides you with an immediate and objective assessment of how hard your system really is, and identifies potential vulnerabilities that you should fix.

A number of tools are available to help you in this audit: you can attempt to hack your password files using password crackers like Crack and John the Ripper; you can use nmap or netstat to look for open ports; you can sniff the network using tcpdump; and you can try exploiting publicised holes in your installed programs (Web server, firewall, Samba) to see if they offer a way in. If you do manage to find a way past your obstacles, rest assured that others will too; take immediate measures to close the openings.

Protecting your Linux system is an ongoing task, and so you shouldn't rest easy once you've done the steps above. Visit the Linux security forums for more security tips, and be proactive in monitoring and updating the security of your system. Good luck!

TechRepublic is the online community and information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to firewalls, we offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.

Talkback

Add your opinion

In order to post a comment, you need to be registered. (Sign In or register below)

Post your comment

Terms of Service - As a ZDNet registrant, and by using this service, you indicate that you agree to our Terms and Conditions and have read and understand our Privacy Policy.

Quick Poll

What is the biggest data management challenge in your organisation?

ZDNet Australia Live

HILARIOUS!!I And shocking Symantec haven't been suited to hell! RT @zdnetaustralia: Symantec confirms hacker extortion: http://t.co/xR4HmTZo

Hipstamatic busted for plain text log-ins - It has been revealed that popular iPhone photography app Hipstamatic is ... http://t.co/RADwB5XE

Phishing scam causes Telstra email woe - compromised email accounts blacklisted http://t.co/qbO2bU85 (via @zdnetaustralia)

iPhone camera app Hipstamatic stores login details in plain text http://t.co/u3wnFq1P

Hipstamatic busted for plain text log-ins http://t.co/MFSmwS7L

Pilot sues Virgin for being iPad Luddite http://t.co/xSKIFeOh

How to spot a fake Facebook profile (infographic) http://t.co/8HZFuefI

Symantec confirms hacker extortion: http://t.co/Ohetnr31

RT @zdnetaustralia: Symantec confirms hacker extortion: http://t.co/Ohetnr31

by http://t.co/vmlQ0Ecb: Symantec confirms hacker extortion: Symantec has today confirmed that email corresponden... http://t.co/3K2sq0hI

#Google: Madonna tops Tom Brady, Patriots and Giants in searches http://t.co/ZPPBqhOj

Not just GenY RT @kevster009: 10 things Gen Y do online.. and shouldn't. http://t.co/D92mClSK…. A great reminder for everyone.

Symantec confirms hacker extortion - ZDNet Australia http://t.co/CKaHh8XM

Symantec confirms hacker extortion: Symantec has today confirmed that email correspondence between the company a... http://t.co/8llws6Tl

Macquarie expands shared tech team http://t.co/MqyJU1gM

Very interesting: Symantec offers $50k to hacker in emails as part of a law enforcement investigation. http://t.co/Shq08y4r

What is FRAND? http://t.co/5cMeD6TS #ip #frand

Social business success: Burberry http://t.co/dYhBEABN

Social business success: Burberry | ZDNet http://t.co/BpBMXRYw #socbiz

The mining industry run around telling us about wht great employment gererators they are when they are trying to avoid taxation, as soon ...

48 minutes ago by Kevin Cobley on Robotic mining worth its high cost: Rio

Pilot sues Virgin for being iPad Luddite: A pilot allegedly damaged his back carrying a 18kg flight bag full of ... http://t.co/ksT5JJ37

VeriSign Authentication Services provides solutions that allow companies & consumers to engage in communications & commerce online with c...

56 minutes ago by santla on Hackers stole data from VeriSign in 2010

RT @zdnetaustralia: Telstra reveals cause behind compromised BigPond email accounts http://t.co/V5cYJMcN

Robotic mining worth its high cost: Rio - ZDNet Australia http://t.co/SirHOAuw

In defense of the Galaxy Note's stylus http://t.co/GiBQHPjT

Pilot sues Virgin for being iPad Luddite http://t.co/B3lTvulR

Phishing scam causes Telstra email woe http://t.co/kcXa15Tm

by http://t.co/vmlQ0Ecb: Pilot sues Virgin for being iPad Luddite: A pilot allegedly damaged his back carrying a ... http://t.co/aHx5vxkg

Phishing scam causes Telstra email woe:
http://t.co/nNSQWX96

I've delt with developers daily for 2 decades and I am astounded at the arrogance that new grads possess, combined in no fundamentals and...

1 hour ago by Dr_Truth on IT lumped with 'arrogant, ignorant' grads

Every mobile phone we should have a good mobile security downloaded so that we can be aware of this malwares!!!

1 hour ago by santla on Google scans Android apps for malware

Oh nice to know about this article!!!

1 hour ago by santla on Ex-Firefox exec plans Facebook for Android

Its good if they get it!!

1 hour ago by santla on Will Android get a root store?

Android is good!!! i too have android mobile ..

1 hour ago by santla on Android features better than iPhone: Woz

ZDNet: Did Google withhold malware protection details from partners? http://t.co/nblEvOYc

Thanks for the artilcle i too have android mobile phone!! and its so good and i have comodo mobile security in my phone

1 hour ago by santla on Android to be developer platform of choice

Great to know about it. along with this we can have some good mobile security so that we can remain safe with our mobiles tooo such a com...

1 hour ago by santla on iPhone 4S wins Android, BlackBerry users

Android mobile very cheap and good now a days more than ipad !!!

1 hour ago by santla on Android closes in on iPad market share

Android mobileare getting lot of malware now a days its better to have some good mobile securities like Comodo Mobile Security !!!

1 hour ago by santla on Google scans Android apps for malware

RT @zdnetaustralia: Telstra reveals cause behind compromised BigPond email accounts http://t.co/Xbkfy5OK

This has been a serious problem now a days!!!

1 hour ago by santla on Microsoft settles with alleged botnet host

"I agree that their products have gotten a lot better. How insecure they still are says a lot about how hard this problem really is

1 hour ago by santla on Has Microsoft fixed its security issues?

Yeah i accept with myron!!

1 hour ago by santla on Microsoft halts another botnet: Kelihos

the Kelihos botnet has not crawled out of the grave, ... new botnet is being assembled using a variant of the original malware.

1 hour ago by santla on Antivirus employee named in botnet case

Thanks to know about it the artile was good

1 hour ago by santla on 2011: security's most spectacular stuff-ups

Kelihos, according to the researchers, has been found in new variants and they quite resemble the earlier build.

1 hour ago by santla on Kelihos variants slipped Microsoft's noose

Facebook is facing lot of attacks now a days !!!

1 hour ago by santla on The floatcast

Android phones malwares are increasing now a days a lot. inorder to get rid from this we have to be aware to have a good mobile security...

1 hour ago by santla on Android malware finds way to polymorph

Radiation is bad !!

1 hour ago by santla on Body scanners coming to airports in July

Google's answer to EU as succinct as its privacy policy - ZDNet (blog): Telegraph.co.ukGoogle's answer to EU as ... http://t.co/uA9aOxQD

Beware of hoaxes. Facebook does not donate money based on the number of shares or likes for "sick babies".... http://t.co/MeXFoUbe

Phishing scam causes Telstra email woe http://t.co/BYZTvadN via @zdnetaustralia

Did Google withhold malware protection details from partners? http://t.co/SHGePNhK

Govt caught in internet-security time warp http://t.co/4st8GIcj

Phishing scam causes Telstra email woe: A phishing scam has led to a number of compromised BigPond email account... http://t.co/PXvZo1no

This story has been voted 5 times in the last 24 hours!

3 days ago, Abbott paving a telecoms road to nowhere

Facebook Activity

Keep up with ZDNet Australia

ZDNet Events Calendar

ZDNet Events Calendar