geerlingguy/ansible-role-ssh-chroot-jail

Use systemd-tmpfiles to create devices on boot

cognifloyd opened this issue · 6 comments

mknod does not create persistent devices. To make a chroot that will survive a reboot, we also need a task like this (template inlined into a copy task to be succinct):

- name: Add chroot devices
  copy:
    content: |
      c {{ ssh_chroot_directory }}/dev/null 0666 root root - 1:3
      c {{ ssh_chroot_directory }}/dev/random 0666 root root - 5:0
      c {{ ssh_chroot_directory }}/dev/urandom 0666 root root - 1:5
      c {{ ssh_chroot_directory }}/dev/zero 0666 root root - 1:8
    dest: /etc/tmpfiles.d/ssh-chroot.conf
  notify: systemd-tmpfiles

with this handler.

- name: systemd-tmpfiles
  become: yes
  command: "systemd-tmpfiles --create /etc/tmpfiles.d/ssh-chroot.conf"

These could replace the mknod task.

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

What is needed to merge #28?

stale commented

This issue is no longer marked for closure.

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

What is needed to merge #28?

stale commented

This issue is no longer marked for closure.