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

Access To /runner/.ssh Is Prevented With MacOS and Docker Desktop #1592

Open
timway opened this issue Aug 8, 2023 · 0 comments
Open

Access To /runner/.ssh Is Prevented With MacOS and Docker Desktop #1592

timway opened this issue Aug 8, 2023 · 0 comments
Labels
bug Researched, reproducible, committed to fix

Comments

@timway
Copy link
Contributor

timway commented Aug 8, 2023

ISSUE TYPE
  • Bug Report
SUMMARY

When running on MacOS with Docker Desktop the .ssh directory from outside the container is bind mounted into the container. The user is set for the container to the UID outside the container. This prevents using SSH keys that are not passphrase protected inside the container.

ANSIBLE-NAVIGATOR VERSION
% ansible-navigator --version
ansible-navigator 3.4.0
CONFIGURATION

No additional configuration

LOG FILE
STEPS TO REPRODUCE
  • Using MacOS, Python provided by MacOS, Ansible Navigator installed
  • Configure a target machine with SSH key based authentication not using a key with a passphrase
  • Try to use ansible-navigator
EXPECTED RESULTS

The container has access to the hosts $HOME/.ssh

ACTUAL RESULTS
% ansible-navigator exec bash
bash-5.2$ ls $HOME/.ssh
ls: cannot access '/runner/.ssh': No such file or directory
bash-5.2$ id -a
uid=501(501) gid=0(root) groups=0(root)
ADDITIONAL INFORMATION

It seems the container runtime is checked in the code to see if it is Podman. If so then it runs as root inside the container. Presumably this is assumed it's Podman running as a non-privileged user outside the container although it doesn't appear to check the UID of the user starting the runtime so this might be dubious as well.

I'm not sure what the best answer is for this problem because the project files are bind mounted as well into the container. I did test with:

---
ansible-navigator:
  execution-environment:
    container-options:
      - --user=root

Using those options everything worked will inside the container, it could access the /runner/.ssh directory. Files created in the project directory during execution within the container are mapped back out as the UID of the user outside of the container by Docker Desktop despite being root inside the container (similar to sub-uid behavior in user mode Podman).

@timway timway added bug Researched, reproducible, committed to fix new New issues and PRs to triaged labels Aug 8, 2023
@shatakshiiii shatakshiiii removed the new New issues and PRs to triaged label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Researched, reproducible, committed to fix
Projects
Status: No status
Development

No branches or pull requests

2 participants