Last active
June 6, 2016 08:51
-
-
Save theqwan-chengwei/d298459244a1f006ec67072d177e37ff to your computer and use it in GitHub Desktop.
ImageTragick (CVE-2016–3714). use ansible update policy file to disable the vulnerable ImageMagick coders.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: check ImageMagick folder exists | |
stat: | |
path: /etc/ImageMagick | |
register: check_imagemagick_folder_exists | |
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
- name: apt-get update imagemagick 8:6.7.7.10-6ubuntu3.1 | |
apt: pkg={{ item }} state=latest | |
when: (check_imagemagick_folder_exists.stat.exists == true) | |
with_items: | |
- imagemagick | |
- imagemagick-common | |
- libmagickcore5 | |
- libmagickcore5-extra | |
- libmagickwand5 | |
- name: comment policymap | |
lineinfile: | |
dest: /etc/ImageMagick/policy.xml | |
backrefs: yes | |
regexp: "^{{ item }}" | |
line: "<!-- {{ item }} -->" | |
when: (check_imagemagick_folder_exists.stat.exists == true) | |
with_items: | |
- ' <policy domain="coder" rights="none" pattern="EPHEMERAL" />' | |
- ' <policy domain="coder" rights="none" pattern="URL" />' | |
- ' <policy domain="coder" rights="none" pattern="HTTPS" />' | |
- ' <policy domain="coder" rights="none" pattern="MVG" />' | |
- ' <policy domain="coder" rights="none" pattern="MSL" />' | |
- ' <policy domain="coder" rights="none" pattern="TEXT" />' | |
- ' <policy domain="coder" rights="none" pattern="SHOW" />' | |
- ' <policy domain="coder" rights="none" pattern="WIN" />' | |
- ' <policy domain="coder" rights="none" pattern="PLT" />' | |
- ' <policy domain="path" rights="none" pattern="@\*" />' | |
- '</policymap>' | |
- name: add policymap | |
lineinfile: > | |
dest=/etc/ImageMagick/policy.xml | |
insertafter=EOF | |
line={{ item }} | |
when: (check_imagemagick_folder_exists.stat.exists == true) | |
with_items: | |
- ' <policy domain="coder" rights="none" pattern="EPHEMERAL" />' | |
- ' <policy domain="coder" rights="none" pattern="URL" />' | |
- ' <policy domain="coder" rights="none" pattern="HTTPS" />' | |
- ' <policy domain="coder" rights="none" pattern="MVG" />' | |
- ' <policy domain="coder" rights="none" pattern="MSL" />' | |
- ' <policy domain="coder" rights="none" pattern="TEXT" />' | |
- ' <policy domain="coder" rights="none" pattern="SHOW" />' | |
- ' <policy domain="coder" rights="none" pattern="WIN" />' | |
- ' <policy domain="coder" rights="none" pattern="PLT" />' | |
- ' <policy domain="path" rights="none" pattern="@*" />' | |
- '</policymap>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ubuntu 14.04 - fix (2016-06-0)
https://launchpad.net/ubuntu/+source/imagemagick/8:6.7.7.10-6ubuntu3.1