AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[mod-authz-host](server)

Martin Hope
Brad
Asked: 2021-03-19 07:01:34 +0800 CST

Apache Require IP 指令不起作用

  • 0

我的 apache 配置文件中有以下内容:

Define THUMBS_ROOT "//mysmbserver/website/thumbs"
Alias "/thumbs" "//mysmbserver/website/thumbs"
<Directory {THUMBS_ROOT}>
    Options Indexes FollowSymLinks
    <RequireAny>
        Require ip 66.54.56.34
        Require ip 159.101.84.4
    </RequireAny>
</Directory>
LoadModule authz_core_module modules/mod_authz_core.so

我的 apache 版本是 Apache/2.4.29 (Win64)。(是的,我意识到这是 Apache 的旧版本 - 由于它是一个设备设备,我无法升级)

即使我添加了 RequireAny 和 RequireIP apache 也忽略了这一点,并允许任何 IP 访问 thumbs 目录。我不知道为什么。谁能帮我理解?

更复杂的事情我有一个负载平衡器设备位于 apache 前面,所以我真正需要查看的是 X-Forwarded-For 而不是源 IP。我不确定是否需要为 RequireIP 做任何事情来检测 X-Forwarded-For?

无论哪种方式,它都允许访问,而不管 IP 是什么。

编辑:我也试过:

LoadModule authz_core_module modules/mod_authz_core.so
Define THUMBS_ROOT "//mysmbserver/website/thumbs"
Alias "/thumbs" "//mysmbserver/website/thumbs"

SetEnvIF X-Forwarded-For "66.54.56.34" AllowIP1
SetEnvIF X-Forwarded-For "159.101.84.4" AllowIP2

<Directory {THUMBS_ROOT}>
    Options Indexes FollowSymLinks
    <RequireAny>
        Require env AllowIP1
        Require env AllowIP2
    </RequireAny>
</Directory>

那也行不通。

apache-2.4 mod-authz-host
  • 1 个回答
  • 211 Views
Martin Hope
hellb0y77
Asked: 2016-10-26 06:07:19 +0800 CST

基本身份验证 apache 2.2 绕过 IP

  • 0

如何设置 apache 2.2 的基本身份验证以绕过 IP?我已经关注了这个 wiki http://wiki.apache.org/httpd/BypassAuthenticationOrAuthorizationRequirements,但总是询问密码,也列出了 IP:

<Directory /var/www/html/mydir>
    AuthName "Private"
    AuthType Basic
    AuthUserFile "/etc/httpd/htpasswd"
    Require valid-user
    Order allow,deny
    Allow from 111.111.111.111 222.222.222.222
    Satisfy any
</Directory>

我在haproxy下,但我设置了IP转发,我已经这样设置LogFormat了:

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

access_log 是:

111.111.111.111 - - [25/Oct/2016:12:35:41 +0200] "GET /index.html HTTP/1.1" 401 487 "-" "Mozilla/5.0 (X11; Linux armv7l; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.7.0"
apache-2.2 authentication http-basic-authentication mod-authz-host
  • 1 个回答
  • 1904 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve