LDAPとSMBの連携でパスワードの一元管理

| No Comments | No TrackBacks

OSはredhat9
ちょっとした事情でやることになった。

構成は、LDAP+SMB

参考サイト=@ITLDAPによるパスワードの一元管理
というか、これは自分のメモ用でしてこれをやりたい人は@ITいってくださいw
ほとんどコピペで、俺が見やすいようにしただけです。

http://www.openldap.org/よりopenldap-hoge.tar.gzを落とす。

# tar zxfv openldap-hoge.tar.gz # cd openldap-hoge # ./configure --enable-ldbm --prefix=/usr/local/ldap # make depend;make # make test # make install

ftp://ftp.samba.gr.jp/pun/samba-jp/samba-ldap/samba.schema (samba用schema)を落とす。

# cp samba.schema /usr/local/ldap/etc/openldap/schema

ldapのconfのcopy

cp /usr/local/ldap/etc/openldap/slapd.conf.default /usr/local/ldap/etc/openldap/slapd.conf

# cd /usr/local/ldap/etc/openldap/

# vi slapd.conf

#nis.schemaとsambaschemaをinclude
include /usr/local/ldap/etc/openldap/schema/core.schema
include /usr/local/ldap/etc/openldap/schema/nis.schema
include /usr/local/ldap/etc/openldap/schema/samba.schema

pidfile /usr/local/ldap/var/slapd.pid
argsfile /usr/local/ldap/var/slapd.args

#pass関連の設定
# userPassword属性に対する設定
# ・LDAP管理ユーザー(cn=root,dc=itboost,dc=co,dc=jp)は書込可能(write)
# ・自分自身(self)は書込可能(write)
# ・匿名接続(anonymous)した場合は 認証時のみuserPasswordを利用できる
# ・そのほかのユーザー(*)は何もできない(none)

access to attribute=userPassword
by self write
by dn="cn=root,dc=itboost,dc=co,dc=jp" write
by anonymous auth
by * none

# userPassword属性以外(*)に対する設定-------
# ・LDAP管理ユーザー(cn=root,dc=itboost,dc=co,dc=jp)は書込可能(write)
# ・自分自身(self)は書込可能(write)
# ・そのほかのユーザー(*)は読取は可能(read)

access to *
by dn="cn=root,dc=itboost,dc=co,dc=jp" write
by self write
by * read


# 検索の高速化
#
# UNIXアカウント(uid)の存在(pres)と一致(eq)、
# Sambaアカウント(rid)の一致(eq)に対する検索能力を高めるためindexを作成

index uid pres,eq
index rid eq

# 必須項目
#
# suffix : LDAPディレクトリの検索範囲
# rootdn : 特権ユーザー
# rootpw : 特権ユーザーのパスワード
# slappasswd コマンドを実行し、出力された文字列をコピーすればよい
# -s :パスワード文字列
# -h :暗号化方式指定 {CRYPT} {SHA} {MD5} などを取ることができる
#
# 『実行例 ・・・パスワード暗号化方法にMD5を使用した例』
# slappasswd -s itboost -h {MD5}

database ldbm
suffix "dc=itboost,dc=co,dc=jp"
rootdn "cn=root,dc=itboost,dc=co,dc=jp"
rootpw {MD5}04GnLjggosVsXYs44jrvFg==

# データベースを置くディレクトリ指定
directory /usr/local/ldap/var/openldap-ldbm

 LDAPサーバは専用ユーザーで扱うことにします。まず、専用ユーザー「ldap」を作成し、ldapのデータベースが格納されるディレクトリのパーミッションを設定しておきます。

# useradd -d /usr/local/ldap/var/openldap-ldbm -s /bin/false ldap
# chown ldap.ldap /usr/local/ldap/var/openldap-ldbm
# chmod 700 /usr/local/ldap/var/openldap-ldbm

で、起動

# /usr/local/ldap/libexec/slapd -u ldap

 各サーバの認証をLDAPで行う場合、LDAPサーバデーモンであるslapdが起動していないと、すべての認証が失敗することになります。システム再起動時にslapdが起動するように 上記の1行を/etc/rc.d/rc.localに記述しておきましょう。

この記事はまだ書いている途中です。

No TrackBacks

TrackBack URL: http://caruma.org/mt-tb.cgi/1023

Leave a comment

About this Entry

This page contains a single entry by Caruma published on October 8, 2004 3:51 PM.

T40にSargeをinstall was the previous entry in this blog.

caruma.org is available is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.