-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PAM (Pluggable Authentication Modules) is an opt-in configuration item for `ManagerEndpointConfig`. As documented in this PR, it is enabled via the `pam` configuration item, and defaults to false/not enabled if not specified: ```yaml multi_user: true pam: enable: true ``` I was unable to find a suitable Python PAM implementation for our needs, so ended up creating a PAM wrapper. In particular, all of the PAM implementations I found seemed to only implement the `pam_authenticate()` method, but we need the `pam_acct_mgmt()` and `pam_*_session()` functions. Until I'm educated otherwise then, our internal library appears to be more fully featured than other Python PAM implementations -- we may pull it out and offer it as an independent project at some point. [sc-36027]
- Loading branch information
1 parent
94ae4d2
commit bb9ae20
Showing
14 changed files
with
1,029 additions
and
49 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
changelog.d/20241115_095433_kevin_implement_pam_for_meps.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
New Functionality | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
- Implement optional PAM capabilities for ensuring user accounts meet | ||
site-specific criteria before starting user endpoints. Within the multi user | ||
endpoint, PAM defaults to off, but is enabled via the ``pam`` field: | ||
|
||
.. code-block:: yaml | ||
:caption: ``config.yaml`` -- Example MEP configuration opting-in to PAM | ||
multi_user: true | ||
pam: | ||
enable: true | ||
As authentication is implemented via Globus Auth and identity mapping, the | ||
Globus Compute Endpoint does not implement the authorization or password | ||
managment phases of PAM. It implements account | ||
(|pam_acct_mgmt(3)|_) and session (|pam_open_session(3)|) management. | ||
|
||
For more information, consult :ref:`the PAM section <pam>` of the | ||
documentation. | ||
|
||
.. |pam_acct_mgmt(3)| replace:: ``pam_acct_mgmt(3)`` | ||
.. _pam_acct_mgmt(3): https://www.man7.org/linux/man-pages/man3/pam_acct_mgmt.3.html | ||
.. |pam_open_session(3)| replace:: ``pam_open_session(3)`` | ||
.. _pam_open_session(3): https://www.man7.org/linux/man-pages/man3/pam_open_session.3.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
ManagerEndpointConfigModel, | ||
UserEndpointConfigModel, | ||
) | ||
from .pam import PamConfiguration # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
compute_endpoint/globus_compute_endpoint/endpoint/config/pam.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from dataclasses import asdict, dataclass | ||
|
||
import yaml | ||
|
||
|
||
@dataclass | ||
class PamConfiguration: | ||
""" | ||
:param enable: Whether to initiate a PAM session for each UEP start request. | ||
:param service_name: What PAM service_name with which to initialize the PAM | ||
session. If a particular MEP has different requirements, define those PAM | ||
requirements in ``/etc/pam.d/``, and specify the service name with this field. | ||
""" | ||
|
||
enable: bool = True | ||
service_name: str = "globus-compute-endpoint" | ||
|
||
|
||
def _to_yaml(dumper: yaml.SafeDumper, data: PamConfiguration): | ||
return dumper.represent_mapping("tag:yaml.org,2002:map", asdict(data)) | ||
|
||
|
||
yaml.SafeDumper.add_representer(PamConfiguration, _to_yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.