perl - 为什么 Perl Net::LDAP 与 GSSAPI SASL 绑定在 Debian buster 上连接到错误的 sasl_ssf?
问题描述
我有一个 Perl 脚本,可以使用带有 GSSAPI 绑定的 Net::LDAP 从 OpenLDAP 实例中读取。该脚本在 Debian stretch 上运行良好,但在 Debian buster 上失败。
请注意,在两台服务器上,运行的 Perl 代码底部的行ldapsearch
会产生相同的正确结果,因此我确信两台服务器上的 Kerberos 票证缓存都是正确的。
查看 OpenLDAP 日志,我看到 ldapsearch 运行显示了强度因子sasl_ssf=256 ssf=256
,而 Net::LDAP 绑定显示了强度因子sasl_ssf=1 ssf=256
。由于 Net::LDAP 绑定使用的是 Kerberos,所以sasl_ssf
应该是 56,而不是 1。
关于为什么 Net::LDAP 绑定连接错误的任何建议sasl_ssf
?
use strict;
use warnings;
use Authen::SASL;
use Net::LDAP;
use Data::Dumper;
my $server_name = 'ldap.example.com';
$ENV{'KRB5CCNAME'} = '/tmp/krb.tkt';
my $ld = Net::LDAP->new($server_name, version => '3');
$ld->start_tls(verify => 'require');
if (!$ld or $ld == -1) {
die "Could not connect to directory server $server_name";
}
my $SASL = Authen::SASL->new('GSSAPI');
my $status = $ld->bind(sasl => $SASL);
if ($status->code) {
die 'Bind error: (' . $status->error_name . ') ' . $status->error_text;
}
my $base = 'dc=example,dc=com';
my $filter = '(uid=johndoe)';
my @attrs = ('uid', 'sn');
$status = $ld->search(
base => 'dc=example,dc=com',
filter => $filter,
attrs => \@attrs,
) ;
my @entries = $status->all_entries;
# This results in nothing (but should result in the same data as the ldapsearch below):
warn Dumper @entries ;
my $attrs = join(' ', @attrs) ;
my $cmd = "ldapsearch -LLL -h $server_name -b $base '$filter' $attrs";
# This gives the correct result:
warn `$cmd`;
解决方案
推荐阅读
- android - 后压时如何恢复片段
- slack-api - 为什么 Slack 的 files.list 端点返回一个空的 files 数组?
- spring-cloud-stream - 使用 Spring Cloud DataFlow Streams 将“桶”同步到本地目录时出现问题
- python - DynamoDB 未收到整个 SQS 消息正文
- javascript - 关于 Next.js 的服务器错误的更有用的堆栈跟踪?
- python - 在 Keras 中从 .hdf5 加载模型权重时出错
- postgresql - 使用 crunchydata postgres 运算符部署自定义映像时出错
- sql - SQL Server 2019 ProgrammingError:“AUTO_INCREMENT”附近的语法不正确
- tableau-api - 计算不同年份的滚动平均值,同时显示按年份划分的数据
- math - 找到截断值的极限是什么意思?