Slurm Authentication Plugin API

Overview

This document describes Slurm authentication plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own Slurm authentication plugins.
このドキュメントでは、Slurm認証プラグインとそれらを定義するAPIについて説明します。独自のSlurm認証プラグインを作成したいプログラマへのリソースとして意図されています。

Slurm authentication plugins are Slurm plugins that implement the Slurm authentication API described herein. They must conform to the Slurm Plugin API with the following specifications:
Slurm認証プラグインは、ここで説明するSlurm認証APIを実装するSlurmプラグインです。これらは、次の仕様でSlurmプラグインAPIに準拠している必要があります。

const char plugin_type[]
The major type must be "auth." The minor type can be any recognizable abbreviation for the type of authentication. We recommend, for example:
主なタイプは「auth」でなければなりません。マイナータイプは、認証タイプの認識可能な省略形です。たとえば、次のことをお勧めします。

  • none — A plugin that implements the API without providing any actual authentication service. This may be used for testing purposes, but is not suitable for production use due to lack of effective security.
    none —実際の認証サービスを提供せずにAPIを実装するプラグイン。これはテスト目的で使用できますが、効果的なセキュリティが不足しているため、本番環境での使用には適していません。
  • munge — LLNL's Munge protocol (recommended plugin for production use).
    munge — LLNLのMungeプロトコル(本番用の推奨プラグイン)。

const char plugin_name[]
Some descriptive name for the plugin. There is no requirement with respect to its format.
プラグインの説明的な名前。その形式に関して要件はありません。

const uint32_t plugin_version
If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error. If not specified, then the plugin may be loaded by Slurm commands and daemons from any version, however this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the plugin.
指定した場合、このプラグインのビルドに使用されたSlurmのバージョンを識別し、異なるバージョンのSlurmからプラグインをロードしようとすると、エラーが発生します。指定されていない場合、プラグインはSlurmコマンドとデーモンによって任意のバージョンから読み込まれる可能性がありますが、プラグイン関数の引数の変更やプラグインによって使用される他のSlurm関数の変更が原因で、障害の診断が困難になる場合があります。

The programmer is urged to study src/plugins/auth/none/auth_none.c for an example implementation of a Slurm authentication plugin.
プログラマーは、slurm認証プラグインの実装例について、src / plugins / auth / none / auth_none.cを調べることをお勧めします。

Data Objects

The implementation must support an opaque class, which it defines, to be used as an authentication "credential." This class must encapsulate all user-specific information necessary for the operation of the API specification below. The credential is referred to in Slurm code by an anonymous pointer (void *).
実装は、認証「資格情報」として使用されるために、それが定義する不透明なクラスをサポートする必要があります。このクラスは、以下のAPI仕様の操作に必要なすべてのユーザー固有の情報をカプセル化する必要があります。資格情報は、匿名ポインター(void *)によってSlurmコードで参照されます。

API Functions

The following functions must appear. Functions which are not implemented should be stubbed.
次の関数が表示されます。実装されていない関数はスタブする必要があります。

int init (void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.
プラグインがロードされたとき、他の関数が呼び出される前に呼び出されます。ここにグローバル初期化を配置します。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini (void)

Description:
Called when the plugin is removed. Clear any allocated storage here.
プラグインが削除されたときに呼び出されます。ここで割り当て済みのストレージをすべてクリアします。

Returns: None.

Note: These init and fini functions are not the same as those described in the dlopen (3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
注:これらのinitおよびfini関数は、dlopen(3)システムライブラリで説明されているものと同じではありません。Cランタイムシステムは、独自の初期化のためにこれらのシンボルを選択します。システムの_init()はSlurm init()の前に呼び出され、Slurm fini()はシステムの_fini()の前に呼び出されます。

void *slurm_auth_create(char *auth_info);

Description: Allocates from the free store an anonymous credential object and returns a pointer to it. The pointer should be valid until passed to slurm_auth_destroy() for disposal. Slurm will not pass credentials to the API which have not been allocated by this function.
説明:フリーストアから匿名の資格情報オブジェクトを割り当て、そのオブジェクトへのポインターを返します。ポインタは、廃棄のためにslurm_auth_destroy()に渡されるまで有効です。Slurmは、この関数によって割り当てられていない資格情報をAPIに渡しません。

Arguments:
argv   (input) plugin specific information. auth_info   (input) plugin specific identification of the server.
argv(入力)プラグイン固有の情報。auth_info(入力)サーバーのプラグイン固有のID。

Returns: A pointer to a newly allocated credential if successful. On failure, the plugin should return NULL and set its errno to an appropriate value to indicate the reason for failure.
戻り値:成功した場合、新しく割り当てられた資格情報へのポインタ。失敗した場合、プラグインはNULLを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

int slurm_auth_destroy (void *cr);

Description: Deallocates a credential that was allocated with slurm_auth_alloc() and any associated storage that has been allocated for it during its use.
説明:slurm_auth_alloc()で割り当てられた資格情報と、その使用中に割り当てられた関連ストレージを割り当て解除します。

Arguments: cr    (input) pointer to the credential that is to be deallocated. Cannot be NULL.
引数:割り当てを解除する資格へのcr(入力)ポインター。NULLにすることはできません。

Returns: SLURM_SUCCESS if successful. On failure, the plugin should return SLURM_ERROR and set the errno to an appropriate value to indicate the reason for failure.
戻り値:成功した場合はSLURM_SUCCESS。失敗すると、プラグインはSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

int slurm_auth_verify (void *cr, char *auth_info );

Description: Verifies that a credential is in order and correctly identifies the associated user. It also verifies that the credential has not expired. If verification is successful, the return values of slurm_auth_get_uid() and slurm_auth_get_gid() in subsequent calls must correspond to the actual verified system UID and GID of the user associated with the credential. Verification must fail if the credential has not previously been activated, even if a credential implementation cannot exist in an unactivated state. A credential's valid term is defined at activation and verification must fail if the credential has expired, even if it would otherwise be valid.
説明:資格情報が正しいことを確認し、関連付けられたユーザーを正しく識別します。また、資格情報の有効期限が切れていないことも確認します。検証が成功した場合、後続の呼び出しでのslurm_auth_get_uid()およびslurm_auth_get_gid()の戻り値は、資格情報に関連付けられたユーザーの実際の検証済みシステムUIDおよびGIDに対応している必要があります。資格情報の実装が非アクティブ状態で存在できない場合でも、資格情報が以前にアクティブ化されていない場合、検証は失敗する必要があります。資格情報の有効期間はアクティブ化時に定義され、資格情報の有効期限が切れている場合、それが有効である場合でも検証が失敗する必要があります。

Arguments:
cr   (input) pointer to the credential which is to be verified. Cannot be NULL.
検証される資格情報へのcr(入力)ポインター。NULLにすることはできません。

auth_info   (input) plugin specific identification of the server.
auth_info(入力)サーバーのプラグイン固有のID。

Returns: SLURM_SUCCESS if the credential is verified to be in order and has not expired. If the credential cannot be verified, or if the credential has expired, the function should return SLURM_ERROR and set its errno to an appropriate value to indicate the reason for failure.
戻り値:信任状が正しいことを確認され、期限が切れていない場合はSLURM_SUCCESS。資格情報を検証できない場合、または資格情報の有効期限が切れている場合、関数はSLURM_ERRORを返し、errnoを適切な値に設定して、失敗の理由を示す必要があります。

uid_t slurm_auth_get_uid(void *cred);
gid_t slurm_auth_get_gid (void *cred);

Description: Extracts the numerical UID or GID of the user corresponding to the given credential. Only valid after slurm_auth_verify() has been called on a given credential. An unverified credential does not immediately give rise to an error condition in these functions, but instead will return SLURM_AUTH_NOBODY for the UID and GID. A plugin may consider the lack of verification as an error.
説明:指定された資格情報に対応するユーザーの数値UIDまたはGIDを抽出します。slurm_auth_verify()が指定された資格情報で呼び出された後にのみ有効です。未検証の資格情報は、これらの関数ですぐにエラー状態を引き起こすわけではなく、代わりにUIDおよびGIDに対してSLURM_AUTH_NOBODYを返します。プラグインは、検証の欠如をエラーと見なす場合があります。

Arguments:
cred    (input) pointer to the credential containing the desired identification. Cannot be NULL.
cred(入力)必要なIDを含む資格情報へのポインター。NULLにすることはできません。

Returns: If successful, the Linux UID (GID) associated with the credential. In case of error, SLURM_AUTH_NOBODY should be returned and errno set appropriately to indicate the cause of the failure.
戻り値:成功した場合、資格情報に関連付けられたLinux UID(GID)。エラーが発生した場合は、SLURM_AUTH_NOBODYを返し、errnoを適切に設定して、失敗の原因を示す必要があります。

int slurm_auth_pack (void *cr, Buf buf);

Description: Marshals a credential into a buffer for transmission according to the Slurm packing protocol. All authentication plugins must first pack the plugin_type and then the plugin_version data before any plugin-specific data elements are packed. slurm_auth_pack() and slurm_auth_pack() are strictly reciprocal. The esult of a packing followed by an unpacking must be a functionally equivalent credential. A credential is deemed appropriate for marshalling at any time after its allocation and before its destruction.
説明:Slurmパッキングプロトコルに従って、資格情報をバッファにマーシャリングして送信します。すべての認証プラグインは、プラグイン固有のデータ要素がパックされる前に、まずplugin_typeをパックし、次にplugin_versionデータをパックする必要があります。slurm_auth_pack()とslurm_auth_pack()は厳密に逆です。パックとそれに続くアンパックの結果は、機能的に同等のクレデンシャルでなければなりません。クレデンシャルは、割り当て後、破棄される前であればいつでもマーシャリングに適していると見なされます。

Arguments:
cr    (input) pointer to the credential to pack.
パックする信任状へのcr(入力)ポインター。

buf    (input/output) the buffer into which the credential should be packed.
buf(入力/出力)信任状をパックするバッファー。

Returns: SLURM_SUCCESS if successful. On failure the plugin should return SLURM_ERROR and set the errno to indicate the reason for the failure.
戻り値:成功した場合はSLURM_SUCCESS。失敗すると、プラグインはSLURM_ERRORを返し、errnoを設定して失敗の理由を示す必要があります。

int slurm_auth_unpack (void *cr, Buf buf);

Description: Unmarshals a credential from a buffer according to the Slurm packing protocol into a supplied (and presumed empty) credential object. The unmarshalled credential is not assumed to be activated or verified. The plugin_type and plugin_version data should first be unpacked from the buffer and verified for applicability. The API does not enforce that they must be equivalent, merely compatible. Compatibility is implementation-dependent.
説明:Slurmパッキングプロトコルに従って、バッファーから資格情報をアンマーシャルして、指定された(および空であると想定される)資格情報オブジェクトに非整列化します。非整列化された資格情報は、アクティブ化または検証されているとは見なされません。plugin_typeおよびplugin_versionデータは、最初にバッファーからアンパックされ、適用可能性が検証されます。APIはそれらが同等である必要があることを強制せず、単に互換性があります。互換性は実装に依存します。

Arguments:
cr    (output) pointer to the credential to pack.
パックする信任状へのcr(出力)ポインター。

buf    (input/output) the buffer from which the credential should be unpacked.
buf(入力/出力)信任状をアンパックするバッファー。

Returns: SLURM_SUCCESS if the credential was successfully unpacked. In case of failure, the function should return SLURM_ERROR and set errno appropriately to indicate the cause of the failure. If the function fails, no assumptions are made about the state of the credential except its suitability for destruction via slurm_auth_destroy().
戻り値:信任状が正常にアンパックされた場合はSLURM_SUCCESS。失敗した場合、関数はSLURM_ERRORを返し、errnoを適切に設定して失敗の原因を示す必要があります。関数が失敗した場合、slurm_auth_destroy()による破棄に適していることを除いて、資格情報の状態は想定されません。

Last modified 7 March 2019