def fix_ssh(container, host=nil)
      @logger.debug("Fixing ssh on container #{container.id}")
      container.exec(['sed','-ri',
                      's/^#?PermitRootLogin .*/PermitRootLogin yes/',
                      '/etc/ssh/sshd_config'])
      container.exec(['sed','-ri',
                      's/^#?PasswordAuthentication .*/PasswordAuthentication yes/',
                      '/etc/ssh/sshd_config'])
      container.exec(['sed','-ri',
                      's/^#?UseDNS .*/UseDNS no/',
                      '/etc/ssh/sshd_config'])
      # Make sure users with a bunch of SSH keys loaded in their keyring can
      # still run tests
      container.exec(['sed','-ri',
                     's/^#?MaxAuthTries.*/MaxAuthTries 1000/',
                     '/etc/ssh/sshd_config'])

      if host
        if host['platform'] =~ /alpine/
          container.exec(%w(/usr/sbin/sshd))
        else
          container.exec(%w(service ssh restart))
        end
      end
    end
def fix_ssh(container, host=nil)
      @logger.debug("Fixing ssh on container #{container.id}")
      container.exec(['sed','-ri',
                      's/^#?PermitRootLogin .*/PermitRootLogin yes/',
                      '/etc/ssh/sshd_config'])
      container.exec(['sed','-ri',
                      's/^#?PasswordAuthentication .*/PasswordAuthentication yes/',
                      '/etc/ssh/sshd_config'])
      container.exec(['sed','-ri',
                      's/^#?UseDNS .*/UseDNS no/',
                      '/etc/ssh/sshd_config'])
      # Make sure users with a bunch of SSH keys loaded in their keyring can
      # still run tests
      container.exec(['sed','-ri',
                     's/^#?MaxAuthTries.*/MaxAuthTries 1000/',
                     '/etc/ssh/sshd_config'])

      if host
        if host['platform'] =~ /alpine/
          container.exec(%w(/usr/sbin/sshd))
        else
          container.exec(%w(service ssh restart))
        end
      end
    end
a puppet run may have changed the ssh config which would
 keep us out of the container.  This is a best effort to fix it.
 Optionally pass in a host object to to determine which ssh
 restart command we should try.