Breaking News:

Seven steps to increase Linux security

Related gallery

CeBIT 2012 opens: photos

CeBIT 2012 opens: 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.

Tech Blueprint

ZDNet Australia Live

BYOD: What the people think http://t.co/syY7RSyR via @zite

Twitter to track users through widgets: Twitter has given details about tracking users across the internet, and ... http://t.co/Er6izMDp

@superjon_11 just be weary that's what causes them to explode http://t.co/6XSePS0j

SAP eyes cloud super network with Ariba buy
http://t.co/F7NtV2Ju

SA Health's journey to e-health http://t.co/tHAhRy9c

Govt CIO praises budget's $1bn IT investment: Despite a tighter 2012-13 Federal Budget, the government's chief i... http://t.co/sRO5U7C0

Bit more meat to this Global SI #salesforce announcement than earlier ones, still don't think they get it though! http://t.co/Eb386WFF

NSW Govt appoints Silicon Valley office head to represent Aussie tech. Is this useful or a good direction? http://t.co/icIl6GOq

#ABC #Bitcoin Miner tackled in minutes #ITSecurity #law http://t.co/ptOPKpOI

#NSW Govt announces shopfront in Silicon Valley http://t.co/oUEMM9zY #gov2au”. MT: @allisonhornery @johnW3LLS #gov2au

SA Health's journey to #ehealth – structural reform, workforce restructure & infrastructure
http://t.co/TTno9Td9 /via @zdnetaustralia

Goods Shopping Location Discount Of Japan's Largest Abroad Train Brands. Coach Escape Shelter 89% Off.We Entertain Jammed Items Such As A...

7 hours ago by befeffofs on Reservoir blogs: Fan fakes Tarantino diary

1963年ナイキの創業者フィル・ナイトが訪日、オニツカ(現アシックス)の経営陣を訪問。 最新の機能性や斬新なデザインによって、常に新しいもの求める若者たちの心を掴んできたナイキスニーカー。今回はエアジョーダンやエアマックスなど、ナイキスニーカーの歴史に欠かせない名品から今...

7 hours ago by Speerbprayexy on Reservoir blogs: Fan fakes Tarantino diary

7 hours ago by Ideoforie on Reservoir blogs: Fan fakes Tarantino diary

Ferragamo Shoes Is Distinguished Brand.Ferragamo Is So Baby Valuation Broaden, It Is Secure To Shopping Outlet Online Stores.Ferragamo Ba...

7 hours ago by axollaCrake on Reservoir blogs: Fan fakes Tarantino diary

We Are Specialty Fit out Miu Miu Handbags, Miu Miu Purse, Miu Miu Sunglasses And So On. Miu Miu Sale Online Big Reduction With No Trade O...

7 hours ago by MoxboowsVix on Reservoir blogs: Fan fakes Tarantino diary

Pay off Trainer Wallet&Coach Pocket In Our Coach Store With Sad Sacrifice And Finish Quality, Save 80% Off. Cheap Carriage Overnight bag ...

7 hours ago by Fefinfani on Reservoir blogs: Fan fakes Tarantino diary

クリスチャン ルブタンは靴職人としてのスピリットが強いことで有名で、インタヴューでは下記のように語っています。Christian Louboutin「私は女性に、私の作る靴をファッションとは別の領域のにある、美の対象としてみてほしい。靴というものはアクセサリーではなく、その...

7 hours ago by ganitaickexia on Reservoir blogs: Fan fakes Tarantino diary

Celine luggage,Celine carrier bag,pocketbook Celine,CELINE Celine is synonymous with trait and fastidiousness prevalent since founding in...

7 hours ago by unulseDralola on Reservoir blogs: Fan fakes Tarantino diary

From moi @zdnetaustralia: where are all the ICT jobs: http://t.co/p3e1Y26r via

SAP buys its way into the cloud party: Will it work?: Will SAP and Oracle's rollup strategy for cloud players wo... http://t.co/nPjHXHtH

8 hours ago by Elundaninulge on Reservoir blogs: Fan fakes Tarantino diary

RT @dataPlumbers: Combining @Ariba's network & @SAP's applications - "SAP eyes cloud super network with Ariba buy" http://t.co/jeMWEKpB

Gee zdnet gets this wrong, not often either. Heard of html5 @zdnetaustralia? http://t.co/TksSIP31 read comment 1

BYOD: What the people think http://t.co/iqfwr2R5 via @zite

Medicare Locals get $50m for e-health http://t.co/0Prqy7Q3 via @zdnetaustralia #fb #in

Normally would expect better from zdnet. I call BS. It appears that if you look at their decision it is about using HTML5 to develop thei...

9 hours ago by butterflyeffecs on Android fragmentation steers Vic Health

oBoDwZrOrsjUq //www.2012chanelbagsforsale.com]chanel handbags gWbyPIERM niLqoOE //www.2012chanelbagsforsale.com]chanel outlet hBaJhfpEu...

9 hours ago by khngmspwbzm on Deakin Uni opts for Cisco Unified Computing

RT @zdnetaustralia: South Australia's e-health journey is a tough one, but it first required a good foundation. http://t.co/ha4HV3y3 ^ML

RT @zdnetaustralia: Google has joined in on the chorus of organisations warning users about DNSChanger infections http://t.co/ysaIHiuG ^ML

SA Health's journey to e-health http://t.co/tsbfDYHd

“@jufemaiz : Ausgrid is trialling tech that allows the grid to report back on what might be wrong. http://t.co/ezB8ksXa ^ML” is this you?

RT @maverickwoman: Yammer gets into gamification with Badgeville: http://t.co/faPDDVYr #gamification RT @mobilelearning #yam

Chrome beats Internet Explorer in global Web browser race http://t.co/E2YsEvbO

SA Health's journey to e-health: Implementing e-health services for an entire state is a daunting task, but, as ... http://t.co/93FJNlE6

SA Health's journey to e-health http://t.co/3iMSd3nN

SA Health's journey to e-health: Implementing e-health services for an entire state is a daunting task, but, as ... http://t.co/Zl9T7kQL

SA Health's journey to e-health - ZDNet Australia http://t.co/lI1N44kB #ehealth

RT @zdnetaustralia: Google has joined in on the chorus of organisations warning users about DNSChanger infections http://t.co/ysaIHiuG ^ML

South Australia's e-health journey is a tough one, but it first required a good foundation. http://t.co/ha4HV3y3 ^ML

Hotel Wi-Fi investigation - http://t.co/luJqmD1T

Listened to a guy from SA Health chat about how to consolidate IT from 70 hospitals today. Snazzy stuff. http://t.co/IZxhpu5X

Govt CIO praises budget's $1bn IT investment http://t.co/HXx2LFDf via @zdnetaustralia

by http://t.co/vmlLt4bh: SA Health's journey to e-health: Implementing e-health services for an entire state is a... http://t.co/NVrBd9c5

Facebook investor to sue Nasdaq over alleged bungled orders: http://t.co/XGRsNzA4 ^LH

Combining @Ariba's network & @SAP's applications - "SAP eyes cloud super network with Ariba buy" http://t.co/jeMWEKpB

Akku Asus A32-K72 Original,Kompatibler Ersatz akku für Li-ion Asus A32-K72 Original Laptop Akkus Asus A32-K72 Original,A32-K72 Original...

10 hours ago by akkuakku on HP Compaq 6730b

It is great to see the NSW government taking this step, however there's plenty of home-grown talent loeaving or being rediverted due to l...

10 hours ago by Aceyducey on NSW Govt appoints Silicon Valley champion

But this is the thing. There are still plenty of good-quality graduates whose skills can raise seasoned professional eyebrows... if they ...

12 hours ago by techkid on Skills shortage: companies being too picky?

I wouldn't have called Vista cheesy. Its GUI was pretty slick (and indeed handed on to Windows 7). It was, however, poorly implemented, h...

12 hours ago by techkid on Microsoft admits Vista was 'cheesy'

Thanks Nelson, it should be right now.

-Michael.

12 hours ago by Mukimu on Ausgrid network to talk back to operators

I guess the mouse was a necessary evil at the time. I mean, yes, keyboard shortcuts in the right hands are faster than any mouse action (...

13 hours ago by techkid on Microsoft admits Vista was 'cheesy'

fyi google may always lie

13 hours ago by rt luvs youh on Google shows we're killing our language

they probaly always lie about in4mation bout people

13 hours ago by rt luvs youh on Google shows we're killing our language

$6.7million, now we know the price to the tax payer of a government IT project clean up. You've got to ask the question don't you: why o...

14 hours ago by Takenforgranted on Vic scraps HealthSMART system

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

1 day ago, CeBIT 2012 opens: photos

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

1 day ago, Lenovo ThinkPad 3G tablet (32GB)

Facebook Activity

Keep up with ZDNet Australia

ZDNet Events Calendar

ZDNet Events Calendar