No Description
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.

security.yml 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. - name: Install security-related packages
  2. apt:
  3. name: "{{ packages }}"
  4. state: present
  5. vars:
  6. packages:
  7. - whois
  8. - lynis
  9. - rkhunter
  10. tags:
  11. - dependencies
  12. - name: add stretch-backport for fail2ban with IPv6 support
  13. apt_repository: repo='deb http://deb.debian.org/debian stretch-backports main' state=present update_cache=yes
  14. tags:
  15. - dependencies
  16. when: ansible_distribution_version == '9'
  17. - name: Install newer fail2ban with IPv6 support
  18. apt:
  19. name: "fail2ban"
  20. state: present
  21. default_release: stretch-backports
  22. tags:
  23. - dependencies
  24. when: ansible_distribution_version == '9'
  25. - name: Install fail2ban
  26. apt:
  27. name: "fail2ban"
  28. state: present
  29. tags:
  30. - dependencies
  31. when: ansible_distribution_version == '10'
  32. - name: Install fail2ban
  33. apt:
  34. name: "fail2ban"
  35. state: present
  36. tags:
  37. - dependencies
  38. when: ansible_distribution_version == '11'
  39. - name: Copy fail2ban configuration into place
  40. template: src=etc_fail2ban_jail.local.j2 dest=/etc/fail2ban/jail.local
  41. notify: restart fail2ban
  42. - name: Copy fail2ban dovecot configuration into place
  43. copy: src=etc_fail2ban_filter.d_dovecot-pop3imap.conf dest=/etc/fail2ban/filter.d/dovecot-pop3imap.conf
  44. notify: restart fail2ban
  45. - name: Ensure fail2ban is started
  46. service: name=fail2ban state=started
  47. - name: Update sshd config for PFS and more secure defaults
  48. template: src=etc_ssh_sshd_config.j2 dest=/etc/ssh/sshd_config
  49. notify: restart ssh
  50. - name: Update ssh config for more secure defaults
  51. template: src=etc_ssh_ssh_config.j2 dest=/etc/ssh/ssh_config