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.

55 lines
1.6 KiB

  1. ---
  2. # Ce role permet de deployer des fichiers de configurations SSH n'utilisant que des
  3. # algorithmes consideres comme sur, notamment bases sur les courbes elliptiques.
  4. # Adaptation de https://blog.arnaudminable.net/secure-shell-mon-amour-dechu/
  5. # WARN : peut poser des problemes de compatibilites avec les vieux SSH (< 6.7)
  6. - name: Import OS variables
  7. include_vars: "{{ ansible_os_family }}.yml"
  8. tags:
  9. - ssh-curve
  10. - name: upload sshd_config
  11. template:
  12. src: sshd_config.j2
  13. dest: /etc/ssh/sshd_config
  14. backup: yes
  15. tags:
  16. - ssh-curve
  17. notify: restart ssh
  18. - name: upload ssh_config (for client connexion)
  19. copy:
  20. src: ssh_config
  21. dest: /etc/ssh/ssh_config
  22. backup: yes
  23. tags:
  24. - ssh-curve
  25. notify: restart ssh
  26. - name: remove obsoletes rsa and dsa keys - WARN! This WILL cause BREAKING ATTEMPT messages
  27. file:
  28. path: "{{ item }}"
  29. state: absent
  30. tags:
  31. - ssh-curve
  32. with_items:
  33. - /etc/ssh/ssh_host_ecdsa_key
  34. - /etc/ssh/ssh_host_ecdsa_key.pub
  35. - /etc/ssh/ssh_host_rsa_key
  36. - /etc/ssh/ssh_host_rsa_key.pub
  37. - /etc/ssh/ssh_host_ed25519_key
  38. - /etc/ssh/ssh_host_ed25519_key.pub
  39. notify: restart ssh
  40. - name: regenerate sshd ed25519 key to avoid cloudinit identikey problem
  41. command: ssh-keygen -q -N "" -C "" -o -a 1000 -t ed25519 -f "/etc/ssh/ssh_host_ed25519_key"
  42. tags:
  43. - ssh-curve
  44. notify: restart ssh
  45. - name: generate a secure ed25519 key you could ssh-copy to other servers (do not overwrite existing key by default)
  46. command: ssh-keygen -t ed25519 -o -a 1000 -C "" -N "" -q -f "/root/.ssh/id_ed25519"
  47. ignore_errors: yes
  48. tags:
  49. - ssh-curve