Console Login

Paranoia is a Virtue: The 2012 Guide to Linux Server Hardening in Norway

Fortifying the Fortress: Essential Linux Server Hardening

If 2011 taught us anything—between the LulzSec rampages and the PlayStation Network disaster—it is that security through obscurity is dead. If your server has a public IP, it is being scanned. Right now. As you read this sentence, a botnet is likely hammering port 22 on your fresh install, looking for a weak root password.

I have spent the last decade watching sysadmins cry over `auth.log` files because they thought "nobody knows my IP yet." In the world of high-performance hosting, latency isn't just about network speed; it's about how fast you can detect and drop a threat. Here is how we lock down production environments at CoolVDS, and how you should configure your own boxes immediately after provisioning.

1. Burn the Passwords (SSH Hardening)

The first rule of the battle-hardened admin: Passwords are for users, not for servers. Brute force attacks are a statistical inevitability. If you are still logging in as root with a password, you are a liability.

First, generate a 2048-bit RSA key pair on your local machine if you haven't already:

ssh-keygen -t rsa -b 2048

Once your public key is on the server (~/.ssh/authorized_keys), you need to edit the SSH daemon configuration. We are going to disable root login and password authentication entirely.

Open /etc/ssh/sshd_config (I use vi, but you can use nano if you must):

PermitRootLogin no PasswordAuthentication no UseDNS no AllowUsers yourusername

Pro Tip: Changing the default port from 22 to something like 2222 won't stop a determined hacker, but it does reduce log noise from script kiddies by about 90%. It keeps your logs clean so you can see the real threats.

2. The Firewall: Learn to Love Iptables

Many new VPS providers give you a fancy web GUI firewall. Ignore it. You need to know what is happening at the kernel level. In 2012, iptables is the gold standard for packet filtering in Linux.

The policy is simple: DROP everything by default, then open only what you need. Here is a standard configuration we use for web nodes hosted in our Oslo facility:

# Flush existing rules iptables -F # Default policies iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT # Allow loopback (essential!) iptables -A INPUT -i lo -j ACCEPT # Allow established connections iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # Open SSH (adjust port if needed), HTTP, HTTPS iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT

Save this. On CentOS 6, use service iptables save. On Debian 6 (Squeeze), you might need iptables-save > /etc/iptables.rules.

3. Automate Defense with Fail2Ban

Even with keys, you don't want your SSH port getting hammered. It wastes CPU cycles and fills up logs. Fail2Ban is mandatory software. It scans log files for malicious behavior (too many failed attempts) and updates your iptables rules to ban the offending IP for a set period.

In a recent deployment for a Norwegian e-commerce client, we saw 4,000 failed auth attempts per hour. After deploying Fail2Ban with a strict jail policy, that number dropped to near zero, freeing up system resources for actual database queries.

4. The Norwegian Advantage: Data Integrity

Security is not just about hackers; it's about jurisdiction. With the US Patriot Act causing legitimate concerns for European businesses, hosting your data inside Norway is a strategic move. The Norwegian Data Inspectorate (Datatilsynet) enforces strict privacy rules under the Personal Data Act (Personopplysningsloven).

At CoolVDS, our infrastructure is physically located in Oslo. We peer directly with NIX (Norwegian Internet Exchange). This doesn't just give you low latency to your Norwegian customers; it ensures your data remains under Norwegian jurisdiction, offering a layer of legal hardening that a server in Virginia simply cannot provide.

5. Keep the Kernel Fresh

A compromised kernel is game over. Unlike budget OpenVZ providers where you are stuck with the host's kernel, CoolVDS uses KVM virtualization. This allows you to update your own kernel and isolate your resources.

Run your updates nightly:

  • CentOS/RHEL: yum update -y
  • Debian/Ubuntu: apt-get update && apt-get upgrade

Final Thoughts

There is no such thing as a perfectly secure server, only one that is too expensive to hack. By layering SSH keys, a strict firewall, and proactive monitoring, you make yourself a hard target.

Don't let sluggish hardware undermine your security efforts. Security scanning requires I/O. Deploy your hardened fortress on CoolVDS today, where we use enterprise-grade RAID-10 SSD storage for maximum reliability and speed.