Skip to content

Commit 1ab1ed5

Browse files
authored
Fix broken password-based SSH (#1013)
Fix broken password-based SSH Fallout from the recent changes in #999. I came up with the solution here after piecing together info in comments from @sivel and @jborean93. (thanks!) Users who tried to use SSH w/ a login password were seeing: <ec2-44-203-148-21.compute-1.amazonaws.com> SSH: EXEC sshpass -d8 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="testuser"' -o ConnectTimeout=10 -o ControlPath=/var/lib/awx/.ansible/cp/6abb5dc2c2 ec2-44-203-148-21.compute-1.amazonaws.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1646413970.94-16-215594703579950 `" && echo ansible-tmp-1646413970.94-16-215594703579950="` echo ~/.ansible/tmp/ansible-tmp-1646413970.94-16-215594703579950 `" ) && sleep 0'"'"'' <ec2-44-203-148-21.compute-1.amazonaws.com> (3, '', "Failed to change pseudo terminal's permission: Operation not permitted\n") <ec2-44-203-148-21.compute-1.amazonaws.com> Failed to connect to the host via ssh: Failed to change pseudo terminal's permission: Operation not permitted ec2-44-203-148-21.compute-1.amazonaws.com | UNREACHABLE! => { "changed": false, "msg": "Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo ~/.ansible/tmp/ansible-tmp-1646413970.94-16-215594703579950 `\" && echo ansible-tmp-1646413970.94-16-215594703579950=\"` echo ~/.ansible/tmp/ansible-tmp-1646413970.94-16-215594703579950 `\" ), exited with result 3", "unreachable": true } Critical part being Failed to change pseudo terminal's permission: Operation not permitted. Reviewed-by: David Shrewsbury <None>
1 parent 47101a9 commit 1ab1ed5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ansible_runner/config/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def wrap_args_for_sandbox(self, args):
339339
new_args.extend([
340340
'--die-with-parent',
341341
'--unshare-pid',
342-
'--dev', '/dev',
342+
'--dev-bind', '/dev', 'dev',
343343
'--proc', '/proc',
344344
'--dir', '/tmp',
345345
'--ro-bind', '/bin', '/bin',

test/unit/config/test_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def test_bwrap_process_isolation_defaults(mocker):
563563
'bwrap',
564564
'--die-with-parent',
565565
'--unshare-pid',
566-
'--dev', '/dev',
566+
'--dev-bind', '/dev', 'dev',
567567
'--proc', '/proc',
568568
'--dir', '/tmp',
569569
'--ro-bind', '/bin', '/bin',
@@ -616,7 +616,7 @@ def isfile(self, path):
616616
'bwrap',
617617
'--die-with-parent',
618618
'--unshare-pid',
619-
'--dev', '/dev',
619+
'--dev-bind', '/dev', 'dev',
620620
'--proc', '/proc',
621621
'--dir', '/tmp',
622622
'--ro-bind', '/bin', '/bin',
@@ -654,7 +654,7 @@ def test_process_isolation_settings(mocker, tmp_path):
654654
'not_bwrap',
655655
'--die-with-parent',
656656
'--unshare-pid',
657-
'--dev', '/dev',
657+
'--dev-bind', '/dev', 'dev',
658658
'--proc', '/proc',
659659
'--dir', '/tmp',
660660
'--ro-bind', '/bin', '/bin',

0 commit comments

Comments
 (0)