最終更新日: 2019-10-27 日 14:34
ホーム | 文書トップ | 目次

DD-WRT OpenLDAP Samba

Table of Contents

概要

関連

クライアント側

smb.conf

設定する。

[global]

#       passdb backend = tdbsam

### LDAP ###
        passdb backend = ldapsam:ldap://192.168.1.100
        ldap ssl = no
        ldap suffix = dc=example,dc=com
        ldap admin dn = cn=Manager,dc=example,dc=com
        ldap user suffix = ou=People
        ldap group suffix = ou=Group
        ldap passwd sync = yes
        ldap debug level = 3
        ntlm auth = yes

smbpasswd

この状態だと LDAPサーバにアクセスできないので

$ sudo pdbedit --list
ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying /etc/openldap/ldap.conf
ldap_init: using /etc/openldap/ldap.conf
ldap_url_parse_ext(ldap://192.168.1.100/)
ldap_init: HOME env is /root
ldap_init: trying /root/ldaprc
ldap_init: trying /root/.ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
fetch_ldap_pw: neither ldap secret retrieved!
pdb_init_ldapsam_common: Failed to retrieve LDAP password from secrets.tdb
pdb backend ldapsam:ldap://192.168.1.100 did not correctly init (error was NT_STATUS_NO_MEMORY)
Can't initialize passdb backend.

パスワードを設定する。

$ sudo smbpasswd -W
$ sudo smbpasswd -W
ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying /etc/openldap/ldap.conf
ldap_init: using /etc/openldap/ldap.conf
ldap_url_parse_ext(ldap://192.168.1.100/)
ldap_init: HOME env is /root
ldap_init: trying /root/ldaprc
ldap_init: trying /root/.ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
Setting stored password for "cn=Manager,dc=example,dc=com" in secrets.tdb
New SMB password:
Retype new SMB password:

LDAPのアカウントにsambaの属性を追加したら、"does not belong to our domain"というメッセージが表示される

$ sudo pdbedit --list
ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying /etc/openldap/ldap.conf
ldap_init: using /etc/openldap/ldap.conf
ldap_url_parse_ext(ldap://192.168.1.100/)
ldap_init: HOME env is /root
ldap_init: trying /root/ldaprc
ldap_init: trying /root/.ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
sid S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXX does not belong to our domain

サービスをrestartする

$ sudo systemctl restart smb.service
$ sudo systemctl restart nmb.service

メッセージは消えたが、ユーザは表示されない

$ sudo pdbedit --list
ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying /etc/openldap/ldap.conf
ldap_init: using /etc/openldap/ldap.conf
ldap_url_parse_ext(ldap://192.168.1.100/)
ldap_init: HOME env is /root
ldap_init: trying /root/ldaprc
ldap_init: trying /root/.ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
ホーム | 文書トップ | 目次
Created by Emacs 27.1 (Org mode 9.3)