You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

  1. FROM qmkfm/qmk_cli
  2. # Basic upgrades; install sudo and SSH.
  3. RUN apt-get update && apt-get install --no-install-recommends -y \
  4. sudo \
  5. openssh-server \
  6. && rm -rf /var/lib/apt/lists/*
  7. RUN mkdir /var/run/sshd
  8. RUN sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
  9. RUN echo 'UseDNS no' >> /etc/ssh/sshd_config
  10. # Remove the policy file once we're finished installing software.
  11. # This allows invoke-rc.d and friends to work as expected.
  12. RUN rm /usr/sbin/policy-rc.d
  13. # Add the Vagrant user and necessary passwords.
  14. RUN groupadd vagrant
  15. RUN useradd -c "Vagrant" -g vagrant -d /home/vagrant -m -s /bin/bash vagrant
  16. RUN echo 'root:vagrant' | chpasswd
  17. RUN echo 'vagrant:vagrant' | chpasswd
  18. # Allow the vagrant user to use sudo without a password.
  19. RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant
  20. # Install Vagrant's insecure public key so provisioning and 'vagrant ssh' work.
  21. RUN mkdir /home/vagrant/.ssh
  22. ADD https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys
  23. RUN chmod 0600 /home/vagrant/.ssh/authorized_keys
  24. RUN chown -R vagrant:vagrant /home/vagrant/.ssh
  25. RUN chmod 0700 /home/vagrant/.ssh
  26. EXPOSE 22
  27. CMD ["/usr/sbin/sshd", "-D"]