catalina.policy 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. // Licensed to the Apache Software Foundation (ASF) under one or more
  2. // contributor license agreements. See the NOTICE file distributed with
  3. // this work for additional information regarding copyright ownership.
  4. // The ASF licenses this file to You under the Apache License, Version 2.0
  5. // (the "License"); you may not use this file except in compliance with
  6. // the License. You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. // ============================================================================
  16. // catalina.policy - Security Policy Permissions for Tomcat 7
  17. //
  18. // This file contains a default set of security policies to be enforced (by the
  19. // JVM) when Catalina is executed with the "-security" option. In addition
  20. // to the permissions granted here, the following additional permissions are
  21. // granted to each web application:
  22. //
  23. // * Read access to the web application's document root directory
  24. // * Read, write and delete access to the web application's working directory
  25. //
  26. // $Id: catalina.policy 1220297 2011-12-17 22:55:28Z markt $
  27. // ============================================================================
  28. // ========== SYSTEM CODE PERMISSIONS =========================================
  29. // These permissions apply to javac
  30. grant codeBase "file:${java.home}/lib/-" {
  31. permission java.security.AllPermission;
  32. };
  33. // These permissions apply to all shared system extensions
  34. grant codeBase "file:${java.home}/jre/lib/ext/-" {
  35. permission java.security.AllPermission;
  36. };
  37. // These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
  38. grant codeBase "file:${java.home}/../lib/-" {
  39. permission java.security.AllPermission;
  40. };
  41. // These permissions apply to all shared system extensions when
  42. // ${java.home} points at $JAVA_HOME/jre
  43. grant codeBase "file:${java.home}/lib/ext/-" {
  44. permission java.security.AllPermission;
  45. };
  46. // ========== CATALINA CODE PERMISSIONS =======================================
  47. // These permissions apply to the daemon code
  48. grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
  49. permission java.security.AllPermission;
  50. };
  51. // These permissions apply to the logging API
  52. // Note: If tomcat-juli.jar is in ${catalina.base} and not in ${catalina.home},
  53. // update this section accordingly.
  54. // grant codeBase "file:${catalina.base}/bin/tomcat-juli.jar" {..}
  55. grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
  56. permission java.io.FilePermission
  57. "${java.home}${file.separator}lib${file.separator}logging.properties", "read";
  58. permission java.io.FilePermission
  59. "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
  60. permission java.io.FilePermission
  61. "${catalina.base}${file.separator}logs", "read, write";
  62. permission java.io.FilePermission
  63. "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
  64. permission java.lang.RuntimePermission "shutdownHooks";
  65. permission java.lang.RuntimePermission "getClassLoader";
  66. permission java.lang.RuntimePermission "setContextClassLoader";
  67. permission java.util.logging.LoggingPermission "control";
  68. permission java.util.PropertyPermission "java.util.logging.config.class", "read";
  69. permission java.util.PropertyPermission "java.util.logging.config.file", "read";
  70. permission java.util.PropertyPermission "catalina.base", "read";
  71. permission java.util.PropertyPermission
  72. "org.apache.juli.logging.UserDataHelper.CONFIG", "read";
  73. permission java.util.PropertyPermission
  74. "org.apache.juli.logging.UserDataHelper.SUPPRESSION_TIME", "read";
  75. // Note: To enable per context logging configuration, permit read access to
  76. // the appropriate file. Be sure that the logging configuration is
  77. // secure before enabling such access.
  78. // E.g. for the examples web application (uncomment and unwrap
  79. // the following to be on a single line):
  80. // permission java.io.FilePermission "${catalina.base}${file.separator}
  81. // webapps${file.separator}examples${file.separator}WEB-INF
  82. // ${file.separator}classes${file.separator}logging.properties", "read";
  83. };
  84. // These permissions apply to the server startup code
  85. grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
  86. permission java.security.AllPermission;
  87. };
  88. // These permissions apply to the servlet API classes
  89. // and those that are shared across all class loaders
  90. // located in the "lib" directory
  91. grant codeBase "file:${catalina.home}/lib/-" {
  92. permission java.security.AllPermission;
  93. };
  94. // If using a per instance lib directory, i.e. ${catalina.base}/lib,
  95. // then the following permission will need to be uncommented
  96. // grant codeBase "file:${catalina.base}/lib/-" {
  97. // permission java.security.AllPermission;
  98. // };
  99. // ========== WEB APPLICATION PERMISSIONS =====================================
  100. // These permissions are granted by default to all web applications
  101. // In addition, a web application will be given a read FilePermission
  102. // and JndiPermission for all files and directories in its document root.
  103. grant {
  104. // Required for JNDI lookup of named JDBC DataSource's and
  105. // javamail named MimePart DataSource used to send mail
  106. permission java.util.PropertyPermission "java.home", "read";
  107. permission java.util.PropertyPermission "java.naming.*", "read";
  108. permission java.util.PropertyPermission "javax.sql.*", "read";
  109. // OS Specific properties to allow read access
  110. permission java.util.PropertyPermission "os.name", "read";
  111. permission java.util.PropertyPermission "os.version", "read";
  112. permission java.util.PropertyPermission "os.arch", "read";
  113. permission java.util.PropertyPermission "file.separator", "read";
  114. permission java.util.PropertyPermission "path.separator", "read";
  115. permission java.util.PropertyPermission "line.separator", "read";
  116. // JVM properties to allow read access
  117. permission java.util.PropertyPermission "java.version", "read";
  118. permission java.util.PropertyPermission "java.vendor", "read";
  119. permission java.util.PropertyPermission "java.vendor.url", "read";
  120. permission java.util.PropertyPermission "java.class.version", "read";
  121. permission java.util.PropertyPermission "java.specification.version", "read";
  122. permission java.util.PropertyPermission "java.specification.vendor", "read";
  123. permission java.util.PropertyPermission "java.specification.name", "read";
  124. permission java.util.PropertyPermission "java.vm.specification.version", "read";
  125. permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
  126. permission java.util.PropertyPermission "java.vm.specification.name", "read";
  127. permission java.util.PropertyPermission "java.vm.version", "read";
  128. permission java.util.PropertyPermission "java.vm.vendor", "read";
  129. permission java.util.PropertyPermission "java.vm.name", "read";
  130. // Required for OpenJMX
  131. permission java.lang.RuntimePermission "getAttribute";
  132. // Allow read of JAXP compliant XML parser debug
  133. permission java.util.PropertyPermission "jaxp.debug", "read";
  134. // All JSPs need to be able to read this package
  135. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
  136. // Precompiled JSPs need access to these packages.
  137. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
  138. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
  139. permission java.lang.RuntimePermission
  140. "accessClassInPackage.org.apache.jasper.runtime.*";
  141. // Precompiled JSPs need access to these system properties.
  142. permission java.util.PropertyPermission
  143. "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
  144. permission java.util.PropertyPermission
  145. "org.apache.el.parser.COERCE_TO_ZERO", "read";
  146. // The cookie code needs these.
  147. permission java.util.PropertyPermission
  148. "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
  149. permission java.util.PropertyPermission
  150. "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
  151. permission java.util.PropertyPermission
  152. "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
  153. // Applications using Comet need to be able to access this package
  154. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
  155. };
  156. // The Manager application needs access to the following packages to support the
  157. // session display functionality. These settings support the following
  158. // configurations:
  159. // - default CATALINA_HOME == CATALINA_BASE
  160. // - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
  161. // - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
  162. grant codeBase "file:${catalina.base}/webapps/manager/-" {
  163. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
  164. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
  165. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
  166. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
  167. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
  168. };
  169. grant codeBase "file:${catalina.home}/webapps/manager/-" {
  170. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
  171. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
  172. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
  173. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
  174. permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
  175. };
  176. // You can assign additional permissions to particular web applications by
  177. // adding additional "grant" entries here, based on the code base for that
  178. // application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
  179. //
  180. // Different permissions can be granted to JSP pages, classes loaded from
  181. // the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
  182. // directory, or even to individual jar files in the /WEB-INF/lib/ directory.
  183. //
  184. // For instance, assume that the standard "examples" application
  185. // included a JDBC driver that needed to establish a network connection to the
  186. // corresponding database and used the scrape taglib to get the weather from
  187. // the NOAA web server. You might create a "grant" entries like this:
  188. //
  189. // The permissions granted to the context root directory apply to JSP pages.
  190. // grant codeBase "file:${catalina.base}/webapps/examples/-" {
  191. // permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
  192. // permission java.net.SocketPermission "*.noaa.gov:80", "connect";
  193. // };
  194. //
  195. // The permissions granted to the context WEB-INF/classes directory
  196. // grant codeBase "file:${catalina.base}/webapps/examples/WEB-INF/classes/-" {
  197. // };
  198. //
  199. // The permission granted to your JDBC driver
  200. // grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
  201. // permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
  202. // };
  203. // The permission granted to the scrape taglib
  204. // grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
  205. // permission java.net.SocketPermission "*.noaa.gov:80", "connect";
  206. // };