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

today's leftovers

  • Comic-Con and FOSS Comic Book Solutions
    After whetting his appetite at this year’s Comic-Con, our resident Linux newbie discovers free and open source apps for reading digital comics, as well as a treasure trove of available sources for free comics online.
  • Linux Kernel 3.12.62 LTS Improves SPARC Support, Updates the Networking Stack
    Linux kernel developer Jiri Slaby announced the release of the sixty-second maintenance update for the long-term supported Linux 3.12 kernel series, which will receive support until 2017 because of SUSE Enterprise Linux. Linux kernel 3.12.62 LTS is a modest update, and looking at the diff from the previous maintenance release, version 3.12.61, we can notice that it changes a total of 96 files, with 1213 insertions and 1053 deletions. Among the changes, we can notice lots of fixes for the SPARC hardware architecture, but there are various other improvements for the ARM, MIPS, PA-RISC, and x86 instruction set architectures.
  • ‘Anatine’ Is a Simple Desktop Twitter App for Linux
    Anatine describes itself as a 'pristine Twitter app for Linux', but is it anything more than a wrapper around the mobile website?
  • Skype for Linux Alpha 1.3 Released With Small Bug Fixes
    A small bug fix update to Skype for Linux alpha is now available, and fixes, among many changes, errant close to tray behaviour on the Cinnamon desktop.
  • On the killing of intltool
    Say thanks to Daiki Ueno for his work maintaining gettext and enhancing it to make change practical, and to Javier Jardon for pushing this within GNOME and working to remove intltool from important GNOME modules.
  • On discoverability
    I've discussed elsewhere that usability is about real people doing real tasks in a reasonable amount of time. Some researchers also refer to "learnability" and "memorability" to define usability—this is very similar to discoverability. Can you discover the features of the system just by poking at it? Is the user interface obvious enough that you can figure it out on your own?
  • This is Lubuntu 16.10’s New Default Wallpaper
    The default wallpaper of Lubuntu 16.10 — yes, that's Lubuntu, with an 'l' — has been unveiled — but will fans of the lightweight Ubuntu spin like it?

today's howtos

Red Hat and Fedora

Android Leftovers