ash's profile又知易行难了PhotosBlogLists Tools Help

    保护Rails应用的svn目录

    Rails开发者喜欢用Capistrano来自动化部署网站应用(什么,你不用?),即使不使用自动化部署,很多人也会使用svn co直接将代码取到网站应用目录。这给网站信息泄漏提供了方便。使用下面的地址,就能访问到这样的网站的svn信息:

    • http://somesite.com/.svn/entries
    • http://somesite.com/.svn/javascripts/entries

    这可不大妙,因为这个文件里包含了你的svn库的地址、用户名和当前目录内容等很多信息。最好通过服务器配置来禁止对.svn目录的访问。在nginx下,可以在server配置下加入这一条:

    location ~ /\.svn {
        deny    all;
    }
    

    另一种方式是在config/deploy.rb中加入以下设置,使用svn export来导出代码:

    set :deploy_via, :export
    

    不过很多时候为了手工维护站点的需要,我更倾向于用svn co(svn checkout)。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.
    ash has turned off comments on this page.

    Trackbacks

    The trackback URL for this entry is:
    http://ashchan.spaces.live.com/blog/cns!8611A45461AE7EA6!1821.trak
    Weblogs that reference this entry
    • None