Skip to content

SSH from container

Add SSH connectivity from within the get-container.

This includes facilities to create preferred Linux user to remote hosts, add SSH keys, and host details in the container.

Agent management

  • Attempt to mount the container host's SSH Agent socket, for agent pass-through (does not work with 1Password SSH Agent)
  • Verify agent and start internal SSH agent if it's not responding. Add internal SSH key as fallback
  • If installing my Radix dotfiles and bashing library to the container, also arrange to bootstrap them onto the hosts over SSH

Key management

  • Retrieves the public keys from configured user keys on gitlab.com
  • Script to generate a key-pair for the container, and echo the public key for adding, if desired
  • Ansible playbook to
    • create a Linux user on the GET hosts,
    • add the user to the sudoers
    • add the public SSH keys to enable password-less authentication
    • generate SSH configurations for the GET hosts, to simplify connection
  • ssh-fzf shell function lets one select which host to connect to using the fzf command-line fuzzy finder

Configuration

New variables in .devcontainer/get/config.yml:

  • linux_user: the username of a user to make on the host
  • gitlab_user: username of a GitLab user to retrieve public keys for
  • public_ssh: the location of the container's internal public SSH key. Default is "keys/gitlab.ssh.pub"

This facilitates using a short/friendly username to work with on the host, like "mjl" rather than the long names that cloud providers supply, such as "sa_104481838115385290889", or "mlockhart_gitlab_com". Configure which GitLab user's public keys to retrieve (i.e. use your own user, which you have the private keys for).

Closes #15 (closed)

Edited by Mike Lockhart | GitLab

Merge request reports

Loading