自作クラスタ計算機:openldapを使ったldapサーバの基本設定
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 自作クラスタ計算機:openldapを使ったldapサーバの基本設定 [2026/05/08 19:07] – [計算ノードでの作業] koudai | 自作クラスタ計算機:openldapを使ったldapサーバの基本設定 [2026/05/13 19:46] (current) – [ユーザーの削除] koudai | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== 管理ノード ====== | ====== 管理ノード ====== | ||
| - | OpenLDAPをインストール | + | ===== OpenLDAPのインストールと初期設定 ===== |
| < | < | ||
| Line 16: | Line 16: | ||
| </ | </ | ||
| + | * Omit OpenLDAP server Configuration?: | ||
| * DNS domain name: cluster.home.arpa | * DNS domain name: cluster.home.arpa | ||
| - | * プライベートLAN内のドメイン名は home.arpa が推奨されている、らしい | + | * プライベートLAN内のドメイン名は |
| - | * クラスタ計算機のドメインなので、ここでは cluster | + | * クラスタ計算機のドメインなので、ここでは cluster.home.arpha としておく |
| * Organization name: Computer cluster | * Organization name: Computer cluster | ||
| - | * 好きな名前にしてよろしい | + | * このドメインが何を表すかの覚書。好きな名前にしてよろしい |
| - | * Administration password: | + | * Administration password: |
| + | * Do you want the database to be removed when slapd is purged?: No | ||
| + | * slapdをアンインストールしたときにデータベースを残すかどうか。 | ||
| + | * Move old database?: Yes | ||
| + | * 古いデータベースを別名にして残すかどうか。 | ||
| - | Yes/ | + | ちゃんと設定されたか確認 |
| - | + | ||
| - | + | ||
| - | 設定されたか確認 | + | |
| < | < | ||
| - | $ ldapsearch -x -LLL -H ldap:/// -b dc=cluster, | + | $ sudo slapcat |
| dn: dc=cluster, | dn: dc=cluster, | ||
| objectClass: | objectClass: | ||
| objectClass: | objectClass: | ||
| objectClass: | objectClass: | ||
| - | o: Computer | + | o: Computer |
| dc: cluster | dc: cluster | ||
| + | structuralObjectClass: | ||
| + | entryUUID: d1780672-e166-1040-9b15-8729bd3fc447 | ||
| + | creatorsName: | ||
| + | createTimestamp: | ||
| + | entryCSN: 20260511092330.169937Z# | ||
| + | modifiersName: | ||
| + | modifyTimestamp: | ||
| </ | </ | ||
| - | 基本構造作成 | + | |
| + | ===== 基本構造作成 | ||
| + | |||
| + | 組織単位を作成し、LDAPに追加する。 | ||
| < | < | ||
| - | $ vim base.ldif | + | $ nano base.ldif |
| </ | </ | ||
| + | |||
| <file - base.ldif> | <file - base.ldif> | ||
| - | dn: ou=People, | + | dn: ou=people, |
| objectClass: | objectClass: | ||
| - | ou: People | + | ou: people |
| - | dn: ou=Groups, | + | dn: ou=groups, |
| objectClass: | objectClass: | ||
| - | ou: Groups | + | ou: groups |
| </ | </ | ||
| + | |||
| < | < | ||
| - | ldapadd -x -D cn=admin, | + | $ ldapadd -x -D cn=admin, |
| </ | </ | ||
| + | ちゃんと設定されたか確認。 | ||
| - | ユーザーの作成 | + | < |
| + | $ sudo slapcat | ||
| + | dn: dc=cluster, | ||
| + | objectClass: | ||
| + | objectClass: | ||
| + | objectClass: | ||
| + | o: Computer Cluster | ||
| + | dc: cluster | ||
| + | structuralObjectClass: | ||
| + | entryUUID: d1780672-e166-1040-9b15-8729bd3fc447 | ||
| + | creatorsName: | ||
| + | createTimestamp: | ||
| + | entryCSN: 20260511092330.169937Z# | ||
| + | modifiersName: | ||
| + | modifyTimestamp: | ||
| + | |||
| + | dn: ou=people, | ||
| + | objectClass: | ||
| + | ou: people | ||
| + | structuralObjectClass: | ||
| + | entryUUID: e7553b08-e167-1040-867b-8d36242c18d8 | ||
| + | creatorsName: | ||
| + | createTimestamp: | ||
| + | entryCSN: 20260511093116.348516Z# | ||
| + | modifiersName: | ||
| + | modifyTimestamp: | ||
| + | |||
| + | dn: ou=groups, | ||
| + | objectClass: | ||
| + | ou: groups | ||
| + | structuralObjectClass: | ||
| + | entryUUID: e755e2c4-e167-1040-867c-8d36242c18d8 | ||
| + | creatorsName: | ||
| + | createTimestamp: | ||
| + | entryCSN: 20260511093116.352854Z# | ||
| + | modifiersName: | ||
| + | modifyTimestamp: | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== ユーザーの追加 ===== | ||
| + | |||
| + | ユーザーの初期パスワードを設定する。 | ||
| + | |||
| + | < | ||
| + | $ slappasswd | ||
| + | New password: | ||
| + | Re-enter new password: | ||
| + | {SSHA}9VhiMfY0h9+SiAzqqCRIYGnKedgMUfH5 | ||
| + | </ | ||
| + | |||
| + | ユーザー情報の作成。 | ||
| < | < | ||
| Line 64: | Line 132: | ||
| </ | </ | ||
| <file - user.ldif> | <file - user.ldif> | ||
| - | dn: uid=taro, | + | dn: cn=taro, |
| + | objectClass: | ||
| + | cn: taro | ||
| + | gidNumber: 10000 | ||
| + | |||
| + | dn: uid=taro, | ||
| objectClass: | objectClass: | ||
| objectClass: | objectClass: | ||
| Line 75: | Line 148: | ||
| homeDirectory: | homeDirectory: | ||
| loginShell: /bin/bash | loginShell: /bin/bash | ||
| - | userPassword: | + | userPassword: |
| </ | </ | ||
| Line 81: | Line 154: | ||
| $ ldapadd -x -D cn=admin, | $ ldapadd -x -D cn=admin, | ||
| </ | </ | ||
| - | |||
| - | パスワードのSSHAハッシュは以下で取得できます。 | ||
| - | |||
| - | < | ||
| - | $ slappasswd | ||
| - | New password: | ||
| - | Re-enter new password: | ||
| - | {SSHA}JzL3FwGnjzKz2dBzPd82zsH4eN3Nx+lT | ||
| - | </ | ||
| - | |||
| - | |||
| ちゃんと登録されているか確認 | ちゃんと登録されているか確認 | ||
| < | < | ||
| - | $ ldapsearch -x -LLL -b dc=cluster, | + | $ sudo slapcat |
| </ | </ | ||
| Line 105: | Line 167: | ||
| < | < | ||
| $ sudo mkdir /home/taro | $ sudo mkdir /home/taro | ||
| + | $ sudo chown 10000:10000 /home/taro | ||
| </ | </ | ||
| Line 125: | Line 188: | ||
| + | ===== ユーザーの削除 ===== | ||
| + | < | ||
| + | $ ldapdelete -x -W -D " | ||
| + | $ ldapdelete -x -W -D " | ||
| + | </ | ||
| ====== 計算ノードでの作業 ====== | ====== 計算ノードでの作業 ====== | ||
| + | |||
| + | < | ||
| + | $ apt install libnss-ldapd libpam-ldapd ldap-utils | ||
| + | </ | ||
| + | |||
| + | * LDAP server URI: ldap:// | ||
| + | * LDAP server search base: dc=cluster, | ||
| + | * Name services to configure: passwd, group, shadow, hosts (スペースキーでチェックを入れられます) | ||
| + | |||
| + | ユーザーがいるか確認 | ||
| + | |||
| + | < | ||
| + | $ getent passwd taro | ||
| + | taro: | ||
| + | </ | ||
| + | |||
| + | |||
| + | 参考 | ||
| + | |||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ====== SSSD ====== | ||
| + | |||
| 必要なパッケージのインストール | 必要なパッケージのインストール | ||
| Line 143: | Line 241: | ||
| [sssd] | [sssd] | ||
| services = nss, pam | services = nss, pam | ||
| - | domains = cluster.home.arpa | + | config_file_version = 2 |
| + | domains = default | ||
| - | [domain/cluster.home.arpa] | + | [domain/default] |
| id_provider = ldap | id_provider = ldap | ||
| auth_provider = ldap | auth_provider = ldap | ||
| - | ldap_uri = ldap:// | + | ldap_uri = ldap:// |
| ldap_search_base = dc=cluster, | ldap_search_base = dc=cluster, | ||
| - | # ユーザーとグループの場所 | + | # ユーザー・グループの場所 |
| - | ldap_user_search_base = ou=People, | + | ldap_user_search_base = ou=people, |
| - | ldap_group_search_base = ou=Groups, | + | ldap_group_search_base = ou=groups, |
| # 認証 | # 認証 | ||
| ldap_default_bind_dn = cn=admin, | ldap_default_bind_dn = cn=admin, | ||
| - | ldap_default_authtok = 【LDAPのパスワード】 | + | ldap_default_authtok = LDAPをインストールした際に設定したパスワード |
| - | # ホームディレクトリ | + | # TLS |
| - | ldap_user_home_directory | + | ldap_id_use_start_tls |
| + | ldap_tls_reqcert = never | ||
| + | ldap_auth_disable_tls_never_use_in_production = true | ||
| </ | </ | ||
| Line 171: | Line 272: | ||
| NSS設定 | NSS設定 | ||
| < | < | ||
| - | $ sudo chmod 600 /etc/sssd/sssd.conf | + | $ sudo vim /etc/nsswitch.conf |
| </ | </ | ||
| < | < | ||
| Line 181: | Line 282: | ||
| </ | </ | ||
| 普通はとくにいじる必要ないです。 | 普通はとくにいじる必要ないです。 | ||
| + | |||
| + | |||
| + | ホームディレクトリの生成 | ||
| + | < | ||
| + | $ sudo apt install oddjob-mkhomedir | ||
| + | </ | ||
| Line 216: | Line 323: | ||
| </ | </ | ||
| + | |||
| + | |||
| + | === memo === | ||
| + | |||
| + | < | ||
| + | # | ||
| + | # / | ||
| + | # | ||
| + | # This file is included from other service-specific PAM config files, | ||
| + | # and should contain a list of the authorization modules that define | ||
| + | # the central access policy for use on the system. | ||
| + | # only deny service to users whose accounts are expired in / | ||
| + | # | ||
| + | # As of pam 1.0.1-6, this file is managed by pam-auth-update by default. | ||
| + | # To take advantage of this, it is recommended that you configure any | ||
| + | # local modules either before or after the default block, and use | ||
| + | # pam-auth-update to manage selection of other modules. | ||
| + | # pam-auth-update(8) for details. | ||
| + | # | ||
| + | |||
| + | # here are the per-package modules (the " | ||
| + | account [success=ok new_authtok_reqd=done default=ignore] pam_ldap.so | ||
| + | account required pam_unix.so | ||
| + | # here's the fallback if no module succeeds | ||
| + | account requisite pam_deny.so | ||
| + | # prime the stack with a positive return value if there isn't one already; | ||
| + | # this avoids us returning an error just because nothing sets a success code | ||
| + | # since the modules above will each just jump around | ||
| + | account required pam_permit.so | ||
| + | # and here are more per-package modules (the " | ||
| + | account [success=ok new_authtok_reqd=done ignore=ignore user_unknown=ignore authinfo_unavail=ignore default=bad] pam_ldap.so minimum_uid=1000 | ||
| + | # end of pam-auth-update config | ||
| + | |||
| + | </ | ||
自作クラスタ計算機/openldapを使ったldapサーバの基本設定.1778234872.txt.gz · Last modified: 2026/05/08 19:07 by koudai
