JSON Web Tokens (JWT) Authentication

Slurm provides a RFC7519 compliant implementation of JSON Web Tokens (JWT).
Slurmは、RFC7519に準拠したJSON Web Token(JWT)の実装を提供します。
This authentication can be used as an AuthAltType, usually alongside auth/munge as the AuthType.
この認証は、AuthAltTypeとして使用でき、通常はauth / mungeと一緒にAuthTypeとして使用できます。
The only supported communication direction is from a client connecting to slurmctld, which means that certain commands (specifically interactive jobs using srun) are currently not supported for hosts with only auth/jwt enabled.
サポートされている唯一の通信方向は、slurmctldに接続しているクライアントからです。つまり、特定のコマンド(特に、srunを使用した対話型ジョブ)は、auth / jwtのみが有効になっているホストでは現在サポートされていません。

Prerequisites

JWT requires libjwt.
JWTにはlibjwtが必要です。
Both the library and the development headers must be available when Slurm is compiled.
Slurmのコンパイル時には、ライブラリと開発ヘッダーの両方が使用可能である必要があります。

Setup

  1. Configure and build Slurm for JWT support
    JWTサポート用にSlurmを構成およびビルドする
  2. Add JWT key to controller in StateSaveLocation: Here is an example with StateSaveLocation=/var/spool/slurm/statesave/
    StateSaveLocationのコントローラーにJWTキーを追加します。StateSaveLocation= / var / pool / slurm / statesave /の例を次に示します。
    openssl genrsa -out /var/spool/slurm/statesave/jwt_hs256.key 2048
    chown slurm /var/spool/slurm/statesave/jwt_hs256.key
    chmod 0600 /var/spool/slurm/statesave/jwt_hs256.key
    
  3. Add JWT as an alternative authentication in slurm.conf:
    slurm.confの代替認証としてJWTを追加します。
    AuthAltTypes=auth/jwt
    
  4. Restart slurmctld
    slurmctldを再起動します
  5. Create tokens for users as desired:
    必要に応じて、ユーザーのトークンを作成します。
    scontrol token username=$USER
    
    An optional lifespan=$LIFESPAN option can be used to change the token lifespan from the default 1800 seconds.
    オプションのlifespan = $ LIFESPANオプションを使用して、トークンの寿命をデフォルトの1800秒から変更できます。
    The root account, or SlurmUser account can be used to generate tokens for any user.
    rootアカウント、またはSlurmUserアカウントを使用して、任意のユーザーのトークンを生成できます。
    Alternatively, a user may use the command to generate tokens for themselves by simply calling
    または、ユーザーはこのコマンドを使用して、単に呼び出すだけで自分のトークンを生成できます。
    scontrol token
    
  6. Export the SLURM_JWT environment variable before calling any Slurm command.
    Slurmコマンドを呼び出す前に、SLURM_JWT環境変数をエクスポートします。

Compatibility

Slurm uses libjwt to view and verify RFC7519 JWT tokens.
Slurmはlibjwtを使用して、RFC7519JWTトークンを表示および検証します。
Compliant tokens generated by another solution can be used as long as the following requirments are met:
次の要件が満たされている限り、別のソリューションによって生成された準拠トークンを使用できます。
  1. Required tokens for Slurm are present:
    Slurmに必要なトークンが存在します:
    • iat: Unix timestamp of creation date.
      iat:作成日のUnixタイムスタンプ。
    • exp: Unix timestamp of expiration date.
      exp:有効期限のUnixタイムスタンプ。
    • sun: Slurm UserName ( POSIX.1-2017 User Name ).
      sun:Slurm UserName(POSIX.1-2017 User Name)。
  2. Tokens are signed with HS256 algorithm compliant to RFC7518.
    トークンは、RFC7518に準拠したHS256アルゴリズムで署名されています。
    No other algorithms are currently supported by Slurm.
    現在、Slurmでサポートされているアルゴリズムは他にありません。
  3. Signing key is provided to slurmctld and slurmdbd to allow decryption of the tokens.
    トークンの復号化を可能にするために、slurmctldとslurmdbdに署名鍵が提供されます。
    Slurm currently only supports a single signing key.
    Slurmは現在、単一の署名鍵のみをサポートしています。

Last modified 30 December 2020