第3章 ユーザーの管理
3.1. 概要
ユーザーとは、OpenShift Container Platform API と対話するエンティティーです。ユーザーは、アプリケーションを開発する開発者の場合もあれば、クラスターを管理する管理者の場合もあります。ユーザーは、グループのすべてのメンバーに適用されるパーミッションを設定するグループに割り当てることができます。たとえば、API アクセスをグループに付与して、そのグループのすべてのメンバーに API アクセスを付与することができます。
This topic describes the management of user accounts, including how new user accounts are created in OpenShift Container Platform and how they can be deleted.
3.2. ユーザーの作成
The process for creating a user depends on the configured identity provider. By default, OpenShift Container Platform uses the DenyAll
identity provider, which denies access for all user names and passwords.
以下のプロセスでは、新規ユーザーを作成してからロールをそのユーザーに追加します。
-
Create the user account depending on your identity provider. This can depend on the
mappingmethod
used as part of the identity provider configuration. See the Mapping Identities to Users section for more information. 新規ユーザーに必要なロールを付与します。
# oc create clusterrolebinding <clusterrolebinding_name> / --clusterrole=<role> --user=<user>
ここで、
--clusterrole
オプションは必要なクラスターロールになります。たとえば、新規ユーザーに対して、クラスター内のすべてに対するアクセスを付与するcluster-admin
権限を付与するには、以下を実行します。# oc create clusterrolebinding registry-controller / --clusterrole=cluster-admin --user=admin
For an explanation and list of roles, see the Cluster Roles and Local Roles section of the Architecture Guide.
クラスター管理者は、各ユーザーのアクセスレベルの管理も実行できます。
Depending on the identity provider, and on the defined group structure, some roles may be given to users automatically. See the Synching groups with LDAP section for more information.
3.3. ユーザーおよび ID リストの表示
OpenShift Container Platform のユーザー設定は、OpenShift Container Platform 内の複数の場所に保存されます。アイデンティティープロバイダーの種類を問わず、OpenShift Container Platform はロールベースのアクセス制御 (RBAC) 情報およびグループメンバーシップなどの詳細情報を内部に保存します。ユーザー情報を完全に削除するには、ユーザーアカウントに加えてこのデータも削除する必要があります。
OpenShift Container Platform では、2 つのオブジェクトタイプ (user
および identity
) に、アイデンティティープロバイダー外のユーザーデータが含まれます。
ユーザーの現在のリストを取得するには、以下を実行します。
$ oc get user NAME UID FULL NAME IDENTITIES demo 75e4b80c-dbf1-11e5-8dc6-0e81e52cc949 htpasswd_auth:demo
ID の現在のリストを取得するには、以下を実行します。
$ oc get identity NAME IDP NAME IDP USER NAME USER NAME USER UID htpasswd_auth:demo htpasswd_auth demo demo 75e4b80c-dbf1-11e5-8dc6-0e81e52cc949
2 つのオブジェクトタイプ間で一致する UID があることに注意してください。OpenShift Container Platform の使用を開始した後に認証プロバイダーの変更を試行する場合で重複するユーザー名がある場合、そのユーザー名は、ID リストに古い認証方式を参照するエントリーがあるために機能しなくなります。
3.4. グループの作成
ユーザーは OpenShift Container Platform に要求するエンティティーである一方で、ユーザーのセットで構成される 1 つの以上のグループに編成することもできます。グループは、許可ポリシーなどの場合のように数多くのユーザーを 1 度に管理する際や、パーミッションを複数のユーザーに 1 度に付与する場合などに役立ちます。
If your organization is using LDAP, you can synchronize any LDAP records to OpenShift Container Platform so that you can configure groups on one place. This presumes that information about your users is in an MDAP server. See the Synching groups with LDAP section for more information. If you are not using LDAP, you can use the following procedure to manually create groups.
新規グループを作成するには、以下を実行します。
# oc adm groups new <group_name> <user1> <user2>
たとえば、west
グループを作成し、そのグループ内に john
および betty
ユーザーを置くには、以下を実行します。
# oc adm groups new west john betty
グループが作成されたことを確認し、グループに関連付けられたユーザーを一覧表示するには、以下を実行します。
# oc get groups NAME USERS west john, betty
Next steps: * Managing role bindings
3.5. ユーザーおよびグループラベルの管理
ラベルをユーザーまたはグループに追加するには、以下を実行します。
$ oc label user/<user_name> <label_name>
たとえばユーザー名が theuser で、ラベルが level=gold の場合には、以下のようになります。
$ oc label user/theuser level=gold
ラベルを削除するには、以下を実行します。
$ oc label user/<user_name> <label_name>-
ユーザーまたはグループのラベルを表示するには、以下を実行します。
$ oc describe user/<user_name>
3.6. ユーザーの削除
ユーザーを削除するには、以下を実行します。
ユーザーレコードを削除します。
$ oc delete user demo user "demo" deleted
ユーザー ID を削除します。
ユーザーの ID は使用するアイデンティティープロバイダーに関連付けられます。
oc get user
でユーザーレコードからプロバイダー名を取得します。この例では、アイデンティティープロバイダー名は htpasswd_auth です。コマンドは、以下のようになります。
# oc delete identity htpasswd_auth:demo identity "htpasswd_auth:demo" deleted
この手順を省略すると、ユーザーは再度ログインできなくなります。
上記の手順の完了後は、ユーザーが再びログインすると、新規のアカウントが OpenShift Container Platform に作成されます。
ユーザーの再ログインを防ごうとする場合 (たとえば、ある社員が会社を退職し、そのアカウントを永久に削除する必要がある場合)、そのユーザーを、設定されたアイデンティティープロバイダーの認証バックエンド (htpasswd、kerberos その他) から削除することもできます。
たとえば htpasswd を使用している場合、該当のユーザー名とパスワードで OpenShift Container Platform に設定された htpasswd ファイルのエントリーを削除します。
Lightweight Directory Access Protocol (LDAP) または Red Hat Identity Management (IdM) などの外部 ID管理については、ユーザー管理ツールを使用してユーザーエントリーを削除します。