Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ssh host policy #4966

Merged
merged 22 commits into from
Jan 30, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add docstring
  • Loading branch information
sage-maker committed Jan 23, 2025
commit dac79c76aa7ade1b24b636bb35376812d2ba5c1e
10 changes: 10 additions & 0 deletions src/sagemaker/modules/train/container_drivers/mpi_utils.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,16 @@ def start_sshd_daemon():


class CustomHostKeyPolicy(paramiko.client.MissingHostKeyPolicy):
"""Class to handle host key policy for SageMaker distributed training SSH connections.
Example:
>>> client = paramiko.SSHClient()
>>> client.set_missing_host_key_policy(CustomHostKeyPolicy())
>>> # Will succeed for SageMaker algorithm containers
>>> client.connect('algo-1234.internal')
>>> # Will raise SSHException for other unknown hosts
>>> client.connect('unknown-host') # raises SSHException
"""

def missing_host_key(self, client, hostname, key):
"""Accept host keys for algo-* hostnames, reject others.
Loading