【问题标题】:GNU SASL GSSAPI ExampleGNU SASL GSSAPI 示例
【发布时间】:2020-03-13 21:48:52
【问题描述】:

我似乎无法在任何地方找到如何将 GNU 的 SASL 与 gssapi 机制一起使用的示例。我试过这样启动它(只是猜测它是如何工作的):

        gsasl_init(&ctx);
        gsasl_client_start(ctx, "GSSAPI", &session);

但我从 gsasl_client_start 收到 GSASL_UNKNOWN_MECHANISM 错误。有谁知道如何使用gsasl?有人可以指点我的教程吗?

【问题讨论】:

标签: c sasl gssapi


【解决方案1】:

这显然是因为库没有使用 GSSAPI 支持构建;查看源代码(`libgasl-1.8.1'),唯一可以返回这个的地方是:

// src/xstart.c
static int
setup (Gsasl * ctx,
       const char *mech,
       Gsasl_session * sctx,
       size_t n_mechs, Gsasl_mechanism * mechs, int clientp)
{
  Gsasl_mechanism *mechptr = NULL;
  int res;

  mechptr = find_mechanism (mech, n_mechs, mechs);
  if (mechptr == NULL)
    return GSASL_UNKNOWN_MECHANISM;

所以这意味着它不是库支持它的情况,但它无法在计算机上找到支持它的资源(例如 kerberos)。

当我尝试在自己的系统上编译它时,configure 没有启用 GSSAPI,因为它找不到重要的东西:

...
checking if DIGEST-MD5 should be used... yes
checking if SCRAM-SHA-1 should be used... yes
checking if SAML20 should be used... yes
checking if OPENID20 should be used... yes
configure: checking for GSS implementation (yes)
configure: auto-detecting GSS/MIT/Heimdal
configure: use --with-gssapi-impl=IMPL to hard code
configure: where IMPL is `gss', `mit', or `heimdal'
checking for libgss... no
configure: WARNING: GNU GSS not found (see http://www.gnu.org/software/gss/)...
configure: WARNING: Auto-detecting MIT/Heimdal is unreliable, disabling GSSAPI
checking if KERBEROS_V5 should be used... no
...

因此要么缺少某些基础包,您需要获取相关但名称不同的包(包括此支持),或者您需要使用启用所需功能的选项自己构建它。

【讨论】:

  • 你说得对。我在包构建历史记录中看到了同样的错误:build.opensuse.org/package/show/openSUSE%3AFactory/libgsasl 我将不得不向维护者提出问题。看起来他们需要在配置使用 mit krb5 时指定 --with-gssapi-impl (因为我看到该包明确需要 krb5-devel 包)。
  • 我用 --with-gssapi-impl=mit 重建了 libgsasl,它可以工作了!我还提交了针对 opensuse 的修复。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-09
  • 1970-01-01
  • 2016-10-04
  • 2018-06-09
  • 1970-01-01
相关资源
最近更新 更多