Created
May 11, 2016 07:06
-
-
Save loftux/b99870569c5fa60694438e2007683f1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# ------- | |
# Script to patch for Imagetragick | |
# | |
# Copyright 2013-2016 Loftux AB, Peter Löfgren | |
# Distributed under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC BY-SA 3.0) | |
# ------- | |
IMAGEMAGICKPOLICYFILE="/etc/ImageMagick/policy.xml" | |
if [ -f "$IMAGEMAGICKPOLICYFILE" ]; then | |
if grep -q "rights=\"none\" pattern=\"EPHEMERAL\"" "$IMAGEMAGICKPOLICYFILE"; then | |
echo "The policy file looks like it already contains the patch: $IMAGEMAGICKPOLICYFILE" | |
else | |
sudo sed -i '/<policymap>/a \ | |
<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" />' $IMAGEMAGICKPOLICYFILE | |
echo "Patched file: $IMAGEMAGICKPOLICYFILE" | |
fi | |
else | |
echo "Could not find file to patch: $IMAGEMAGICKPOLICYFILE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment