免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1218 | 回复: 0
打印 上一主题 下一主题

Secure Apache 1.3 [复制链接]

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-09 10:25 |只看该作者 |倒序浏览
General Information
Apache is the most popular web server in use today.  But, not everybody that sets up their Apache server takes the necessary steps to secure it properly from intruders.  This guide will show you some good security changes to make to your Apache installation.
Requirements
  • Local root access on the box or be able to su to root.
  • A SSH client that supports ANSI colors such as puTTy or SecureCRT (if you aren't on the box).
  • Your favorite text editor (I prefer nano).
  • Apache already installed.
    Configuration
    These are a few changes to make to your Apache configuration file.  Open httpd.conf in your favorite editor.
    #
    nano -w /usr/local/etc/apache/httpd.confIt's a good idea to hide what version of Apache you are running.  If you change ServerTokens to Prod then only "Apache" will be returned when polled by netcraft.  This limits fingerprinting.
    ServerTokens Prod
    Another tip to limit fingerprinting is to turn off the server signature on server-generated error pages.
    ServerSignature Off
    By default, users may have access to the root directory of the server.  We should restrict this access in case of any potential attacks.  Change your to the following:
        Options None
        AllowOverride None
        Order deny,allow
        Deny from all
    It is a good idea to disable TRACE and TRACK methods.  These are HTTP methods used to debug web server connections.  An attacker can trick legitimate web users to give him their credentials through cross-site-scripting attacks.
            RewriteEngine on
            RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
            RewriteRule .* - [F]
    mod_userdir can be convienent by accessing a user's homepage through http://my.domain.com/~user.  But using mod_userdir can pose a security risk because attackers can find out valid system users.  It is recommended that you disable the userdir module.  There are two methods of disabling mod_userdir.
    The first method is to comment out the following lines:
    LoadModule userdir_module     libexec/apache/mod_userdir.so
    AddModule mod_userdir.c
        UserDir disabled
        UserDir public_html
    *Note:  If you must allow some users to have UserDir directories, use the following:
        UserDir disabled
        UserDir enabled user1 user2
        UserDir public_html
    Make sure /server-status is disable so people cannot see your current Apache status.  It is disabled by default.
    #
    #    SetHandler server-status
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #
    Make sure /server-info is disabled so people cannot see your current Apache configuration.  It is disabled by default.
    #
    #    SetHandler server-info  
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #
    Now your Apache installation is all the more secure.  Happy web serving!


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4206/showart_523119.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP