Skip to content

Commit cfaaf70

Browse files
hanwen-clusterhanwen-pcluste
authored andcommitted
Add a warning message to inform users about the unencrypted connections between cluster and external Slurm dbd
Signed-off-by: Hanwen <hanwenli@amazon.com>
1 parent cbcb47d commit cfaaf70

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

cli/src/pcluster/config/cluster_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
CustomSlurmSettingLevel,
198198
CustomSlurmSettingsIncludeFileOnlyValidator,
199199
CustomSlurmSettingsValidator,
200+
ExternalSlurmdbdTrafficNotEncrypted,
200201
ExternalSlurmdbdVsDatabaseIncompatibility,
201202
SlurmNodePrioritiesWarningValidator,
202203
)
@@ -2786,6 +2787,10 @@ def _register_validators(self, context: ValidatorContext = None):
27862787
database=self.database,
27872788
external_slurmdbd=self.external_slurmdbd,
27882789
)
2790+
self._register_validator(
2791+
ExternalSlurmdbdTrafficNotEncrypted,
2792+
external_slurmdbd=self.external_slurmdbd,
2793+
)
27892794

27902795

27912796
class QueueUpdateStrategy(Enum):

cli/src/pcluster/validators/slurm_settings_validator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,15 @@ def _validate(self, database, external_slurmdbd):
197197
"Database and ExternalSlurmdbd cannot be defined at the same time within SlurmSettings.",
198198
FailureLevel.ERROR,
199199
)
200+
201+
202+
class ExternalSlurmdbdTrafficNotEncrypted(Validator):
203+
"""Inform users about unencrypted connections."""
204+
205+
def _validate(self, external_slurmdbd):
206+
if external_slurmdbd is not None:
207+
self._add_failure(
208+
"Traffic between ParallelCluster and the external Slurmdbd is not encrypted. "
209+
"It is recommended to run the cluster and the external Slurmdbd in a trusted network.",
210+
FailureLevel.WARNING,
211+
)

cli/tests/pcluster/validators/test_cluster_validators.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
CustomSlurmSettingLevel,
9090
CustomSlurmSettingsIncludeFileOnlyValidator,
9191
CustomSlurmSettingsValidator,
92+
ExternalSlurmdbdTrafficNotEncrypted,
9293
ExternalSlurmdbdVsDatabaseIncompatibility,
9394
SlurmNodePrioritiesWarningValidator,
9495
)
@@ -380,6 +381,24 @@ def test_external_slurmdbd_vs_database_incompatibility_validator(database, exter
380381
assert_failure_messages(actual_failures, expected_message)
381382

382383

384+
@pytest.mark.parametrize(
385+
"external_slurmdbd, expected_message",
386+
[
387+
pytest.param(None, None),
388+
pytest.param(
389+
ExternalSlurmdbd(
390+
host="test.slurmdbd.host",
391+
port=6819,
392+
),
393+
"Traffic between ParallelCluster and the external Slurmdbd is not encrypted",
394+
),
395+
],
396+
)
397+
def test_external_slurmdbd_traffic_not_encrypted_validator(external_slurmdbd, expected_message):
398+
actual_failures = ExternalSlurmdbdTrafficNotEncrypted().execute(external_slurmdbd)
399+
assert_failure_messages(actual_failures, expected_message)
400+
401+
383402
@pytest.mark.parametrize(
384403
"queue_name, compute_resources, expected_message",
385404
[

0 commit comments

Comments
 (0)