2. クイックスタート¶
ここでは Unicorn ID Manager を設定して起動するところまでの一連の流れを説明いたします。 前提として、 Unicorn ID Manager は /opt/osstech をプレフィックスとする環境にインストール されていることを前提として説明いたします。また、ここでは LDAP サーバーを データストア (バックエンド) とする設定を行いますので、予め LDAP サーバーを準備してください。
2.1. 設定ファイルの準備¶
Unicorn ID Manager の設定ファイル /opt/osstech/etc/unicornidm/unicornidm.conf を以下の内容 で編集します。なお、必要であれば、このファイルのバックアップをとってください。
[__main__]
targets = Target1
[target:Target1]
backends = ldap1
[backend:ldap1]
type = ldap
uris = ldap://ldap1/
bind_user = cn=Manager,dc=example,dc=com
bind_password_file = /opt/osstech/etc/unicornidm/secrets/ldap1.password
suffix = dc=example,dc=com
suffix_user = ou=Users,%(suffix)s
suffix_group = ou=Groups,%(suffix)s
[client]
server_url = https://localhost/
admin_name = test-admin
uid = unicornidm
gid = unicornidm
timezone = Asia/Tokyo
また、 LDAP サーバーへの接続に必要な /opt/osstech/etc/unicornidm/secrets/ldap1.password
を準備する必要があります。このファイルの中身は BIND DN のパスワードです。
たとえば、以下のコマンドで作成できます。
# install -m 0600 -o unicornidm <(echo PASSWORD) /opt/osstech/etc/unicornidm/secrets/ldap1.password
注釈
ここでは、 LDAP サーバーへの接続情報が以下のとおりであることを前提とします。
- 接続先:
- ldap://ldap1/
- BIND DN:
- cn=Manager,dc=example,dc=com
- BIND password file:
- /opt/osstech/etc/unicornidm/secrets/ldap1.password
- Suffix:
- dc=example,dc=com
- User Suffix:
- ou=Users,dc=example,dc=com
- Group Suffix:
- ou=Groups,dc=example,dc=com
警告
ここでは Unicorn ID Manager を unicornidm というユーザーで動作させることを 前提としています。
2.2. テンプレートファイルの準備¶
バックエンドである LDAP サーバーのテンプレートファイルを /opt/osstech/etc/unicornidm/templates/ldap1.py として、以下の内容で作成します。
User = {
"objectClass": [
"top",
"person",
"organizationalPerson",
"inetOrgPerson",
"posixAccount",
],
"uid": userName,
"cn": userName,
"uidNumber": default(uidNumber),
"gidNumber": default(gidNumber, 100),
"loginShell": default(loginShell, "/bin/bash"),
"homeDirectory": default(unixHomeDirectory, "/home/%(userName)s"),
"sn": familyName,
"givenName": givenName,
"userPassword": password,
"mail": mail,
"description": default(description),
"displayName": default(displayName, "%(familyName)s %(givenName)s"),
}
Group = {
"objectClass": [
"top",
"posixGroup",
],
"cn": groupName,
"gidNumber": default(gidNumber),
"description": default(description),
}
2.3. Unicorn ID Manager の起動¶
以下のコマンドで Unicorn ID Manager を起動します。
# systemctl start osstech-unicornidm
2.4. 管理者の作成¶
Unicorn ID Manager に管理者としてログインするため、管理者を作成します。 パスワードの入力を求められるので、登録する管理者のパスワードを入力してください。 ここでは、管理者の名前を test-admin としています。
# /opt/osstech/sbin/unicornidm-tool admin add test-admin -r SuperAdministrator
Password:
Repeat for confirmation:
# chown unicornidm /opt/osstech/var/lib/unicornidm/db.password
2.5. Web ブラウザーからアクセス¶
Unicorn ID Manager に Web ブラウザーからアクセスします。アクセスする URL は以下です。 なお、ここでは Unicorn ID Manager のインストールされたサーバーのホスト名が unicornidm.example.com であることを前提としています。
https://unicornidm.example.com/unicornidm/admin/
警告
URL のホスト名は Unicorn ID Manager をインストールしたサーバーのホスト名 を指定してください (IP アドレスではアクセスできません) 。
アクセスすると、ログイン画面が表示されます。ここに 管理者の作成 で作成した 管理者の名前とパスワードを入力します。