hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : VPS Hosting : VPS Tutorials : How-to Protect your Server. The Basics! (cPanel)
Reply

VPS Tutorials Tutorials related to VPS.
Forum Jump

How-to Protect your Server. The Basics! (cPanel)

Reply Post New Thread In VPS Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 12-31-2006, 06:38 PM
Felxi Felxi is offline
Junior Guru Wannabe
 
Join Date: Nov 2003
Location: United Kingdom
Posts: 38
Post

How-to Protect your Server. The Basics! (cPanel)


Well I take NO credit for the scripts provided herein I merely hope to share some things I have found to help me when I setup my VPS...

First of all we need to install a firewall, even if you don’t start this service this nifty script do's a security audit for you...

To install ConfigServer Firewall
SSH into your root and then "cd" into the main directory (normally "cd ..") and now follow the script below
rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
If you would like to disable APF+BFD (which you will need to do if you have
Them installed otherwise they will conflict horribly)
sh disable_apf_bfd.sh
That's it. You can then configure csf and lfd in WHM, or edit the files
directly in /etc/csf/*
Now login to cPanel root (WHM)
and scroll down to the bottom on the left pane and at the bottom you will see a link for ConfigServer Security & Firewall
Now by default your firewall wont be active which is a good thing as we don’t want any problems as of yet.
Now click Check Server Security

Now there might be quite a few items in here you should check. Most items will have a comment next to them and give you a complete guide on how to modify that item that’s come up "Warning"

For shared web hosting I strongly recommend that you make sure the PHP & SSH tabs are all "Ok" status as this is the man source of problems within a exploit.

At the bottom you should be shown a score.
0 to 15 > Wet Paper Bag
16 to 31 > Dry Paper Bag
32 to 47 > Wooden Box
48 to 63 > Brick Wall
64 to 68 > Reinforced Concrete
My server is "65" and I cannot push to score "68" as I will not modify some of the items I know are ok. However each server you configure depending on what setup should try and fall above a "48" score!

Now, once you have sorted most of those and have got a nice score its time to sort the firewall out. Click the Firewall Configuration
And read each and every item to understand its properties!

That’s it, once you have done this you can turn your firewall on and depending on what setup you have I recommend you keep to Low profile!

For more help visit http://www.configserver.com/cp/csf.html

____________________________________________________

SSH login message

(By default I have this set only to the root user and no shared accounts. but it’s up to you what you do...)

Top create a login message login via root with your favourite SSH client (PuTTY!!)
and type this
pico /etc/motd
Now type your message here to warn users about your AUP etc..
Now type Ctrl+X then hit Y and enter
Saved and all done!

____________________________________________________

Another good trick is to have rkhunter check your server for rootkits!

Yes this tutorial is already out there but you should use it!
SSH into root
wget http://downloads.rootkit.nl/rkhunter-1.2.8.tar.gz
tar -zxvf rkhunter-1.2.8.tar.gz
cd rkhunter-1.2.8
./installer.sh
Now cron this!
pico /etc/cron.daily/rkhunter.sh
#!/bin/bash
(/usr/local/bin/rkhunter -c --cronjob 2>&1 | mail -s "Daily Rkhunter Scan Report" email@domain.com)
chmod +x /etc/cron.daily/rkhunter.sh
Now update..
rkhunter --update
and finaly do a scan!
/usr/local/bin/rkhunter -c
There may be some sectors that show as Bad but this should’nt concern you unless it states on results you have a rootkit!

If you have any findings or extra tweaks please post them in here.

Reply With Quote


Sponsored Links
  #2  
Old 01-15-2007, 03:24 AM
jexxie jexxie is offline
Junior Guru Wannabe
 
Join Date: Dec 2006
Posts: 38
* rhunter update script...

Here's the rkhunter one-liner I use:
PHP Code:
VERSION=1.2.9;echo Installing rkhunter v$VERSION...&&echo -n Downloading...&&wget --quiet http://easynews.dl.sourceforge.net/sourceforge/rkhunter/rkhunter-$VERSION.tar.gz http://easynews.dl.sourceforge.net/sourceforge/rkhunter/hashupd.sh&&echo done&&echo -n Extracting...&&tar zxf rkhunter-$VERSION.tar.gz&&echo done&&echo -n Installing...&&cd rkhunter-$VERSION&&./installer.sh 2>&1 >/dev/null&&echo done&&echo -n Updating rkhunter...&&/usr/local/bin/rkhunter --update 2>&1 >/dev/null && /usr/local/bin/rkhunter --update 2>&1 >/dev/null &&echo done&&echo -n Running hash updater...&&chmod +x ../hashupd.sh && ../hashupd.sh -t /tmp 2>&1 >/dev/null&&echo done&&echo -n Cleaning up...&&cd ..&&rm -rf rkhunter-$VERSION* hashupd.sh &&echo done 
The hashupd.sh script will update the rkhunter hash files, you won't see anymore false alerts, hopefully.

p.s. sorry for necro'ing the post

Reply With Quote
  #3  
Old 01-15-2007, 06:42 AM
zacharooni zacharooni is offline
Community Guide
 
Join Date: Apr 2005
Posts: 1,214
Wow, thanks for this, this came in really handy!

Reply With Quote
Sponsored Links
  #4  
Old 01-15-2007, 07:17 AM
Jeff - Exceed Jeff - Exceed is offline
Web Hosting Master
 
Join Date: Mar 2005
Posts: 1,072
It's also a good idea to edit your SSH config and change the port to a high number and set it to protocol2.

Reply With Quote
  #5  
Old 01-16-2007, 04:39 PM
Apoc Apoc is offline
SolidHost
 
Join Date: Dec 2002
Location: Amsterdam/Rotterdam, NL
Posts: 2,085
Quote:
Originally Posted by Jeff - Exceed
It's also a good idea to edit your SSH config and change the port to a high number and set it to protocol2.
Or better yet, restrict access on the SSH port to only specific IPs. Changing the port to a high number doesn't help much really, if someone wants to find out the port number it only takes a simple portscan.

Reply With Quote
  #6  
Old 01-17-2007, 02:53 AM
zacharooni zacharooni is offline
Community Guide
 
Join Date: Apr 2005
Posts: 1,214
And set it to only accept Privkey authentication instead of passwords.

Reply With Quote
  #7  
Old 02-05-2007, 10:09 PM
cybiao cybiao is offline
New Member
 
Join Date: Feb 2007
Posts: 3
it's so improtent to protect our computer.fireproofing wall is needed.do you think so?

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Hosting Control Panel cPanel & WHM 11.34 Release Hits Stable Tier Web Hosting News 2012-11-12 17:04:57
Video: cPanel and Attracta Talk About Integrating SEO Tools into the Hosting Control Panel Whir Tv 2012-08-31 14:10:47
Control Panel cPanel Launches New Apache Configuration Script Web Hosting News 2011-12-28 19:41:39
cPanel Offers Windows Hosting Control Panel Enkompass for Free Web Hosting News 2011-10-13 17:14:16
cPanel to Launch Certification Program at cPanel Conference 2011 Web Hosting News 2011-09-21 18:15:42


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?