Red Hat Training

A Red Hat training course is available for RHEL 8

35.5. ID ビューを使用して、特定のホストにある IdM ユーザーのログイン名をオーバーライドする

特定の IdM ユーザーに関連付けられた POSIX 属性値をオーバーライドする特定の IdM クライアントの ID ビューを作成するには、次の手順に従います。この手順では、idm_user という名前の IdM ユーザーが、user_1234 ログイン名を使用して host1 という名前の IdM クライアントにログインできるようにする ID ビューの例を使用します。

前提条件

  • IdM 管理者としてログインしている。

手順

  1. 新しい ID ビューを作成します。たとえば、example_for_host1 という名前の ID ビューを作成するには、次のコマンドを実行します。

    $ ipa idview-add example_for_host1
    ---------------------------
    Added ID View "example_for_host1"
    ---------------------------
      ID View Name: example_for_host1
  2. ユーザーの上書きを example_for_host1 ID ビューに追加します。ユーザーログインをオーバーライドするには、以下を実行します。

    • ipa idoverrideuser-add コマンドを入力します。
    • ID ビューの名前を追加します。
    • ユーザー名 (アンカーとも呼ばれます) を追加します。
    • --login オプションを追加します。

      $ ipa idoverrideuser-add example_for_host1 idm_user --login=user_1234
      -----------------------------
      Added User ID override "idm_user"
      -----------------------------
        Anchor to override: idm_user
        User login: user_1234

      利用可能なオプションのリストは、ipa idoverrideuser-add --help を実行します。

      注記

      ipa idoverrideuser-add --certificate コマンドは、指定された ID ビューのアカウントの既存証明書をすべて置き換えます。別の証明書を追加するには、代わりに ipa idoverrideuser-add-cert コマンドを使用します。

      $ ipa idoverrideuser-add-cert example_for_host1 user --certificate="MIIEATCC..."
  3. 必要に応じて、ipa idoverrideuser-mod コマンドを使用すると、既存のユーザーの上書きに新しい属性値を指定できます。
  4. example_for_host1host1.idm.example.com ホストに適用します。

    $ ipa idview-apply example_for_host1 --hosts=host1.idm.example.com
    -----------------------------
    Applied ID View "example_for_host1"
    -----------------------------
    hosts: host1.idm.example.com
    ---------------------------------------------
    Number of hosts the ID View was applied to: 1
    ---------------------------------------------
    注記

    ipa idview-apply コマンドでは、--hostgroups オプションも使用できます。このオプションは、ID ビューを、指定のホストグループに所属するホストに適用しますが、ホストグループ自体との関連付けは行いません。代わりに、--hostgroups オプションは指定されたホストグループのメンバーを拡張して、--hosts オプションを個別にすべて適用します。

    つまり、今後ホストがホストグループに追加されても、ID ビューは新しいホストには適用されません。

  5. 新しい設定を host1.idm.example.com システムに適用するには、次のコマンドを実行します。

    1. root でシステムに対して SSH 接続します。

      $ ssh root@host1
      Password:
    2. SSSD キャッシュを削除します。

      root@host1 ~]# sss_cache -E
    3. SSSD デーモンを再起動します。
    root@host1 ~]# systemctl restart sssd

検証手順

  • user_1234 の認証情報がある場合は、その認証情報を使用して host1 で IdM にログインできます。

    1. ログイン名 user_1234 を使用して host1 に SSH 接続します。

      [root@r8server ~]# ssh user_1234@host1.idm.example.com
      Password:
      
      Last login: Sun Jun 21 22:34:25 2020 from 192.168.122.229
      [user_1234@host1 ~]$
    2. 作業ディレクトリーを表示します。

      [user_1234@host1 ~]$ pwd
      /home/idm_user/
  • または、host1 に root 認証情報がある場合は、その認証情報を使用して idm_user および user_1234id コマンドの出力を確認できます。

    [root@host1 ~]# id idm_user
    uid=779800003(user_1234) gid=779800003(idm_user) groups=779800003(idm_user)
    [root@host1 ~]# user_1234
    uid=779800003(user_1234) gid=779800003(idm_user) groups=779800003(idm_user)