Language Selection

English French German Italian Portuguese Spanish

Quick Guide to Securing a Lamp Server

Filed under
Howtos

In the last few years on the Internet the price of dedicated servers have went down and more people are beginning to use them for their sites, game servers, or small hosting companies. With this comes as I was talking about in my last article inexperienced admins. Lots of people I spoke too are too intimated by the linux shell and try to administer their server completely from the control panel.
This short guide will show you a few copy and paste walkthroughs you can use to help secure your server, these should work with any control panel, the mod security update script however is only for apache2. Using these tools and using basic security procedures will help you keep your server secure and free of hackers, spammers, and other annoyances.

Using linux as a personal desktop helps a lot as well as it gets you used to using the command line. The other extremely valuable tool is google. I would probably be nowhere without google. You can look stuff up as you go and find about any answer to any question you may have, Plus there is lots of walkthroughs just like this one I am just putting all the basic ones together.

OK this is not a complete guide but those who are less experienced should be able to follow these walkthroughs and make their server more secure then it was before.
First thing, install apf, bfd, and dos deflate. Complete walkthrough HERE
Note: Dos deflate will not work with debian unless you disable ipv6.

Next install modsecurity using the simple guide from eth0.us, guide can be found HERE

After you install mod security make a directory in /etc called modsecurity. Use my update script found HERE (apache2 only)
This will get all the latest rules from gotroot.com when you have them at the bottom of the mod security configuration in httpd.conf put
Include /etc/modsecurity/apache2/rulename.conf
I suggest using them all besides rules.conf as it gives lots of false positives.

Now if you have shell users or are running redhat, fedora, or debian you most likely need to update your kernel. Now this isn't as hard as you would think, with this copy and paste guide I made that is all you have to do is copy and paste, same as these other tutorials.
The guide can be found HERE. I will be making one for debian soon but you just use any basic debian kernel how to and patch the kernel the same way as you do in this one.

Once you have modsecurity installed keep an eye on the audit log to make sure it is not giving any false positives or blocking legitimate web apps. With the ruleset and rules you have included it should not unless someone is using some oddball web app.
None of these will make your server totally secure, it takes basic security practices such as using strong passwords, not using the same password for everything, and keeping up with all the latest exploitrs and hacking methods.

If you ever get hacked don't go ranting about how you are gonna prosecute so and so, go find out how they done it, how they got in, and what you can do to prevent it again. You will most likely never track down the hackers and the FBI most likely will not care so secure your system and make sure it does not happen again. As I have explained before defacers can actually be helpful to admins. That's about it, good luck and stay on your toes.

More in Tux Machines

Musique for Linux Review – A Minimalistic Player for You and Your Music

Musique is a minimalistic music player for the Linux platform that features a simple and clean interface. It's not like there is a lack of open source music players, so we've decided to see if this one is any good. Read more

CentOS 5.11 Officially Released, Probably the Last One in the Series

As you all know already, CentOS is an Enterprise-class Linux Distribution derived from sources provided by Red Hat. This is the eleventh update for the distribution and probably the last one. It features all the packages from all variants, including Server and Client, and the upstream repositories have been merged into a single one. Red Hat announced less than a month ago the release of their last update for Red Hat Enterprise Linux, 5.11. It stands to reason that CentOS 5.11 will also be the last update in the series. Read more

England's Healthwatch switches to open source CRM

England's Healthwatch organisations are now using CiviCRM, an open source solution for customer relationship management. "Open source affords access to a wide community of developers, which means that the software continues to develop and security updates and bug fixes are regularly rolled out", explains Tim Schofield, the organisation's interim systems manager. Read more

Opera for Linux to Get a Stable Version Soon

The Opera browser is now based on Chromium and this simple fact has delayed the release of a stable Linux version for more than a year. Now, the Linux platform will finally get a release and some final touches have been made to the client. The developers have improved a number of features that are already available in the browser. For example, users will not be able to drop a PDF file in browser tab that already has a similar file opened, deleting the entries in History now works as it should, the correct font is used all the time, and the new Bookmark feature that has been recently made available has been improved. Read more