ユーザ用ツール

OpenLDAPの設定

先日、キーボード交換にノートPC(VAIO U101)を出したら、ディスクが壊れていますといわれ、交換と相成りました。このVAIOはメールもウェブも、プログラムから文書書きまで、広く利用していたのですが、ほとんどのデータは、ノート側にはおかずに、家のサーバにおいていました。したがって、ほとんど痛手はなかったのですが、ごくわずかに、ノートPCがわにしかないものがありました。そのひとつが、メイラのアドレス帳です。ああ、アドレス帳がサーバ上にあれば問題はないのに。これが「家庭内LDAP」の構築のきっかけです。

最近では多くのメイラがLDAPに対応している様でもあるので、メイラの乗り換えの敷居も低くしてくれるのではないかと思います。

OpenLDAPの導入

VineLinuxの場合にはOpenLDAPのパッケージが存在していますので、それを取ってきます。apt-getを使うのが簡単でよいでしょう。VineLinux-3.x向けには、以下のようなパッケージが存在しています。

  • openldap
  • openldap-clients
  • openldap-devel
  • openldap-servers

とりあえず、全部インストールしておけば安心でしょう。 インストールした段階では、LDAPサービスは起動しないようになっているので、これを自動起動するようにします。

# /sbin/chkconfig ldap on

slapd.conf

OpenLDAPの設定ファイル群は、/etc/openldap にインストールされています。このうち、サーバに関する設定は slapd.conf にまとめて書かれています。

変更すべき点:

suffix        "dc=wildtree,dc=jp"
rootdn        "cn=Manager,dc=wildtree,dc=jp"
rootpw        {crypt}ijFYNcSNctBYg

(右側の値は、自分のドメイン、またルートのパスワード1)を設定してください。)

とりあえず、この三点を変更して置きます。変更が出来たら、slapdを起動してみます。

# /etc/init.d/ldap start
slapdを起動中: [  Ok  ]
#

ココまで来たら、クライアントを接続してみます。ldapsearch -x -b '' -s base + と入力して次のようなレポートが得られれば問題なくLDAPが動作しています。

$ ldapsearch -x -b '' -s base +
# extended LDIF
#
# LDAPv3
# base <> with scope base
# filter: (objectclass=*)
# requesting: + 
#

#
dn:
structuralObjectClass: OpenLDAProotDSE
namingContexts: dc=wildtree,dc=jp
supportedControl: 1.2.826.0.1.334810.2.3
supportedControl: 1.3.6.1.4.1.4203.1.10.1
supportedControl: 1.3.6.1.4.1.4203.1.10.2
supportedControl: 2.16.840.1.113730.3.4.2
supportedControl: 2.16.840.1.113730.3.4.18
supportedExtension: 1.3.6.1.4.1.1466.20037
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedControl: 1.3.6.1.4.1.4203.1.10.2
supportedControl: 2.16.840.1.113730.3.4.2
supportedControl: 2.16.840.1.113730.3.4.18
supportedExtension: 1.3.6.1.4.1.1466.20037
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.1
supportedFeatures: 1.3.6.1.4.1.4203.1.5.2
supportedFeatures: 1.3.6.1.4.1.4203.1.5.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.4
supportedFeatures: 1.3.6.1.4.1.4203.1.5.5
supportedLDAPVersion: 2
supportedLDAPVersion: 3
supportedSASLMechanisms: DIGEST-MD5
supportedSASLMechanisms: CRAM-MD5
subschemaSubentry: cn=Subschema

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1
$

繋がらない

ここで、上記のようなレポートが出ないで、エラーになることがあります。

$ ldapsearch -x -b '' -s base +
ldap_bind: Can't contact LDAP server (81)
$

このエラーが出た場合にはLDAPに対するアクセス制限が働いてる可能性が高いです。 /etc/hosts.allow に次のような行を挿入しましょう。

slapd: 192.168.0. localhost

これで、エラーが消えるのではないかと思います。

また、次のようなメッセージが出るかもしれません。

$ ldapsearch -b '' -s base +
SASL/DIGEST-MD5 authentication started
Please enter your password:
ldap_sasl_interactive_bind_s: Internal (implementation specific) error (80)
        additional info: SASL(-17): One time use of a plaintext password will enable requested mechanism for user: no secet in database
$

これは'-x'をつけないで実行したために、SASL認証をしようとして、失敗しています。SASL認証については後で触れようと思います。

アドレス帳の作成

VineLinuxに関してへ戻る。

1)
perl -e “print crypt(“パスワード”, “xx”), “\n”;'として表示される値を置けばいいでしょう。ここで xx は任意の2文字のsalt値です。

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information