nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Apache php web server security by hiding version information

This is a discussion on Apache php web server security by hiding version information within the Getting started tutorials forums, part of the Linux Getting Started category; Task learn how to secure Apache and PHP by hiding version information and other information Attacker will always try to ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-12-2006, 06:05 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default Apache php web server security by hiding version information

Task learn how to secure Apache and PHP by hiding version information and other information

Attacker will always try to find out your PHP and Apache version using simple method. Most bugs are version specific. You can hide Apache and PHP information easily. But first let us see how much information is displayed by your installation:

Try out following php urls (replace your-domain-name.com with your actual domain) and you will know how much information you are giving out to attacker.
http://your-domain-name.com/index.ph...9-4C7B08C10000
http://your-domain-name.com/index.ph...9-00AA001ACF42
http://your-domain-name.com/index.ph...9-00AA001ACF42
http://your-domain-name.com/index.ph...9-00AA001ACF42

Get your Apache server information using telnet
Code:
telnet domain.com 80
When connected type HEAD / HTTP/1.0, followed by [Enter] key.

Output:
Code:
Trying 206.xxx.xxx.xxx...
Connected to your-domain-name.com.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 200 OK
Date: Wed, 20 Dec 2006 11:30:42 GMT
Server: Apache/2.0.52 (Red Hat)
Accept-Ranges: bytes
Content-Length: 3985
Connection: close
Content-Type: text/html; charset=UTF-8
Connection closed by foreign host.
It is providing Apache version and distribution name.

How do I Hide Apache Version info?
Open httpd.conf file (located in /etc/httpd/ directory /etc/apache2/ )
Code:
vi httpd.conf
Set Apache ServerTokens to product only but don't show version and other info:

Code:
ServerTokens Prod
This directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules.

Setting this to Prod only displays Apache and nothing else.

Set Apache ServerSignature off
Code:
ServerSignature Off
The ServerSignature directive allows the configuration of a trailing footer line under server-generated documents.

How do I hide php info?
Open php.ini (located in /etc/php.ini or /etc/php5 or /etc/php4 directory)
Code:
vi php.ini
Make sure php does not display errors and other php information. Modify add setting as follows:
Code:
expose_php = Off
display_errors=Off
register_globals = Off
Also send all errors to /var/log/php-scripts-error.log and not on screen to end user. It can provide serious information to user.
error_log = /var/log/httpd/php-scripts-error.log

Restart Apache.
Code:
/etc/init.d/httpd restart
Now all php script errors are written to /var/log/httpd/php-scripts-error.log. Ask your website developers to use following commands to view log files
Code:
tail -f /var/log/httpd/php-scripts-error.log
vi /var/log/httpd/php-scripts-error.log.
For more info please read Apache 2 docs http://httpd.apache.org/docs/2.2/mod/core.html
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #2 (permalink)  
Old 20-12-2006, 06:12 PM
Junior Member
User
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
cbzee
Default

wow, my server is giving all this info

thanks for sharing ... really appricate your effort
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Upgrade Apache Server sweta Ubuntu / Debian 0 01-11-2007 02:53 AM
Squid information ssent12 Getting started tutorials 2 15-08-2007 06:43 PM
Linux create self signed ssl certificate for Apache httpd server raj Getting started tutorials 0 05-05-2007 01:23 AM
Linus torvalds Information tom Getting started tutorials 2 05-01-2006 07:07 PM
NFS version p_narahari Solaris/OpenSolaris 3 28-06-2005 07:17 PM


All times are GMT +5.5. The time now is 10:24 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38