5 Basic Steps To Protect Your Hosting Server

Started on the old forum in August 2008 · view the original in the archive · old links redirect here

5 replies · 1,063 views · started 18 years ago · 2 min read

5 participants
KillaKlan Developer · 145 posts #1

hi there its very important to protect our website . so i thought to share this steps. here is some advices to follow....

  1. Config your php.ini

safe_mode = On [This is optional, many open sources applications will not run properly] fopen = Off disable_functions = “apache_get_modules, apache_get_version, apache_getenv, apache_note, apache_setenv, disk_free_space, diskfreespace, dl, highlight_file, ini_alter, ini_restore, openlog, passthru, proc_nice, shell_exec, show_source, system”

  1. Config your .htaccess

Add these more lines to your .htaccess file:

SetEnvIfNoCase User-Agent “^libwww-perl*” block_bad_bots Deny from env=block_bad_bots

  1. Look after your host

Use zgrep to check your log. Example: zgrep “?=http://” /var/www/html//statistics/logs/access_log*| awk ‘/Dec/ && /libww/ && $9 !~/^4/’ The hacker usually make use of perl-libww to include the script, so run this command, you could figure out.

Exploit files are often uploaded on tmp directory, so try to remove them by these commands:

find /var/tmp -user apache -exec rm -Rf {} ; find /tmp -user apache -exec rm -Rf {} ; find /var/spool/samba -user apache -exec rm -Rf {};

  1. Database security:

You should create one user for each databse for each application. By doing this way, even one of your sites is attacked or stole the database, others are still remained.

Then, try to back up your all databases, at least, weekly

  1. Take care your web applications:

Last but not least. ALWAYS UPGRADE YOUR APPLICATIONS, especially when you are using open source application such as joomla, wordpress, drupal … Many exploit are discovered and informed to the community. Hence, the bad guy can make use of them to attack the old version.

Absolutely, 5 steps above are just very very basic fundamentals to protect ourself from some script kiddies, they may be useless, against a real hacker. If you have any experiences in this matter, I am very pleased to discuss in order to improve our knowledge.

amylee Principal · 1,092 posts #2

pfft.. yeah good intentions but this is just a copy from another forum no mention of proper security like for example mod_security, mod_evasive, chrooting directorys, changing the user which runs apache, protecting the tmp dirs, securing the kernel, disabling root login, banning root from compiling and using wget, securing sudo, installing a rootkit, installing a firewall, ddos protection, changing common ports like ftp and ssh plus securing against port scanners

and so on need more than 5 basic steps to fully protect a server i've spent months reading about securing a server and i'm still learning how to do it

subzero Super moderator Fellow · 3,954 posts #4

first step is getting

ssl 256 bit shell off not on ! ftp main trun off make the password to ech down load's any uploads edit upload.php fillter php in names or code a header to send the file to user

and dont piss off hackers lol thats the pin of the story lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

GiLL Senior · 356 posts #5

Alot of people are talking about SSH attacks, ways to prevent them. Methods:

  1. Allow the IPs you would like to have access to SSH through your firewall. Code:
Example: 
iptables -A INPUT -i eth0 -s 10.10.10.10 -p tcp --dport 22 -j ACCEPT
  1. Change SSH port. Code:
Example:
Edit your ssh configuration file under /etc/ssh/sshd_config and add/replace this line:
Port 6445
  1. Use a utility like BFD, BlockHosts and DenyHosts
  2. Use ip tables to limit the rate of incomming connections to SSH. Code:
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent   --set

iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent   --update --seconds 60 --hitcount 4 -j DROP

This will limit incoming connections to port 22 to no more than 3 attemps in a minute. Any more will be dropped.

You can adjust the numbers yourself to limit connections further.
  1. Use Port knocking to open a the port for the firewall.
Example using iptables:

# Netfilter/IPtables - example of multiple-port knocking
# Note: Knock ports 100,200,300,400 to open SSH port for 5 seconds.
# Nice thing to knock TCP with is `telnet' program:
# $> alias k='telnet ip_address_or_hostname'
# $> k 100; k 200; k 300; k 400; ssh ip_address_or_hostname
# Then press Ctrl-C 4 times. That's all. Enjoy.

HOST_IP="12.34.56.78"

/sbin/iptables -N INTO-PHASE2
/sbin/iptables -A INTO-PHASE2 -m recent --name PHASE1 --remove
/sbin/iptables -A INTO-PHASE2 -m recent --name PHASE2 --set
/sbin/iptables -A INTO-PHASE2 -j LOG --log-prefix "INTO PHASE2: "

/sbin/iptables -N INTO-PHASE3
/sbin/iptables -A INTO-PHASE3 -m recent --name PHASE2 --remove
/sbin/iptables -A INTO-PHASE3 -m recent --name PHASE3 --set
/sbin/iptables -A INTO-PHASE3 -j LOG --log-prefix "INTO PHASE3: "

/sbin/iptables -N INTO-PHASE4
/sbin/iptables -A INTO-PHASE4 -m recent --name PHASE3 --remove
/sbin/iptables -A INTO-PHASE4 -m recent --name PHASE4 --set
/sbin/iptables -A INTO-PHASE4 -j LOG --log-prefix "INTO PHASE4: "

/sbin/iptables -A INPUT -m recent --update --name PHASE1

/sbin/iptables -A INPUT -p tcp --dport 100 -m recent --set --name PHASE1
/sbin/iptables -A INPUT -p tcp --dport 200 -m recent --rcheck --name PHASE1 -j INTO-PHASE2
/sbin/iptables -A INPUT -p tcp --dport 300 -m recent --rcheck --name PHASE2 -j INTO-PHASE3
/sbin/iptables -A INPUT -p tcp --dport 400 -m recent --rcheck --name PHASE3 -j INTO-PHASE4

/sbin/iptables -A INPUT -p tcp -s $HOST_IP --dport 22 -m recent --rcheck --seconds 5 --name PHASE4 -j ACCEPT
This script can be found @ [url]http://pub.ligatura.org/fs/netfilter...ortknock_multi[/url]

left wap stuff

ritu Newbie · 8 posts #6

i am new to the server of apache guys.. help me out to make a new server secure.. i dont get a single statement.

hello to PHP

my chat site

!! Glad To Be HeRe !!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close