cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE policymap [ |
| 3 | <!ELEMENT policymap (policy)+> |
| 4 | <!ELEMENT policy (#PCDATA)> |
| 5 | <!ATTLIST policy domain (delegate|coder|filter|path|resource) #IMPLIED> |
| 6 | <!ATTLIST policy name CDATA #IMPLIED> |
| 7 | <!ATTLIST policy rights CDATA #IMPLIED> |
| 8 | <!ATTLIST policy pattern CDATA #IMPLIED> |
| 9 | <!ATTLIST policy value CDATA #IMPLIED> |
| 10 | ]> |
| 11 | <!-- |
cristy | 1ca3eb3 | 2009-10-15 18:41:54 +0000 | [diff] [blame] | 12 | Configure ImageMagick policies. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 13 | |
cristy | 7ce14bc | 2010-01-17 00:01:01 +0000 | [diff] [blame] | 14 | Domains include system, delegate, coder, filter, path, or resource. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 15 | |
| 16 | Rights include none, read, write, and execute. Use | to combine them, |
| 17 | for example: "read | write" to permit read from, or write to, a path. |
| 18 | |
| 19 | Use a glob expression as a pattern. |
| 20 | |
| 21 | Suppose we do not want users to process MPEG video images: |
| 22 | |
| 23 | <policy domain="delegate" rights="none" pattern="mpeg:decode" /> |
| 24 | |
| 25 | Here we do not want users reading images from HTTP: |
| 26 | |
| 27 | <policy domain="coder" rights="none" pattern="HTTP" /> |
| 28 | |
| 29 | Lets prevent users from executing any image filters: |
| 30 | |
| 31 | <policy domain="filter" rights="none" pattern="*" /> |
| 32 | |
cristy | 3d2342a | 2011-05-16 00:14:21 +0000 | [diff] [blame] | 33 | The /repository file system is restricted to read only. We use a glob |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 34 | expression to match all paths that start with /repository: |
cristy | a86d361 | 2012-12-14 14:47:26 +0000 | [diff] [blame] | 35 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 36 | <policy domain="path" rights="read" pattern="/repository/*" /> |
| 37 | |
| 38 | Any large image is cached to disk rather than memory: |
| 39 | |
cristy | 099a735 | 2011-11-09 14:31:35 +0000 | [diff] [blame] | 40 | <policy domain="resource" name="area" value="1GB"/> |
cristy | 652316c | 2010-11-23 13:49:46 +0000 | [diff] [blame] | 41 | |
cristy | 78fe9ee | 2014-12-21 23:24:10 +0000 | [diff] [blame] | 42 | Define arguments for the memory, map, area, width, height and disk resources |
| 43 | with SI prefixes (.e.g 100MB). In addition, resource policies are maximums |
| 44 | for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB |
cristy | 207d6a6 | 2012-03-03 01:19:16 +0000 | [diff] [blame] | 45 | exceeds policy maximum so memory limit is 1GB). |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 46 | --> |
| 47 | <policymap> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 48 | <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> --> |
cristy | bdf5e0e | 2010-11-23 13:55:08 +0000 | [diff] [blame] | 49 | <!-- <policy domain="resource" name="memory" value="2GiB"/> --> |
| 50 | <!-- <policy domain="resource" name="map" value="4GiB"/> --> |
cristy | 327f591 | 2015-01-03 18:43:18 +0000 | [diff] [blame] | 51 | <!-- <policy domain="resource" name="width" value="10MP"/> --> |
| 52 | <!-- <policy domain="resource" name="height" value="10MP"/> --> |
cristy | 099a735 | 2011-11-09 14:31:35 +0000 | [diff] [blame] | 53 | <!-- <policy domain="resource" name="area" value="1GB"/> --> |
| 54 | <!-- <policy domain="resource" name="disk" value="16EB"/> --> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 55 | <!-- <policy domain="resource" name="file" value="768"/> --> |
cristy | 85c50a3 | 2010-11-23 13:59:34 +0000 | [diff] [blame] | 56 | <!-- <policy domain="resource" name="thread" value="4"/> --> |
cristy | 6ebe97c | 2010-07-03 01:17:28 +0000 | [diff] [blame] | 57 | <!-- <policy domain="resource" name="throttle" value="0"/> --> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 58 | <!-- <policy domain="resource" name="time" value="3600"/> --> |
cristy | a38bc6c | 2013-01-08 16:50:44 +0000 | [diff] [blame] | 59 | <!-- <policy domain="system" name="precision" value="6"/> --> |
cristy | b7516c0 | 2013-01-14 13:58:17 +0000 | [diff] [blame] | 60 | <policy domain="cache" name="shared-secret" value="passphrase"/> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 61 | </policymap> |