【问题标题】:Apache authorization using require dbd-group from SQL Server databaseApache 授权使用 SQL Server 数据库中的要求 dbd-group
【发布时间】:2021-01-28 22:06:44
【问题描述】:

我有一个应用程序在 CentOS 7 上的 Apache 2.4.6 上的反向代理后面运行。我正在使用 Shibboleth 进行身份验证,目前正在使用 AuthGroupFile /path/to/authfileRequire group authGroup 通过白名单进行授权。这目前适用于我的设置。我正在尝试更改此过程以对存储在 SQL Server 数据库中的白名单进行授权,但事实证明这很困难。

目前在conf.d/shib.conf 我有以下内容:

DBDriver odbc
DBDParams "DATASOURCE=ODBCconn,USER=myUser,PASSWORD=myPwd"

<Location /authLocation>
  AuthType shibboleth
  ShibRequestSetting requireSession 1
  Require dbd-group myApp
  AuthzDBDQuery "SELECT appName FROM authTable WHERE UserLogin = %s"
</Location>

我的 DSM ODBCconn 我正在使用 ODBC Driver 17 for SQL Server,我可以使用该 DSM 通过 python 中的 pyodbc 使用这些凭据进行连接,所以我认为我的设置正确。在数据库中,appName 列将返回存储在authTable 中的用户被授权使用的应用程序的名称,或者本质上是用户所属的组。因此,如果用户有myApp 的行,他们将被授权使用myApp。我对文档 (https://httpd.apache.org/docs/trunk/mod/mod_authz_dbd.html) 的理解是我的查询应该如何用于定义组。

但是,在运行此程序时,我的 httpd/logs/error_log 中会出现一个 stack smashing error,它看起来像:

*** stack smashing detected ***: /usr/sbin/httpd terminated
======= Backtrace: =========
...
...
Long long list of files
...
...
[Thu Jan 28 09:36:53.306151 2021] [core:notice] [pid 10621] AH00052: child pid 24810 exit signal Aborted (6)
[Thu Jan 28 09:36:53.306215 2021] [core:notice] [pid 10621] AH00052: child pid 28192 exit signal Aborted (6)
[Thu Jan 28 09:36:53.306238 2021] [core:notice] [pid 10621] AH00052: child pid 31928 exit signal Aborted (6)

对于我的设置可能出现什么问题以这种方式阻止授权的任何帮助?

【问题讨论】:

    标签: sql-server apache authorization httpd.conf


    【解决方案1】:

    对于任何有类似问题的人,我终于能够自己解决问题。

    我的 Apache 版本是 2.4.6,但我相信最新的 RHEL 版本 httpd-2.4.6-97.el7.centos。查看 apache 2.4 (https://www.apachelounge.com/Changelog-2.4.html) 的更改日志,大部分 mod_authz_dbd 更改都包含在 CentOS 版本中,除了 Apache 2.4.17 中集成的一项名为

    *) mod_authz_dbd: Avoid a crash when lacking correct DB access permissions. 
    PR 57868. [Jose Kahan < jose w3.org>, Yann Ylavic]
    

    有趣的是,这种类型的崩溃似乎与我观察到的崩溃类型相似,尽管我的数据库访问权限是正确的。

    我按照此处的说明 (https://crosp.net/blog/administration/install-latest-apache-server-centos-7/) 安装了 Apache 2.4.46。使用上面列出的完全相同的.conf 文件,获取这个更新版本的 Apache 解决了我的问题。不幸的是,如果我走这条路,我的 Apache 现在没有 RHEL 的好处,但我假设 Apache 2.4.17 中的这个错误修复与我看到的错误有关。

    无论哪种方式,我认为值得一提的是我能够获得的解决方案,以防其他人遇到类似问题。

    【讨论】:

      猜你喜欢
      • 2018-05-03
      • 1970-01-01
      • 2019-04-30
      • 2021-11-29
      • 2011-02-20
      • 1970-01-01
      • 2011-10-05
      • 2014-06-23
      • 2016-10-12
      相关资源
      最近更新 更多