JSON Web Tokens (JWT) Authentication

Slurm provides a RFC7519 compliant implementation of JSON Web Tokens (JWT). This authentication can be used as an AuthAltType, usually alongside auth/munge as the AuthType.
SlurmはRFC 7519準拠のJSON Web Token(JWT)の実装を提供します。この認証は、通常AuthTypeとしてauth / mungeと一緒にAuthAltTypeとして使用できます。

Prerequisites

JWT requires libjwt. Both the library and the development headers must be available when Slurm is compiled.
JWTにはlibjwtが必要です。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 / spool / slurm / statesave /の例です
    openssl genrsa -out /var/spool/slurm/statesave/jwt_hs256.key 2048
    chown slurm /var/spool/slurm/statesave/jwt_hs256.key
    chmod 0700 /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. The root account, or SlurmUser account can be used to generate tokens for any user. Alternatively, a user may use the command to generate tokens for themselves by simply calling
    オプションのlifespan = $ LIFESPANオプションを使用して、トークンの寿命をデフォルトの1800秒から変更できます。rootアカウント、またはSlurmUserアカウントを使用して、任意のユーザーのトークンを生成できます。または、ユーザーはコマンドを使用して、単に
    scontrol token
    
  6. Export the SLURM_JWT environment variable before calling any Slurm command.
    Slurmコマンドを呼び出す前に、SLURM_JWT環境変数をエクスポートします。

Last modified 21 February 2020