Skip to content

Commit

Permalink
User per-guest SSH master sockets to prevent re-use (#3127)
Browse files Browse the repository at this point in the history
It seems that under some conditions, using same socket path for SSH
master processes may lead to SSH commands to operate over incorrect and
unexpected guest without noticing. Using per-guest paths should prevent
such a race condition.

The problem was revealed by `/tests/prepare/multihost` test constantly
and reliably failing in Github CI, as all `prepare` phases were
connecting to the very same guest.
  • Loading branch information
happz authored Aug 3, 2024
1 parent 8b0c508 commit d549bd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tmt/steps/provision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ def _ssh_master_socket_path(self) -> Path:
# Use '/run/user/uid' if it exists, 'temp dir' otherwise.
run_dir = Path(f"/run/user/{os.getuid()}")
socket_dir = run_dir if run_dir.is_dir() else Path(tempfile.mkdtemp())
return socket_dir / "tmt"
return socket_dir / f'tmt-{self.pathless_safe_name}'

@property
def _ssh_options(self) -> Command:
Expand Down

0 comments on commit d549bd3

Please sign in to comment.