{"id":6555,"date":"2009-10-09T10:05:24","date_gmt":"2009-10-09T14:05:24","guid":{"rendered":"https:\/\/www.bu.edu\/tech\/?page_id=6555"},"modified":"2015-02-03T09:20:04","modified_gmt":"2015-02-03T14:20:04","slug":"web","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/about\/security-resources\/bestpractice\/web\/","title":{"rendered":"Securing Web Servers"},"content":{"rendered":"<p>A web servers is one of the most common services to find running on a system today.\u00a0 They serve a wide variety of content types, can be easily configured to serve a limited or broad audience, and are quick to install and configure.\u00a0 Configuring one securely requires a bit more effort, and is the focus of this best practice document.<\/p>\n<p>Below we&#8217;ve provided some specific guidance on problems we often see with the two most common web servers: <a href=\"#apache\">Apache<\/a>, and <a href=\"#iis\">Microsoft&#8217;s Internet Information Server (IIS)<\/a>.\u00a0\u00a0\u00a0 You are encouraged to look at the documentation available for your web server and learn about its security settings before loading pages and web applications into it.\u00a0 If you have advice for other web server installations, please let us know and we can help you share the information with your colleagues.<\/p>\n<h3><a name=\"apache\"><\/a>Apache Configuration Tricks<\/h3>\n<p><strong>* Do not allow the server to serve php include files<\/strong><\/p>\n<p>Most php applications have include files and these files often contain sensitive information like system configuration data and passwords to databases.\u00a0 It is important that people browsing your site via the web server cannot see the contents of these files under any circumstances.\u00a0 Apache can be configured to prevent the sharing of these files by adding the following to your httpd.conf file and restarting the web server:<\/p>\n<pre style=\"padding-left: 30px;\">&lt;Files ~ \"\\.inc(.php)?\"&gt;\r\n  Order allow,deny\r\n  Deny from all\r\n  Satisfy All\r\n&lt;\/Files&gt;<\/pre>\n<p>Remember to test that it works after making the change!<\/p>\n<p><strong>* Do not allow public execution of phpinfo.php files.<br \/>\n<\/strong><\/p>\n<p>The phpinfo.php script is sometimes included by web applications or added by web developers to gain more information about the web environment and php configuration that is necessary for debugging.\u00a0 Under the hood, these scripts call a debugging function called phpinfo() that will report a lot of information such as your operating system type and kernel version.\u00a0 It is generally ill advised to give such information out to anyone who asks for it.\u00a0 In order to support your campus web developers you may need to make such scripts available to them, but you can add the following to your httpd.conf file to restrict access to campus users.<\/p>\n<pre style=\"padding-left: 30px;\">&lt;Files ~ \"phpinfo.php$\"&gt;\r\n  Order allow,deny\r\n  Allow from 128.197.\r\n  Allow from 168.122.\r\n  Allow from 155.41.\r\n  Deny from all\r\n  Satisfy All\r\n&lt;\/Files&gt;<\/pre>\n<p>Remember to test that it works after making the change!<\/p>\n<p><strong>* Disallow TRACK and TRACE directives<\/strong><\/p>\n<p>The TRACK and TRACE directives can be used by developers to debug certain types of problems on your web server, but odds are that you&#8217;ll never ever use them.\u00a0 Attackers, however, may use them against you to gain additional information about your server configuration.\u00a0 It is generally a bad idea to give out more information than you need to, so we advise turning this function off.<\/p>\n<p>For Apache version 1.3.34 (or later 1.3.x versions), or apache 2.0.55 (or later), this has been made easy. Just add the line &#8220;TraceEnable off&#8221; to your httpd.conf file and restart the server. If you are running an Apache that is older than either of these versions you should upgrade.<\/p>\n<p>Older versions of Apache can achieve similar functionality using rewrite rules by adding the following to the configuration file:<\/p>\n<pre style=\"padding-left: 30px;\"># Turn on the rewrite engine\r\nRewriteEngine On\r\nRewriteLog logs\/rewrite-log\r\nRewriteLogLevel 4\r\n# Get rid of track and track\r\nRewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)\r\nRewriteRule .* - [F]<\/pre>\n<p><strong>* Weak SSL ciphers<\/strong><\/p>\n<p>The default configuration of Apache&#8217;s SSL module allows a wide variety of ciphers that are weaker than necessary for most applications.\u00a0 In general, if you&#8217;re using SSL you want the data to be transmitted as securely as possible so allowing weak ciphers only dilutes the security you were hoping to achieve.\u00a0 You can change the ciphers available for use by altering the SSLCipherSuite directive in your httpd.conf or ssl.conf file (depends on your installation).\u00a0 Setting the variable as follows gets rid of ciphers that have less than 128 bits, several export ciphers and some of the weaker Diffie-Hellman ciphers.<\/p>\n<pre style=\"padding-left: 30px;\">SSLCipherSuite !ADH:!EXP:RSA:HIGH:MEDIUM:!NULL:!LOW<\/pre>\n<p>Be aware that this may interfere with the ability of some computers sold and operated outside of the US from connecting to your SSL server because there will be no cipher available for them.\u00a0 If that isn&#8217;t you audience, however, this should work just fine.<\/p>\n<p><strong>* Disable SSL Versions 2 and 3<\/strong><\/p>\n<p>The SSL version 2 and 3 protocols contains numerous cryptographic flaws that makes it unsafe for use, yet it is still supported by Apache and selected by default by a number of clients that are capable of using something better. It is advised that you force browsers to use TLS Version<\/p>\n<p>1.2 by removing the support for SSL. This can be done via the configuration file (httpd.conf or ssl.conf depending on your installation) by supplying the SSLProtocol Directive as follows:<\/p>\n<pre style=\"padding-left: 30px;\">SSLProtocol all -SSLv2 -SSLv3<\/pre>\n<h3><a name=\"IIS\"><\/a>IIS Configuration Tricks<\/h3>\n<p><strong>* Installing and Securing IIS<\/strong><\/p>\n<p>Microsoft has dedicated a chapter in their <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms994921.aspx\">Improving Web Application Security: Threats and Countermeasures Guide<\/a> to <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa302432.aspx\">Securing Your [IIS] Web Server<\/a> that you should review for helpful advice on how to best install and configure your web server for secure operation.<\/p>\n<p><strong><\/strong>The steps required to secure IIS vary for each version of IIS.\u00a0 The people at Windows Security have put together a guide for <a href=\"http:\/\/www.windowsecurity.com\/articles\/Installing_Securing_IIS_Servers_Part1.html\" target=\"_blank\">installing and securing IIS servers<\/a> that covers the basics for each version of the server.\u00a0 We advise that you take a look through the guide and follow the instructions that are relevant to your environment.<\/p>\n<p><strong>* Disable SSL Versions 2 and 3<\/strong><\/p>\n<p>The SSL Version 2 and 3 protocols contains numerous cryptographic flaws that makes it unsafe for use, yet it is still supported by IIS and selected by default by a number of clients that are capable of using something better.\u00a0 It is advised that you force browsers to use TLS Version 1.2 by removing the support for SSL.\u00a0 Microsoft has provided <a href=\"http:\/\/support.microsoft.com\/kb\/187498\">Knowledge Base Article on Disabling SSL Protocols in IIS<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A web servers is one of the most common services to find running on a system today.\u00a0 They serve a wide variety of content types, can be easily configured to serve a limited or broad audience, and are quick to install and configure.\u00a0 Configuring one securely requires a bit more effort, and is the focus&#8230;<\/p>\n","protected":false},"author":2127,"featured_media":0,"parent":6549,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/6555"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/2127"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=6555"}],"version-history":[{"count":21,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/6555\/revisions"}],"predecessor-version":[{"id":85897,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/6555\/revisions\/85897"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/6549"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=6555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}