Patching BADLOCK with Ansible

If you've been following recent security news, you may have heard of the Badlock vulnerability in the protocols used by the Microsoft Windows Active Directory infrastructure. This vulnerability could lead to a man-in-the-middle attacker intercepting traffic between a client and the Active Directory server, and then impersonating the client, gaining unauthorized access to resources.
| |
More information can be found at http://badlock.org/ and the Red Hat Knowledgebase. |
Thanks to Ansible, however, patching your systems doesn't have to be complicated.
- hosts: all
gather_facts: true
become_method: sudo
become_user: root
vars:
service_name:
'Debian': 'smbd'
'RedHat': 'smb'
tasks:
- name: check samba version
shell: dpkg -l | grep -q samba
when: ansible_os_family == 'Debian'
register: samba_installed
ignore_errors: True
- name: update samba from apt if installed
apt:
name: samba
state: latest
update_cache: yes
when: ansible_os_family == 'Debian' and samba_installed.rc == 0
notify: restart_samba
- name: check samba version
shell: rpm -q samba
when: ansible_os_family == 'RedHat'
register: samba_installed
ignore_errors: True
- name: update samba from yum if installed
yum:
name: samba
state: latest
update_cache: yes
when: ansible_os_family == 'RedHat' and samba_installed.rc == 0
notify: restart_samba
handlers:
- name: restart_samba
service:
name: "{{ Continue reading


Another, similar, line of thinking came up at the mic during a discussion around whether 
