pam_slurm_adopt

The purpose of this module is to prevent users from sshing into nodes that they do not have a running job on, and to track the ssh connection and any other spawned processes for accounting and to ensure complete job cleanup when the job is completed.
このモジュールの目的は、実行中のジョブがないノードにユーザーがsshするのを防ぎ、アカウンティングのためにssh接続およびその他の生成されたプロセスを追跡し、ジョブが完了したときにジョブが完全にクリーンアップされるようにすることです。
This module does this by determining the job which originated the ssh connection.
このモジュールは、ssh接続を開始したジョブを判別することによってこれを行います。
The user's connection is "adopted" into the "external" step of the job.
ユーザーの接続は、ジョブの「外部」ステップに「採用」されます。

Installation

Source:

In your Slurm build directory, navigate to slurm/contribs/pam_slurm_adopt/ and run
Slurmビルドディレクトリで、slurm / contribs / pam_slurm_adopt /に移動して実行します

make && make install
as root.
ルートとして。
This will place pam_slurm_adopt.a, pam_slurm_adopt.la, and pam_slurm_adopt.so in /lib/security/ (on Debian systems) or /lib64/security/ (on RedHat/SuSE systems).
これにより、pam_slurm_adopt.a、pam_slurm_adopt.la、およびpam_slurm_adopt.soが/ lib / security /(Debianシステムの場合)または/ lib64 / security /(RedHat / SuSEシステムの場合)に配置されます。

RPM:

The included slurm.spec will build a slurm-pam_slurm RPM which will install pam_slurm_adopt.
含まれているslurm.specは、pam_slurm_adoptをインストールするslurm-pam_slurmRPMを構築します。
Refer to the Quick Start Administrator Guide for instructions on managing an RPM-based install.
RPMベースのインストールを管理する手順については、クイックスタート管理者ガイドを参照してください。

PAM Configuration

Add the following line to the appropriate file in /etc/pam.d, such as system-auth or sshd (you may use either the "required" or "sufficient" PAM control flag):
次の行を/etc/pam.d内の適切なファイル(system-authやsshdなど)に追加します(「必須」または「十分」のPAM制御フラグを使用できます)。

account    required      pam_slurm_adopt.so

The order of plugins is very important.
プラグインの順序は非常に重要です。
pam_slurm_adopt.so should be the last PAM module in the account stack.
pam_slurm_adopt.soは、アカウントスタックの最後のPAMモジュールである必要があります。
Included files such as common-account should normally be included before pam_slurm_adopt.
common-accountなどのインクルードファイルは、通常、pam_slurm_adoptの前にインクルードする必要があります。
You might have the following account stack in sshd:
sshdには次のアカウントスタックがある可能性があります。

account    required      pam_nologin.so
account    include       password-auth
...
-account    required      pam_slurm_adopt.so

Note the "-" before the account entry for pam_slurm_adopt.
pam_slurm_adoptのアカウントエントリの前の「-」に注意してください。
It allows PAM to fail gracefully if the pam_slurm_adopt.so file is not found.
これにより、pam_slurm_adopt.soファイルが見つからない場合にPAMが正常に失敗することができます。
If Slurm is on a shared filesystem, such as NFS, then this is suggested to avoid being locked out of a node while the shared filesystem is mounting or down.
SlurmがNFSなどの共有ファイルシステム上にある場合は、共有ファイルシステムのマウント中またはダウン中にノードからロックアウトされないようにすることをお勧めします。

pam_slurm_adopt must be used with the task/cgroup task plugin and either the proctrack/cgroup or the proctrack/cray_aries proctrack plugin.
pam_slurm_adoptは、task / cgroupタスクプラグインと、proctrack / cgroupまたはproctrack / cray_ariesproctrackプラグインのいずれかで使用する必要があります。
The pam_systemd module will conflict with pam_slurm_adopt, so you need to disable it in all files that are included in sshd or system-auth (e.g. password-auth, common-session, etc.).
pam_systemdモジュールはpam_slurm_adoptと競合するため、sshdまたはsystem-authに含まれるすべてのファイル(例:password-auth、common-sessionなど)で無効にする必要があります。
You should also stop and mask systemd-logind.
また、systemd-logindを停止してマスクする必要があります。
You must also make sure a different PAM module isn't short-circuiting the account stack before it gets to pam_slurm_adopt.so.
また、pam_slurm_adopt.soに到達する前に、別のPAMモジュールがアカウントスタックを短絡していないことを確認する必要があります。
From the example above, the following two lines have been commented out in the included password-auth file:
上記の例から、含まれているpassword-authファイルで次の2行がコメントアウトされています。

#account    sufficient    pam_localuser.so
#-session   optional      pam_systemd.so

Note: This may involve editing a file that is auto-generated.
注:これには、自動生成されたファイルの編集が含まれる場合があります。
Do not run the config script that generates the file or your changes will be erased.
ファイルを生成する構成スクリプトを実行しないでください。実行すると、変更が消去されます。

If you always want to allow access for an administrative group (e.g., wheel), stack the pam_access module after pam_slurm_adopt.
管理グループ(ホイールなど)へのアクセスを常に許可する場合は、pam_slurm_adoptの後にpam_accessモジュールをスタックします。
A success with pam_slurm_adopt is sufficient to allow access, but the pam_access module can allow others, such as administrative staff, access even without jobs on that node:
pam_slurm_adoptでの成功はアクセスを許可するのに十分ですが、pam_accessモジュールは、そのノードにジョブがなくても、管理スタッフなどの他のユーザーにアクセスを許可できます。

account    sufficient    pam_slurm_adopt.so
account    required      pam_access.so

Then edit the pam_access configuration file (/etc/security/access.conf):
次に、pam_access構成ファイル(/etc/security/access.conf)を編集します。

+:wheel:ALL
-:ALL:ALL

An alternative to pam_access is to place pam_listfile.so before pam_slurm_adopt.so.
pam_accessの代わりに、pam_slurm_adopt.soの前にpam_listfile.soを配置することもできます。
For example:
例えば:

account    sufficient    pam_listfile.so item=user sense=allow onerr=fail file=/path/to/allowed_users_file
account    required      pam_slurm_adopt.so

List the usernames of the allowed users in allowed_users_file.
許可されたユーザーのユーザー名をallowed_users_fileにリストします。

When access is denied, the user will receive a relevant error message.
アクセスが拒否されると、ユーザーは関連するエラーメッセージを受け取ります。

pam_slurm_adopt Module Options

This module is configurable.
このモジュールは構成可能です。
Add these options to the end of the pam_slurm_adopt line in the appropriate file in /etc/pam.d/ (e.g., sshd or system-auth):
/etc/pam.d/内の適切なファイル(sshdやsystem-authなど)のpam_slurm_adopt行の最後に次のオプションを追加します。

account sufficient pam_slurm_adopt.so optionname=optionvalue

This module has the following options:
このモジュールには、次のオプションがあります。

action_no_jobs
The action to perform if the user has no jobs on the node.
ユーザーがノードにジョブを持っていない場合に実行するアクション。
Configurable values are:
構成可能な値は次のとおりです。
ignore
Do nothing.
何もしない。
Fall through to the next pam module.
次のpamモジュールにフォールスルーします。
deny (default)
Deny the connection.
接続を拒否します。
action_unknown
The action to perform when the user has multiple jobs on the node and the RPC does not locate the source job.
ユーザーがノード上に複数のジョブを持っていて、RPCがソースジョブを見つけられない場合に実行するアクション。
If the RPC mechanism works properly in your environment, this option will likely be relevant only when connecting from a login node.
RPCメカニズムがご使用の環境で適切に機能する場合、このオプションは、ログインノードから接続する場合にのみ関連する可能性があります。
Configurable values are:
構成可能な値は次のとおりです。
newest (default)
Pick the newest job on the node.
ノード上の最新のジョブを選択します。
The "newest" job is chosen based on the mtime of the job's step_extern cgroup; asking Slurm would require an RPC to the controller.
「最新の」ジョブは、ジョブのstep_externcgroupのmtimeに基づいて選択されます。Slurmに要求すると、コントローラーへのRPCが必要になります。
Thus, the memory cgroup must be in use so that the code can check mtimes of cgroup directories.
したがって、コードがcgroupディレクトリのm回をチェックできるように、メモリcgroupが使用されている必要があります。
The user can ssh in but may be adopted into a job that exits earlier than the job they intended to check on.
ユーザーはSSHで接続できますが、チェックする予定のジョブよりも早く終了するジョブに採用される場合があります。
The ssh connection will at least be subject to appropriate limits and the user can be informed of better ways to accomplish their objectives if this becomes a problem.
ssh接続には少なくとも適切な制限が適用され、これが問題になる場合は、ユーザーに目的を達成するためのより良い方法を通知できます。
NOTE: If the module fails to retrieve the cgroup mtime, then the picked job may not be the newest one.
注:モジュールがcgroup mtimeの取得に失敗した場合、選択されたジョブは最新のものではない可能性があります。
allow
Let the connection through without adoption.
養子縁組せずに接続を通過させます。
deny
Deny the connection.
接続を拒否します。
action_adopt_failure
The action to perform if the process is unable to be adopted into any job for whatever reason.
何らかの理由でプロセスをジョブに採用できない場合に実行するアクション。
If the process cannot be adopted into the job identified by the callerid RPC, it will fall through to the action_unknown code and try to adopt there.
プロセスを呼び出し元RPCによって識別されたジョブに採用できない場合、プロセスはaction_unknownコードにフォールスルーし、そこで採用を試みます。
A failure at that point or if there is only one job will result in this action being taken.
その時点で失敗した場合、またはジョブが1つしかない場合は、このアクションが実行されます。
Configurable values are:
構成可能な値は次のとおりです。
allow (default)
Let the connection through without adoption.
養子縁組せずに接続を通過させます。
WARNING: This value is insecure and is recommended for testing purposes only.
警告:この値は安全ではなく、テスト目的でのみ推奨されます。
We recommend using "deny."

「拒否」の使用をお勧めします。
deny
Deny the connection.
接続を拒否します。
action_generic_failure
The action to perform if there are certain failures such as the inability to talk to the local slurmd or if the kernel doesn't offer the correct facilities.
ローカルslurmdと通信できない、またはカーネルが正しい機能を提供しないなどの特定の障害が発生した場合に実行するアクション。
Configurable values are:
構成可能な値は次のとおりです。
ignore (default)
Do nothing.
何もしない。
Fall through to the next pam module.
次のpamモジュールにフォールスルーします。
WARNING: This value is insecure and is recommended for testing purposes only.
警告:この値は安全ではなく、テスト目的でのみ推奨されます。
We recommend using "deny."

「拒否」の使用をお勧めします。
allow
Let the connection through without adoption.
養子縁組せずに接続を通過させます。
deny
Deny the connection.
接続を拒否します。
disable_x11
Turn off Slurm built-in X11 forwarding support.
Slurmの組み込みX11転送サポートをオフにします。
Configurable values are:
構成可能な値は次のとおりです。
0 (default)
If the job the connection is adopted into has Slurm's X11 forwarding enabled, the DISPLAY variable will be overwritten with the X11 tunnel endpoint details.
接続が採用されるジョブでSlurmのX11転送が有効になっている場合、DISPLAY変数はX11トンネルエンドポイントの詳細で上書きされます。
1
Do not check for Slurm's X11 forwarding support, and do not alter the DISPLAY variable.
SlurmのX11転送サポートを確認したり、DISPLAY変数を変更したりしないでください。
log_level
See SlurmdDebug in slurm.conf for available options.
使用可能なオプションについては、slurm.confのSlurmdDebugを参照してください。
The default log_level is info.
デフォルトのlog_levelはinfoです。
nodename
If the NodeName defined in slurm.conf is different than this node's hostname (as reported by hostname -s), then this must be set to the NodeName in slurm.conf that this host operates as.
slurm.confで定義されたNodeNameがこのノードのホスト名(hostname -sで報告される)と異なる場合、これは、このホストが動作するslurm.confのNodeNameに設定する必要があります。
service
The pam service name for which this module should run.
このモジュールを実行する必要があるpamサービス名。
By default it only runs for sshd for which it was designed for.
デフォルトでは、設計されたsshdに対してのみ実行されます。
A different service name can be specified like "login" or "*" to allow the module to in any service context.
「login」や「*」などの別のサービス名を指定して、モジュールが任意のサービスコンテキストで使用できるようにすることができます。
For local pam logins this module could cause unexpected behaviour or even security issues.
ローカルpamログインの場合、このモジュールは予期しない動作やセキュリティの問題を引き起こす可能性があります。
Therefore if the service name does not match then this module will not perform the adoption logic and returns PAM_IGNORE immediately.
したがって、サービス名が一致しない場合、このモジュールは採用ロジックを実行せず、すぐにPAM_IGNOREを返します。

Slurm Configuration

PrologFlags=contain must be set in the slurm.conf.
PrologFlags = containはslurm.confで設定する必要があります。
This sets up the "extern" step into which ssh-launched processes will be adopted.
これにより、sshで起動されたプロセスが採用される「外部」ステップが設定されます。
You must also enable the task/cgroup plugin in slurm.conf.
slurm.confでtask / cgroupプラグインも有効にする必要があります。
See the Slurm cgroups guide.
Slurmcgroupsガイドを参照してください。

Important

PrologFlags=contain must be in place before using this module.
このモジュールを使用する前に、PrologFlags = containを配置する必要があります。
The module bases its checks on local steps that have already been launched.
モジュールは、すでに起動されているローカルステップに基づいてチェックを行います。
If the user has no steps on the node, such as the extern step, the module will assume that the user has no jobs allocated to the node.
externステップなど、ユーザーがノード上にステップを持っていない場合、モジュールは、ユーザーにノードに割り当てられたジョブがないと想定します。
Depending on your configuration of the PAM module, you might accidentally deny all user ssh attempts without PrologFlags=contain.
PAMモジュールの構成によっては、PrologFlags = containなしですべてのユーザーssh試行を誤って拒否する可能性があります。

The UsePAM option in slurm.conf is not related to pam_slurm_adopt.
slurm.confのUsePAMオプションは、pam_slurm_adoptとは関係ありません。

Other Configuration

Verify that UsePAM is set to On in /etc/ssh/sshd_config (it should be on by default).
/ etc / ssh / sshd_configでUsePAMがオンに設定されていることを確認します(デフォルトでオンになっているはずです)。

Firewalls, IP Addresses, etc.

slurmd should be accessible on any IP address from which a user might launch ssh.
slurmdは、ユーザーがsshを起動する可能性のある任意のIPアドレスでアクセスできる必要があります。
The RPC to determine the source job must be able to reach the slurmd port on that particular IP address.
ソースジョブを決定するRPCは、その特定のIPアドレスのslurmdポートに到達できる必要があります。
If there is no slurmd on the source node, such as on a login node, it is better to have the RPC be rejected rather than silently dropped.
ログインノードなど、ソースノードにslurmdがない場合は、RPCをサイレントにドロップするのではなく、拒否することをお勧めします。
This will allow better responsiveness to the RPC initiator.
これにより、RPCイニシエーターへの応答性が向上します。

Limitations

Alternate authentication methods such as multi-factor authentication may break process adoption with pam_slurm_adopt.
多要素認証などの代替認証方法は、pam_slurm_adoptによるプロセスの採用を妨げる可能性があります。

SELinux may conflict with pam_slurm_adopt, so it might need to be disabled.
SELinuxはpam_slurm_adoptと競合する可能性があるため、無効にする必要がある場合があります。

Last modified 29 April 2019