1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Sunday, March 4, 2012

10 Apache Security and Hardening Tips

http://www.kyplex.com/docs/apache-security.html
 | Kyplex cloud security

The Apache web server is a crucial part of the website infrastructure. It has a number of built in features that can improve your website resistance to attacks. The following document covers a number of steps that will help you to achieve this goal. This document is largely based on the knowledge gathered by our security team and by statistics information revealed by our security scanner.

Tip No. 1: Disable Apache Signature and/or Apache Banner

Apache Signature or Apache Banner is basically the same thing. It is an application name together with version name that is printed when performing a web request. Nobody actually needs this information at all, but it is enabled by default. You need to alter the Apache configuration file to disable it.
In Ubuntu, you need to change the following file: /etc/apache2/apache2.conf
Double check that ServerSignature and ServerTokens configuration settings are not enabled in some other parts of the configuration file.

Tip No. 2: The Trace HTTP Request

HTTP TRACE request is used to echo back all received information. It can be tricked to print HTTP cookies and as a result steal HTTP session. Basically this request can be used as part of the Cross Site Scripting attack, or XSS. It is recommended to disable it as a security precaution.
Add the following to the web-server's configuration file. For example alter the following file in Ubuntu: /etc/apache2/apache2.conf .

Tip 3: Remove PHP scripts that print debug info using phpinfo()

The built-in PHP function phpinfo() prints a lot of interesting internal information about the PHP environment. It can include list of which PHP modules are enabled, and the location of various files on the web-server and other sensitive information. Our web security scanner finds a lot of such files. It is recommended to remove these test files from a production website.
Here is a tip hpw to find such files. Look for the files with the following name: test.php,info.phpi.php and phpinfo.php in your website directory and remove them.

Tip 4: Disable directory indexing

Directory indexing is a features found in every web-server by default. When directory indexing is enabled, the web-site prints a list of files found in the website directories when the default page does not exists (for example index.php). Directories reported can be viewed by any visitor. It is vulnerable in the sense that these directories can contain configuration, private and backup files which can be used by the attackers to take your server under control.
You can fix this problem by disabling the Apache autoindex module. In some Apache installations it is called mod_autoindex.so. In Ubuntu, you just need to remove the following files:
So you can do it running the following commands:

Tip 5: Disable WebDAV

WebDAV is a file access protocol created over HTTP protocol. It allows you to upload and download files, and change file contents from the website. This service is required only in very rare cases. From our experience, this feature was only required to run SVN server (link). Make sure that WebDAV is disabled in production websites. When WebDAV is enabled, the following commands are supported by Apache: OPTIONS, PROPFIND, etc. These commands are sensitive from computer security point of view.
You can fix this problem by disabling Apache dav, dav_fs and dav_lock modules. In Ubuntu you just need to remove the following files:
So you can do it running the following commands:

Tip 6: Create a chroot'ed Apache environment

Chroot is a kind of virtual environment supported operating systems such as Linux and FreeBSD. When an application is executed in chrooted environment it has no access to the parent disk and to other recources.
This is a good solution if you want to protect your website from malicious users. The action steps required to create chroot Apache was already covered in a number of websites. For example: http://www.linux.com/archive/feed/36331
The main hidden issue with chrooted environment is that this environment protects the websites from accessing the operating system's files. It does not protect one site from another. In other words, if a malicious script located in one site it can access files located on other site because they are located on the same chrooted environment.
A solution to this problem is the following. Create a number of apache instances, each one hosting one website running each one if different chrooted directory. These apache instances will not be able to share IP addresses. You will have to configure different IP for each Apache instance you run.

Tip 7: Enable PHP basedir

PHP has built in a kind of chroot environment. It is called "basedir". You can configure PHP scripts to access files only in specific directory similar to chroot. Basically you can configure each site to access only files located in that site directory which is a very good idea from the security point of view.
You can add the following lines to the website configuration file or to .htaccess file to enable PHP basedir:
This will specify that your PHP scripts can access only specified directories.

Tip 8: Web Stats

Some webmasters install open source tools on their website that analyze web requests and create statistical reports. Access to these webstat scrips is almost never secured with a password. So any visitor can basically view such reports. For example some webmasters install in in the /stats directory accessible by http://www.my-site.com/stats .
Statistical reports contain a lot of sensitive information. For example it can contain hidden file names and directory names, full web requests, search engine keywords, etc... All this information can be used by the malicious users and/or your competitors.
Instead of running a statistics script on your website we recommend that you use Google Analytics. It is a free-of-charge and quality service.

Tip 9: Use Google

Most of the webmasters use common web scripts and CMS or blog software. We recommend you to frequently search for security updates using Google and register for security news at your blog/CMS website.

Tip 10: Additional Steps

If your webserver runs together with MySQL server it brings additional potential security problem. MySQL can read any files located on you server including the one located in different chrooted environments. It happens because of the FILE permission. By default only MySQL root has it. For more info about MySQL security take a look at this article ( link to GreenSQL) .
Install a Database Firewall
Download GreenSQL Express which is a free version of the GreenSQL database firewall.
Install a Web Firewall
Mod_security is a good open source product.
Additional links

Wednesday, February 1, 2012

10 Things to do After Installing WordPress

http://www.problogdesign.com/wordpress/10-things-to-do-after-installing-wordpress/
 | Pro Blog Design

The WordPress 5-minute install is great, nothing complicated about getting your blog up and running (most of the time). But once you install WordPress there are a number of other steps that you need to take in order to get the most from your blog.
Use the following as a to-do checklist for your future installations and you'll keep yourself right.

1. Change the Admin Password and Manage Your Authors

WordPress gives you some random concoction of a password that you're *never* going to remember so the first thing you need to do is change this to something memorable.
Manage your user settings via the Users panel, and you can add any additional blog authors here.

2. Edit Permalinks

By default your articles' urls will look something like www.leemunroe.com/?p=396. This url structure is poor for SEO and poor for usability (makes no sense to your users).
By changing your url structure to something like www.leemunroe.com/25-hot-female-web-designers you can include the post's keywords in the url and it makes more sense to your users.
  1. Go to Settings > Permalinks
  2. Under 'Common settings' choose 'Custom Structure'
  3. Enter %postname%/ in the field
  4. Or if you prefer to have the category in the url as well, enter %category%/%postname%/
pro-permalinks

3. Upload Your Theme and Activate It

  1. Download a theme or design your own
  2. Unzip and upload it to wp-content > themes
  3. Activate it via Appearance > Themes (then just click on your theme)

4. Add Your Categories and Change the Default

When you install WordPress the default category is 'Uncategorized' and this just looks ugly. Assume at some point you're going to post an article and forget to select a category – what would you want that post to come under by default? I tend to use News or something general like that.
  1. Go to Posts > Categories
  2. Click on 'Uncategorized' to edit it – change it to 'News' or similar
  3. Add your other blog categories

5. Activate Akismet

Akismet is a plugin that blocks comment spam and if your blog allows comments then trust me, you're going to get spammed.
Fortunately Akismet comes with WordPress, you just need to activate it.
  1. Go to the Plugins page in the admin area and activate Akismet
  2. To complete Akismet activation, WordPress requires an API key. You can get this by registering onWordPress.com then viewing your profile.
  3. Now go to Plugins > Akismet Configuration, and paste in your key.
pro-akismet

6. Install Google XML Sitemaps

Google XML Sitemaps generates a compliant XML-Sitemap for your site, allowing the major search engines (Google, Yahoo, Ask, MSN) to easily index your site. Every time you edit or add a post, the sitemap will modify itself.
Now go to Google Webmaster Central and log in with your Google Account. On the first page, there will be a link to "Verify" your site. Follow the instructions there.
Once that's done, you can then click the "Add Sitemap" link from the first page and put in the URL to your sitemap, which will be http://www.yoursite.com/sitemap.xml
pro-sitemaps

7. Install WordPress Database Backup

Always good to have a backup in place. Things may go wrong with your server, or you could even make a mistake yourself.
WordPress Database Backup will backup your WordPress blog, and you can even set it so it will email you a backup on a weekly basis, so you don't have to do anything yourself but activate it.
pro-backup

8. Test Your Blog With Dummy Content

You'll not know what your blog will truly look like until you have thoroughly tested it with multiple posts and all types of formatting applied.
Save yourself some time by using this sample post collection from WP Candy.
Import the sample post collection (Tools > Import > WordPress) and your blog will compile with sample posts including comments, parent/child categories and formatting, allowing you to thoroughly test it and make any theme alterations.

9. Add your RSS feed to Feedburner

First edit your RSS settings. Settings > Reading and you can edit how many posts you want to show in your RSS feed and whether they should show the full post or not.
Now you want to burn your feed with Feedburner. Feedburner will provide you with stats on your feeds and automatically ping services so your new content is updated immediately along with a whole host of other services.
Once you have signed up to Feedburner, change your feed subscription link in your theme. Place the following code between the head tags.
 1 
 <link rel="alternate" type="application/rss+xml" title="Feed Title" href="YOUR FEEDBURNER URL" />
pro-feedburner

10. Activate your Analytics

Keep track of your users and traffic. I recommend Google Analytics. Other good analytic services available include Mint and StatCounter.

Optional

Here's a few optional to-dos. Not as major as the above but you still might need to check them.

Change your Media image sizes

Change your image sizes depending on the size of your content area.
Settings > Media

Change your blog tagline

Your tagline may or may not be included in your theme but it's most likely included in your RSS feed.
Settings > General

What else?

Is there anything else you do after a fresh WordPress install? Please share.

Further Reading

About the authorLee Munroe is a freelance web designer from Belfast. You can see his other writings on web design and WordPress at his blog, or follow him on Twitter.

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...