SSSDを使用したPAMの構成

SSSDサービスを使用して、LinuxでPAMを構成します。

  • SSSDサービスがインストールされている必要があります。インストールされていない場合は、sudo yum install sssdを使用してインストールします。
  • サービスは、システムが再起動したときに開始するように構成されている必要があります。この構成は、sudo chkconfig sssd onを使用して実行できます。
  • プロパティSELINUXがファイル/etc/selinux/configで強制されるように設定されている場合は、ステップ「SELinuxの強制」を実行します。

    SELINUX=permissiveまたはSELINUX=disabledを設定することもできます。この場合、SELinuxを強制する必要はありません。

    ノート

    /etc/selinux/configを更新する場合は、Linuxを再起動します。
  1. /etc/sssd/sssd.confファイルが存在し、権限600があり、rootユーザーが所有していることを確認します。ファイルが存在しない場合は、次のように作成し、chmod 600 /etc/sssd/sssd.confを実行します。

    /etc/sssd/sssd.conf

    [sssd]
    config_file_version = 2
    services = nss, pam
    ### domains specify the look up order, 
    ### which should always be LOCAL and then IDCS.
    domains = LOCAL,IDCS
     
    [nss]
    #Backfill cache at 75%, do not cache bad lookups,
    # no in-mem cache
    entry_cache_nowait_percentage = 75
    ### 1 Hour caching for non existent user
    entry_negative_timeout = 3600
     
    [pam]
    pam_id_timeout = 600
     
    [domain/LOCAL]
    # Prior to 1.15, must use older files provider
    id_provider = proxy
    proxy_lib_name = files
    # Disable authentication, files provider 
    # always provides local access, enumerate files
    auth_provider = none
    access_provider = permit
    enumerate = true
     
    [domain/IDCS]
    re_expression = (?P<domain>[^\\]*?)\\?(?P<name>[^\\]+$)
    auth_provider =  proxy
    id_provider = proxy
    proxy_lib_name = oracle_cloud
    proxy_pam_target = sssd_proxy_oracle_cloud
    enumerate =  false
    cache_credentials = true
    # Default cache timeout 90 mins for user/group info entries, 
    #before it reaches to IDCS for new updates
    entry_cache_timeout = 5400
    オプションで、電子メール・アドレスをSSOユーザー名として構成できます。これを行うには、/etc/sssd/sssd.confファイルに太字の行を追加して、正規表現を指定します。
    ...
    [pam]
    [domain/proxy_proxy]
    re_expression = (?P<domain>[^\\]*?)\\?(?P<name>[^\\]+$)
    auth_provider =  proxy
    id_provider = proxy
    ...
  2. /etc/pam.d/sssd_proxy_oracle_cloudファイルが存在し、rootユーザーが所有していることを確認します。ファイルが存在しない場合は、rootユーザーとしてファイルを作成し、次を追加します:

    /etc/pam.d/sssd_proxy_oracle_cloud file

    auth          required      pam_oracle_cloud.so
    account       required      pam_oracle_cloud.so
    password      required      pam_oracle_cloud.so
    session       required      pam_oracle_cloud.so
  3. /etc/pam.d/sshdを編集し、pam_oracle_cloudモジュールを追加します:

    /etc/pam.d/sshd

    auth sufficient pam_oracle_cloud.so
    ノート

    auth include password-authまたはauth substack password-auth*の前にこれを追加します。
  4. /etc/ssh/sshd_configを編集して、マルチファクタ認証(MFA)を使用できるようにsshdを構成します。

    /etc/ssh/sshd_config

    ChallengeResponseAuthenticationプロパティを検索し、yesに設定します。構成ファイルにプロパティがない場合は、追加します。

  5. /etc/opc.confを編集して、プラグインがIAMと対話できるようにします:

    /etc/opc.conf

    #This is sample format of opc.conf file, please use the correct information to configure this file.
    #Enter the Oracle Identity Cloud Service tenancy base url.
    base_url = https://identity-cloud-service-instance-url
    #There is no need to change value of scope.
    scope = urn:opc:idm:__myscopes__
    #Enter the location of the wallet.
    wallet_location = /etc/opc-wallet
    #Enter the log level, this is optional and the default is 0, which means no log. 0 - None, 1 - Error, 2 - Info, 3 - Debug.
    log_level = 0
    #Enter the log file path, this is optional and defaults to /var/log/opc/pam_nss.log
    log_file_path = /var/log/opc/pam_nss.log
    #Enter the value for proxy usage to connect to Oracle Identity Cloud Service.
    #Set the value to 1 to use a proxy and 0 to not use a proxy.
    use_proxy=0
    #Enter the information below if you set: use_proxy=1
    #Enter the proxy url
    #proxy_url=http://proxy.example.com
    #Enter the proxy port
    #proxy_port=80#Enter the username to connect to the proxy url.
    #proxy_username=username_example
    #Enter the password of username to connect proxy url.
    #proxy_pwd=pwd_example
  6. sssdおよびsshdを再起動します:
    1. OEL6およびOEL7の場合: authconfig --enablemkhomedir --enablepamaccess --update
    2. OEL8の場合: authselect select sssd with-mkhomedir with-pamaccess
    3. service sshd restartを実行します。
    4. 実行: service sssd restart