pygmystack / pygmy

the pygmy stack is a container stack for local development
MIT License
25 stars 13 forks source link

Request for example custom ssh agent integration #177

Closed fubarhouse closed 3 years ago

fubarhouse commented 4 years ago

Background

Everything should be fundamentally controllable and replaceable, and it is not.

Implementation

An example of an integration with another ssh agent can be found here:

fubarhouse commented 4 years ago

Warning: The following configuration is for an uncommitted version of the master branch associated to issue #161 - it will not work yet, and this snippet will be updated accordingly.

Also note that amazeeio/ssh-agent comes with Windows support unlike probably most similar solutions - this one does not and will not work on windows without extra effort.

Also note that this demonstrates the three purposes of ssh containers where the label is represented by pygmy.purpose of sshagent, addkeys or showkeys which are very special attributes with additional flow control and targeting. Changing the ssh agent is considered advanced so try not to deviate from defaults or the following after #161 is resolved.

services:
  unofficial-ssh-agent:
    Config:
      Cmd:
        - ssh-agent
      Env:
        - "SSH_AUTH_SOCK=/.ssh-agent/socket"
      Image: nardeas/ssh-agent
      Labels:
        - pygmy.name: unofficial-ssh-agent
        - pygmy.enable: true
        - pygmy.output: false
        - pygmy.purpose: sshagent
        - pygmy.weight:  30
    HostConfig:
      AutoRemove: false
      IpcMode: private
      RestartPolicy:
        Name: always
        MaximumRetryCount: 0

  unofficial-ssh-agent-add-key:
    Config:
      Image: nardeas/ssh-agent
      Labels:
        - pygmy.name: unofficial-ssh-agent-add-key
        - pygmy.enable: true
        - pygmy.discrete: true
        - pygmy.output:  true
        - pygmy.purpose: addkeys
        - pygmy.weight: 31
    HostConfig:
      AutoRemove: true
      IpcMode: private
      VolumesFrom:
        - unofficial-ssh-agent

  unofficial-ssh-agent-show-keys:
    Config:
      Cmd:
        - ssh-add
        - -l
      Image: nardeas/ssh-agent
      Labels:
        - pygmy.name: unofficial-ssh-agent-show-keys
        - pygmy.enable: true
        - pygmy.discrete: true
        - pygmy.output: true
        - pygmy.purpose: showkeys
        - pygmy.weight: 32
    HostConfig:
      AutoRemove: true
      VolumesFrom:
        - unofficial-ssh-agent