未解決
1 Rookie
•
12 メッセージ
0
46
2025年2月18日 07:59
MDSとOpenLDAPの連携について
お世話になります。
MDSのLDAP設定についてご教授ください。
環境:MDS 9148(NX-OS:9.4.1)
OpenLDAP
MDSのログインユーザをOpenLDAP(Port636)と連携しようとMDS側にLDAP設定をして
test aaa groupコマンドにて確認を行ったところ、
error authenticating with servers in group
が出力されてしまいました。
LDAPサーバのIPアドレスおよび、test aaa groupで使用したユーザ/パスワードには間違いはありません。
お手数ですが、設定方法(cnやouのして方法など)について誤りがないかご教授いただけないでしょうか。
■MDS show run(一部抜粋)
ldap-server host xxx.xxx.xxx.xxx rootDN "cn=mds_bind_only,ou=People,dc=test,dc=local" password 7 xxxxxxxxxxxxxxxx port 636
ldap-server host xxx.xxx.xxx.xxx enable-ssl
ldap search-map MDSmap
userprofile attribute-name "description" search-filter "cn=$userid" base-DN "cn=mds-admin,ou=Group,dc=test,dc=local"
user-certdn-match attribute-name "description" search-filter "cn=$userid" base-DN "cn=mds-admin,ou=Group,dc=test,dc=local"
aaa group server ldap MDSLogin1
server xxx.xxx.xxx.xxx
ldap-search-map MDSmap
■test aaa groupコマンドとdegugログ(一部抜粋)
# test aaa group MDSLogin1 testuser01 xxxxxxx
error authenticating with servers in group
ldap: ldap_server_config: Got for Protocol server index:1 addr:xxx.xxx.xxx.xxx
ldap: ldap_server_config: got back the return value of Protocol server xxx.xxx.xxx.xxx operation: SUCCESS, desc: SUCCESS
ldap: Retrieving hash for key xxx.xxx.xxx.xxx default 636 1
ldap: Using secure LDAP, URI : ldaps://xxx.xxx.xxx.xxx:636
ldap: ldap_client_auth_init: (user testuser01) - ldap_init success for host xxx.xxx.xxx.xxx port 636
ldap: ldap_do_initial_bind: rootDN : cn=mds_bind_only,ou=People,dc=test,dc=local
ldap: ldap_do_initial_bind: baseDN : cn=mds-admin,ou=Group,dc=test,dc=local
ldap: ldap_do_initial_bind: userDN :
ldap: ldap_do_initial_bind: (user testuser01) - ldap_bind for root failed - error[-1] Can't contact LDAP server
ldap: ldap_client_auth_init: (user testuser01) -Initial auth failed isssl: 1
■LDAP設定
$ ldapsearch -x -LLL "cn=mds-admin"
dn: cn=mds-admin,ou=Group,dc=test,dc=local
objectClass: posixGroup
cn: mds-admin
gidNumber: 1000
memberUid: testuser01
description: network-admin
$ ldapsearch -x -LLL "uid=mds_bind_only"
dn: uid=mds_bind_only,ou=People,dc=test,dc=local
objectClass: top
objectClass: posixAccount
objectClass: pilotPerson
cn: mds_bind_only
sn: mds_bind_only
uid: mds_bind_only
uidNumber: 1111
gidNumber: 1111
homeDirectory: /home/mds_bind_only
loginShell: /bin/bash
■LDAPユーザ設定
$ ldapsearch -x -LLL "uid=testuser01"
dn: uid=testuser01,ou=People,dc=test,dc=local
objectClass: top
objectClass: posixAccount
objectClass: pilotPerson
cn: TARO YAMADA
sn: YAMADA
uid: testuser01
uidNumber: 2789
gidNumber: 1042
mail:
homeDirectory: /home/testuser01
loginShell: /bin/bash
MDS LDAP設定参考:https://www.cisco.com/c/ja_jp/td/docs/dcn/mds9000/sw/9x/configuration/security/cisco-mds-9000-nx-os-security-configuration-guide-9x/configuring_security_features_on_external_aaa_server.html#con_2130468
また、念のため確認です。
今回、LDAPサーバ側はOpenLDAPを使用しているのですが、OpenLDAPとの連携の場合、
MDS側:ldap search-mapのattribute-nameはdescriptionを指定
LDAP側:descriptionにnetwork-adminを指定
で合っておりますでしょうか。
それ以外に必要な設定がありましたら併せてご教授いただけないでしょうか。
Uehara Y.
Community Manager
•
5.3K メッセージ
0
2025年2月19日 07:48
はい、合っているはずです。
[参考]MDS LDAP の設定
LDAPサーバに対する認証ではじかれているようなので、気になるのはrootDNとして指定しているouの階層がPeopleであるのに対し、base-DNのou階層がGroupと異なっている点くらいでしょうか。
(これ異なっていても問題ないのでしたっけ?)
あとはサーバ認証ではなくユーザ認証に関することですが、MDS側のsearch-filterでは"cn=$userid"と検索対象のユーザidを"cn"として認識させているのに対し、LDAPサーバ側ではユーザidを"uid"として認識しているようなので、この点も揃えないと問題になるかもしれません。
それ以外だと
https://dell.to/417ZIvL
https://dell.to/4gPvl2G
などにあるようなSSL/TLS関係の問題かもしれないと思ったのですが、「ldap: ldap_client_auth_init: (user testuser01) - ldap_init success for host https://dell.to/41jJ90W port 636」というポート636を利用した通信が成功したログが残ってるのでこれは違いそう。
最悪の場合はLDAP authentication is failing only when the ip name-server configured on the switchにあるような問題かもしれません(そうなるとサポート部門の対応が必要になってしまいます)。
Hiro.goto
1 Rookie
•
12 メッセージ
0
2025年2月20日 01:56
-------------------------
LDAPサーバに対する認証ではじかれているようなので、気になるのはrootDNとして指定しているouの階層がPeopleであるのに対し、base-DNのou階層がGroupと異なっている点くらいでしょうか。
(これ異なっていても問題ないのでしたっけ?)
-------------------------
⇒念のため、ldapsearchコマンドにてbindユーザがbaseDNのユーザを検索できるか確認いたしました。
$ ldapsearch -x -D "uid=mds_bind_only,ou=People,dc=test,dc=local" -W -b "ou=Group,dc=test,dc=local" "(cn=mds-admin)"
#
# LDAPv3
# base <ou=Group,dc=test,dc=local> with scope subtree
# filter: (cn=mds-admin)
# requesting: ALL
#
# mds-admin, Group, test.local
dn: cn=mds-admin,ou=Group,dc=test,dc=local
objectClass: posixGroup
cn: mds-admin
gidNumber: 1000
memberUid: testuser01
description: network-admin
# search result
search: 2
result: 0 Success
特に問題はないように見受けられます。
-------------------------
あとはサーバ認証ではなくユーザ認証に関することですが、MDS側のsearch-filterでは"cn=$userid"と検索対象のユーザidを"cn"として認識させているのに対し、LDAPサーバ側ではユーザidを"uid"として認識しているようなので、この点も揃えないと問題になるかもしれません。
-------------------------
⇒search-filterで指定している"cn=$userid"ですが、"cn=$uid"でもMDS側の書式として問題ございませんでしょうか。
-------------------------
最悪の場合はLDAP authentication is failing only when the ip name-server configured on the switchにあるような問題かもしれません(そうなるとサポート部門の対応が必要になってしまいます)。
-------------------------
⇒こちらのリンクにある、「This issue occurs only when ip name server is configured on the switch.」はMDSにDNSサーバを設定しているかということでしょうか。それであれば、DNSサーバの設定はしていないため、該当しないと思われます。
Uehara Y.
Community Manager
•
5.3K メッセージ
0
2025年2月20日 08:39
実機確認ありがとうございます。
バインドするDNと検索ベースのDNのouは違くても問題はないということですね。
(まだまだここら辺は勉強が必要ですが、参照先URLとして記載して頂いたCisco社のページにある「検索してからバインドする方式の利点は、baseDN の前にユーザ名(cn 属性)を追加することで認定者名(DN)を形成するのではなく、検索結果で受け取った DN をバインディング時にユーザ DN として使用できることです。この方式は、ユーザ DN がユーザ名と baseDN の組み合わせとは異なる場合に特に役立ちます。」という部分がそれを説明してるように見えてきました)
$useridはMDSが利用している変数名(の値)だと考えられるので、"cn=$userid"か"uid=$userid"のどちらかに揃える必要があるのではないかと考えていました。
はい、私もその認識なので当該問題はあてはまらないと考えて頂いて問題ありません。
再度記載して頂いた情報を確認してみたのですが
ldap: ldap_do_initial_bind: (user testuser01) - ldap_bind for root failed - error[-1] Can't contact LDAP server
を見るとそもそも"testuser01"を探す前のサーバ認証で失敗しており、かつその失敗はrootDNに対するものに見えます。
([参考]MDS:LDAP rootDN getting extra '\' in debug if it has value "dc=il" and LDAP is failing-bug情報のKBですが、該当箇所に問題がないとrootDNへのバインドが成功していることが読み取れます)
また、ご確認頂いたldapsearchコマンドにおいてバインド用のDNは"uid=mds_bind_only,ou=People,dc=test,dc=local"であり、上記ldapログの3行上に記録されてる
ldap: ldap_do_initial_bind: rootDN : cn=mds_bind_only,ou=People,dc=test,dc=local
の情報とは異なっている点が問題な可能性がありそうです(uid=mds_bind_onlyとcn=mds_bind_onlyの違い)。
この問題有無の切り分けには、以下のコマンドが通るかの確認が有効だと思います(通れば問題なし、通らなかったら問題あり)
$ ldapsearch -x -D "cn=mds_bind_only,ou=People,dc=test,dc=local" -W -b "ou=Group,dc=test,dc=local" "(cn=mds-admin)"
Hiro.goto
1 Rookie
•
12 メッセージ
0
2025年2月21日 05:18
$ ldapsearch -x -D "cn=mds_bind_only,ou=People,dc=test,dc=local" -W -b "ou=Group,dc=test,dc=local" "(cn=mds-admin)"
上記コマンドはエラーとなりました。
ただ、改めて情報を確認した内容をまとめてました。
■rootDN
dn: uid=mds_bind_only,ou=People,dc=test,dc=local
$ ldapsearch -x -D "uid=mds_bind_only,ou=People,dc=test,dc=local" -W -b "ou=Group,dc=test,dc=local" "(cn=mds-admin)"
上記コマンドは問題ない
■MDSの設定
ldap-server host xxx.xxx.xxx.xxx rootDN "cn=mds_bind_only,ou=People,dc=test,dc=local" password 7 xxxxxxxxxxxxxxxx port 636
参考にしたサイトに合わせてrootDNをcn/ou/dcにしてしまっていたが、
指定する情報が誤っていた?
正しくは
ldap-server host xxx.xxx.xxx.xxx rootDN "uid=mds_bind_only,ou=People,dc=test,dc=local" password 7 xxxxxxxxxxxxxxxx port 636
にしないといけない?
その上でsearch-filterが"cn=$userid"の指定のため、"uid=$userid"にして、認証するユーザがbaseDNにいるユーザを検索する
ようにすることでtest aaaおよびMDSへのログインが可能と考えますが、いかがでしょうか。
Uehara Y.
Community Manager
•
5.3K メッセージ
0
2025年2月25日 04:31
はい。以前に記載した「"cn=$userid"か"uid=$userid"のどちらかに揃える」においてuid側にそろえるというパターンなので、うまくいくのではないでしょうか。
あとはあまりuidでの指定は見たことがないので、うまくいかなかったらcn側にそろえて試してみることもおすすめします(ってこれはLDAPサーバ側の情報の持ち方にもよるとは思いますが・・・)。
Hiro.goto
1 Rookie
•
12 メッセージ
0
2025年3月3日 06:17
度々申し訳ありません。
rootDNの指定を変更し、test aaaを実行したところ、失敗しました。
■前回
ldap-server host xxx.xxx.xxx.xxx rootDN "cn=mds_bind_only,ou=People,dc=test,dc=local" password 7 xxxxxxxxxxxxxxxx port 636
■新
ldap-server host xxx.xxx.xxx.xxx rootDN "uid=mds_bind_only,ou=People,dc=test,dc=local" password 7 xxxxxxxxxxxxxxxx port 636
デバッグを有効にし、ログを確認したところ以前共有いただいたバグのように見受けられます。
uid部分に\が含まれてしまっています。
https://quickview.cloudapps.cisco.com/quickview/bug/CSCvc62286?linkId=752622036
■デバッグログ
ldap: ldap_escape_special_characters Before escaping : uid=mds_bind_only,ou=People,dc=test,dc=local
ldap: ldap_escape_special_characters: After escaping : uid\=mds_bind_only,ou=People,dc=test,dc=local
ldap: ldap_get_vrf_applicable:(user testuser01) greturning default vrf :vrf default
ldap: ldap_do_initial_bind: rootDN : uid\=mds_bind_only,ou=People,dc=test,dc=local
ldap: ldap_do_initial_bind: baseDN : cn=mds-admin,ou=Group,dc=test,dc=local
ldap: ldap_do_initial_bind: userDN :
ldap: ldap_do_initial_bind: (user testuser01) - ldap_bind for root failed - error[-1] Can't contact LDAP server
ldap: ldap_client_auth_init: (user testuser01) -Initial auth failed isssl: 1
■質問事項
・このバグはVer7.3のもので、今回の機器のバージョンは9.4(1)になりますが、バグ対象になりますでしょうか
・こちらの回避策はありますでしょうか。
・rootDNの指定方法で、uidは使用できないのでしょうか。rootDNをcnで指定した時は「\」は出ていませんでした。