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

Leftovers: Gaming

Leftovers: Software

  • Hyper Is a Terminal Emulator Built Using Web Technologies
    A lot of us use the terminal on Ubuntu, typically from an app like GNOME Terminal, Xterm or an app like Guake. But did you know that there’s an JS/HTML/CSS Terminal? It’s called Hyper (formerly/also known as HyperTerm, though it has no relation to the Windows terminal of the same/similar name) and, usefulness aside, it’s certainl a novel proof-of-concept. “The goal of the project,” according to the official website, “is to create a beautiful and extensible experience for command-line interface users, built on open web standards.”
  • Little Kids Having Fun With “Terminal Train” In Ubuntu Linux
    Linux is often stereotyped as the operating system for tech savvy users and developers. However, there are some fun Linux commands that one can use in spare time. A small utility named sl can be installed in Linux to play with the Terminal Train.
  • This Cool 8-Bit Desktop Wallpaper Changes Throughout The Day
    Do you want a dynamic desktop wallpaper that changes throughout the day and looks like the sort of environment you’d be able to catchPokemon in? If so, check out Bit Day wallpapers. Created by Redditor user ~BloodyMarvelous, Bit Day is a collection of 12 high-resolution pixel art wallpapers.
  • This Script Sets Wallpapers from Imgur As Your Desktop Background
    Pyckground is a simple python script that can fetch a new desktop background on the Cinnamon desktop from any Imgur gallery you want. I came across it while doing a bit of background on the Bit Day wallpaper pack, and though it was nifty enough to be of use to some of you. So how does it work?
  • Productivity++
    In keeping with tradition of LTS aftermaths, the upcoming Plasma 5.9 release – the next feature release after our first Long Term Support Edition – will be packed with lots of goodies to help you get even more productive with Plasma!
  • Core Apps Hackfest 2016: report
    I spent last weekend at the Core Apps Hackfest in Berlin. The agenda was to work on GNOME’s core applications: Documents, Files, Music, Photos, Videos, Usage, etc.; to raise their overall standard and to make them push beyond the limits of the framework. There were 19 of us and among us we covered a wide range of modules and areas of expertise. I spent most of my time on the plumbing necessary for Documents and Photos to use GtkFlowBox and GtkListBox. The innards of Photos had already been overhauled to reduce its dependency on GtkTreeModel. Going into the hackfest we were sorely lacking a widget that had all the bells and whistles we need — the idiomatic GNOME 3 selection mode, and seamlessly switching between a list and grid view. So, this is where I decided to focus my energy. As a result, we now have a work-in-progress GdMainBox widget in libgd to replace the old GtkIconView/GtkTreeView-based GdMainView.

Leftovers: OSS and Sharing

  • Did Amazon Just Kill Open Source?
    Back in the days, we used to focus on creating modular architectures. We had standard wire protocols like NFS, RPC, etc. and standard API layers like BSD, POSIX, etc. Those were fun days. You could buy products from different vendors, they actually worked well together and were interchangeable. There were always open source implementations of the standard, but people could also build commercial variations to extend functionality or durability. The most successful open source project is Linux. We tend to forget it has very strict APIs and layers. New kernel implementations must often be backed by official standards (USB, SCSI…). Open source and commercial implementations live happily side by side in Linux. If we contrast Linux with the state of open source today, we see so many implementations which overlap. Take the big data eco-systems as an example: in most cases there are no standard APIs, or layers, not to mention standard wire protocols. Projects are not interchangeable, causing a much worse lock-in than when using commercial products which conform to a common standard.
  • Firebird 3 by default in LibreOffice 5.4 (Base)
    Lots of missing features & big bugs were fixed recently . All of the blockers that were initially mentioned on tracking bug are now fixed.
  • Linux & Open Source News Of The Week — Comma.ai, Patches For Firefox and Tor, And OSS-Fuzz
  • Open Source Malaria helps students with proof of concept toxoplasmosis pill
    A team of Australian student researchers at Sydney Grammar School has managed to recreate the formula for Daraprim, the drug made (in)famous by the actions of Turing Pharmaceuticals last year when it increased the price substantially per pill. According to Futurism, the undertaking was helped along by an, “online research-sharing platform called Open Source Malaria [OSM], which aims to use publicly available drugs and medical techniques to treat malaria.” The students’ pill passed a battery of tests for purity, and ultimately cost $2 using different, more readily available components. It shows the potential of the platform, which has said elsewhere there is, “enormous potential to crowdsource new potential medicines efficiently.” Although Daraprim is already around, that it could be synthesized relatively easily without the same materials as usual is a good sign for OSM.
  • Growing the Duke University eNable chapter
    We started the Duke University eNable chapter with the simple mission of providing amputees in the Durham area of North Carolina with alternative prostheses, free of cost. Our chapter is a completely student-run organization that aims to connect amputees with 3D printed prosthetic devices. We are partnered with the Enable Community Foundation (ECF), a non-profit prosthetics organization that works with prosthetists to design and fit 3D printed prosthetic devices on amputees who are in underserved communities. As an official ECF University Chapter, we represent the organization in recipient outreach, and utilize their open sourced designs for prosthetic devices.

today's howtos