拒绝访问 Apache 上的 .svn 文件夹 [英] Deny access to .svn folders on Apache

查看:47
本文介绍了拒绝访问 Apache 上的 .svn 文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 Subversion 中有一个 Rails 应用程序,我们使用 Capistrano 部署它,但注意到我们可以访问/.svn"中的文件,这存在安全问题.

我想知道这样做的最佳方法是什么.一些想法:

  • 用于拒绝访问的全局 Apache 配置
  • 在公共文件夹和所有子文件夹中添加 .htaccess 文件
  • 更改权限的上限任务

我真的不喜欢删除文件夹或使用 svn 导出的想法,因为我想保留 'svn 信息'.

解决方案

最好的选择是使用 Apache 配置.

使用 htaccess 或全局配置主要取决于您是否控制服务器.

如果你这样做,你可以使用类似的东西

<前><目录匹配 .*\.svn/.*>拒绝所有人

如果不这样做,您可以使用 FilesMatch 在 .htaccess 文件中执行类似的操作

We have a rails application in subversion that we deploy with Capistrano but have noticed that we can access the files in '/.svn', which presents a security concern.

I wanted to know what the best way to do this. A few ideas:

  • Global Apache configuration to deny access
  • Adding .htaccess files in the public folder and all subfolders
  • Cap task that changes the permissions

I don't really like the idea of deleting the folders or using svn export, since I would like to keep the 'svn info' around.

解决方案

The best option is to use Apache configuration.

Using htaccess or global configuration depends mainly on if you control your server.

If you do, you can use something like

<DirectoryMatch .*\.svn/.*>
    Deny From All
</DirectoryMatch>

If you don't, you can do something similar in .htaccess files with FilesMatch

这篇关于拒绝访问 Apache 上的 .svn 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆