Skip to content

Instantly share code, notes, and snippets.

@jondlm
Created September 26, 2014 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondlm/3bcce92083e8bb183a8b to your computer and use it in GitHub Desktop.
Save jondlm/3bcce92083e8bb183a8b to your computer and use it in GitHub Desktop.
ShellShock fix Ansible playbook for CentOS
- hosts: all
gather_facts: false
sudo: true
tasks:
- name: check for shellshock bash vulnerability
shell: executable=/bin/bash env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
register: test_vuln
- name: update bash from yum if vulnerable
yum: name=bash
state=latest
when: "'vulnerable' in test_vuln.stdout"
- name: Check again and fail if we are still vulnerable
shell: executable=/bin/bash env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
when: "'vulnerable' in test_vuln.stdout"
register: test_vuln
failed_when: "'vulnerable' in test_vuln.stdout"
@jondlm
Copy link
Author

jondlm commented Sep 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment