Playbook Ansible pour configurer Initramfs Dropbear pour le déchiffrement LUKS via SSH
L’application de ce playbook installe Dropbear dans Initramfs.
Assurez-vous d’avoir une ou plusieurs clés RSA dans luks-dropbear-authorized_keys.pub dans le même répertoire que ce playbook.. Les clés Ed25519 ne sont pas supportées par Dropbear pour le moment.
initramfs_dropbear_playbook.yml
---
- name: Configure remote LUKS unlocking with Dropbear
hosts: all
become: true
vars:
dropbear_auth_keys_path: /etc/dropbear/initramfs/authorized_keys
tasks:
- name: Installer les paquets requis
apt:
name:
- cryptsetup
- dropbear
- dropbear-initramfs
- dropbear-bin
state: present
update_cache: yes
register: apt_install_result
- name: S'assurer que le répertoire Dropbear initramfs existe
file:
path: /etc/dropbear/initramfs
state: directory
mode: '0755'
- name: Copier la clé publique SSH vers Dropbear authorized_keys
copy:
src: luks-dropbear-authorized_keys.pub
dest: "{{ dropbear_auth_keys_path }}"
mode: '0600'
register: auth_keys_result
- name: Reconfigurer Dropbear initramfs
shell: dpkg-reconfigure dropbear-initramfs
when: apt_install_result.changed or auth_keys_result.changed
- name: Mettre à jour initramfs
shell: update-initramfs -u
when: apt_install_result.changed or auth_keys_result.changedCheck out similar posts by category:
Ansible, Linux, Cryptography
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow