| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
<!-- |
| 4 |
Sample definitions for restricting the access to the Jolokia agent. Adapt this |
| 5 |
file and copy it over to 'jolokia-access.xml', which get's evaluated during |
| 6 |
runtime (if included in the war). |
| 7 |
|
| 8 |
You can restrict the available methods in principale as well as the accessible |
| 9 |
attributes and operations in detail. |
| 10 |
--> |
| 11 |
|
| 12 |
<restrict> |
| 13 |
|
| 14 |
<!-- List of remote hosts which are allowed to access this agent. The name can be |
| 15 |
given as IP or FQDN. If any of the given hosts matches, access will be allowed |
| 16 |
(respecting further restrictions, though). If <remote> ... </remote> is given |
| 17 |
without any host no access is allowed at all (probably not what you want). |
| 18 |
|
| 19 |
You can also specify a subnetmask behind a numeric IP adress in which case any |
| 20 |
host within the specified subnet is allowed to access the agent. The netmask can |
| 21 |
be given either in CIDR format (e.g "/16") or as a full netmask (e.g. "/255.255.0.0") |
| 22 |
--> |
| 23 |
<!-- |
| 24 |
<remote> |
| 25 |
<host>127.0.0.1</host> |
| 26 |
<host>localhost</host> |
| 27 |
<host>10.0.0.0/16</host> |
| 28 |
</remote> |
| 29 |
--> |
| 30 |
|
| 31 |
<!-- |
| 32 |
List of allowed commands. |
| 33 |
|
| 34 |
If this sections is present, it influence the following section. |
| 35 |
|
| 36 |
For each command type present, the principle behaviour is allow this command for all |
| 37 |
MBeans. To remove an MBean (attribute/operation), a <deny> section has to be added. |
| 38 |
|
| 39 |
For each comman type missing, the command is disabled by default. For certain MBeans |
| 40 |
it can be selectively by enabled by using an <allow> section below |
| 41 |
|
| 42 |
Known types are: |
| 43 |
|
| 44 |
* read |
| 45 |
* write |
| 46 |
* exec |
| 47 |
* list |
| 48 |
* version |
| 49 |
* search |
| 50 |
|
| 51 |
A missing <commands> section implies that every operation type is allowed (and can |
| 52 |
be selectively controlled by a <deny> section) |
| 53 |
--> |
| 54 |
|
| 55 |
<commands> |
| 56 |
<command>read</command> |
| 57 |
<command>write</command> |
| 58 |
<command>exec</command> |
| 59 |
<command>list</command> |
| 60 |
<command>version</command> |
| 61 |
<command>search</command> |
| 62 |
</commands> |
| 63 |
|
| 64 |
|
| 65 |
<!-- |
| 66 |
Restrict access only via the specified methods |
| 67 |
|
| 68 |
Example which allows only POST requests: |
| 69 |
<http> |
| 70 |
<method>post</method> |
| 71 |
</http> |
| 72 |
--> |
| 73 |
|
| 74 |
<!-- |
| 75 |
Cross origin protection (CORS). |
| 76 |
|
| 77 |
You can configure which cross origins are given allowance by the browser. |
| 78 |
With strict-checking, the Origin: header can be also be checked on the server side, |
| 79 |
which results in an error if it doesn't match any specified pattern. |
| 80 |
--> |
| 81 |
|
| 82 |
<!-- |
| 83 |
Example which allows access from www.jolokia.org and the domain jmx4perl.org for CORS |
| 84 |
but does also server side check to prevent CSRF attacks: |
| 85 |
|
| 86 |
<cors> |
| 87 |
<allow-origin>http://www.jolokia.org</allow-origin> |
| 88 |
<allow-origin>*://*.jmx4perl.org</allow-origin> |
| 89 |
|
| 90 |
<strict-checking/> |
| 91 |
</cors> |
| 92 |
--> |
| 93 |
|
| 94 |
<!-- For each command type missing in a given <commands> section, for certain MBeans (which |
| 95 |
can be a pattern, too) an command be allowed. Note that an <allow> entry e.g. for reading |
| 96 |
an attribute of an certain MBean has no influence if reading is enabled globally anyway --> |
| 97 |
<allow> |
| 98 |
|
| 99 |
<!-- Allow for this MBean the attribute "HeapMemoryUsage" for reading and writing, the attribute |
| 100 |
"Verbose" for reading only and the operation "gc". "read", "write" and/or "exec" has to be omitted |
| 101 |
in the <commands> section above. |
| 102 |
|
| 103 |
Example: -> |
| 104 |
<mbean> |
| 105 |
<name>java.lang:type=Memory</name> |
| 106 |
<attribute>HeapMemoryUsage</attribute> |
| 107 |
<attribute mode="read">Verbose</attribute> |
| 108 |
<operation>gc</operation> |
| 109 |
</mbean> |
| 110 |
<mbean> |
| 111 |
<name>java.lang:type=Threading</name> |
| 112 |
<attribute>ThreadCount</attribute> |
| 113 |
</mbean> |
| 114 |
--> |
| 115 |
|
| 116 |
<!-- Allow access to the j4p configuration operations, which are needed for proper check_jmx4perl |
| 117 |
operation --> |
| 118 |
<mbean> |
| 119 |
<name>jolokia:type=Config</name> |
| 120 |
<operation>*</operation> |
| 121 |
<attribute>*</attribute> |
| 122 |
</mbean> |
| 123 |
<mbean> |
| 124 |
<name>java.lang:type=Threading</name> |
| 125 |
<operation>findDeadlockedThreads</operation> |
| 126 |
</mbean> |
| 127 |
</allow> |
| 128 |
|
| 129 |
<!-- MBean access can be restricted by a <deny> section for commands enabled in a <commands> section |
| 130 |
(or when the <commands> section is missing completely in which case all commands are allowed) |
| 131 |
--> |
| 132 |
<deny> |
| 133 |
<mbean> |
| 134 |
<!-- Exposes user/password of data source, so we forbid this one --> |
| 135 |
<name>com.mchange.v2.c3p0:type=PooledDataSource,*</name> |
| 136 |
<attribute>properties</attribute> |
| 137 |
</mbean> |
| 138 |
</deny> |
| 139 |
</restrict> |
| 140 |
|
| 141 |
<!-- |
| 142 |
~ Copyright 2009-2014 Roland Huss |
| 143 |
~ |
| 144 |
~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 145 |
~ you may not use this file except in compliance with the License. |
| 146 |
~ You may obtain a copy of the License at |
| 147 |
~ |
| 148 |
~ http://www.apache.org/licenses/LICENSE-2.0 |
| 149 |
~ |
| 150 |
~ Unless required by applicable law or agreed to in writing, software |
| 151 |
~ distributed under the License is distributed on an "AS IS" BASIS, |
| 152 |
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 153 |
~ See the License for the specific language governing permissions and |
| 154 |
~ limitations under the License. |
| 155 |
--> |
| 156 |
|