Cheng Tang | 07b3087 | 2014-04-27 16:37:18 +0800 | [diff] [blame^] | 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 | // ============================================================================
|
| 17 | // catalina.policy - Security Policy Permissions for Tomcat 7
|
| 18 | //
|
| 19 | // This file contains a default set of security policies to be enforced (by the
|
| 20 | // JVM) when Catalina is executed with the "-security" option. In addition
|
| 21 | // to the permissions granted here, the following additional permissions are
|
| 22 | // granted to each web application:
|
| 23 | //
|
| 24 | // * Read access to the web application's document root directory
|
| 25 | // * Read, write and delete access to the web application's working directory
|
| 26 | //
|
| 27 | // $Id: catalina.policy 1460221 2013-03-23 20:17:29Z kkolinko $
|
| 28 | // ============================================================================
|
| 29 |
|
| 30 |
|
| 31 | // ========== SYSTEM CODE PERMISSIONS =========================================
|
| 32 |
|
| 33 |
|
| 34 | // These permissions apply to javac
|
| 35 | grant codeBase "file:${java.home}/lib/-" {
|
| 36 | permission java.security.AllPermission;
|
| 37 | };
|
| 38 |
|
| 39 | // These permissions apply to all shared system extensions
|
| 40 | grant codeBase "file:${java.home}/jre/lib/ext/-" {
|
| 41 | permission java.security.AllPermission;
|
| 42 | };
|
| 43 |
|
| 44 | // These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
|
| 45 | grant codeBase "file:${java.home}/../lib/-" {
|
| 46 | permission java.security.AllPermission;
|
| 47 | };
|
| 48 |
|
| 49 | // These permissions apply to all shared system extensions when
|
| 50 | // ${java.home} points at $JAVA_HOME/jre
|
| 51 | grant codeBase "file:${java.home}/lib/ext/-" {
|
| 52 | permission java.security.AllPermission;
|
| 53 | };
|
| 54 |
|
| 55 |
|
| 56 | // ========== CATALINA CODE PERMISSIONS =======================================
|
| 57 |
|
| 58 |
|
| 59 | // These permissions apply to the daemon code
|
| 60 | grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
|
| 61 | permission java.security.AllPermission;
|
| 62 | };
|
| 63 |
|
| 64 | // These permissions apply to the logging API
|
| 65 | // Note: If tomcat-juli.jar is in ${catalina.base} and not in ${catalina.home},
|
| 66 | // update this section accordingly.
|
| 67 | // grant codeBase "file:${catalina.base}/bin/tomcat-juli.jar" {..}
|
| 68 | grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
|
| 69 | permission java.io.FilePermission
|
| 70 | "${java.home}${file.separator}lib${file.separator}logging.properties", "read";
|
| 71 |
|
| 72 | permission java.io.FilePermission
|
| 73 | "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
|
| 74 | permission java.io.FilePermission
|
| 75 | "${catalina.base}${file.separator}logs", "read, write";
|
| 76 | permission java.io.FilePermission
|
| 77 | "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
|
| 78 |
|
| 79 | permission java.lang.RuntimePermission "shutdownHooks";
|
| 80 | permission java.lang.RuntimePermission "getClassLoader";
|
| 81 | permission java.lang.RuntimePermission "setContextClassLoader";
|
| 82 |
|
| 83 | permission java.util.logging.LoggingPermission "control";
|
| 84 |
|
| 85 | permission java.util.PropertyPermission "java.util.logging.config.class", "read";
|
| 86 | permission java.util.PropertyPermission "java.util.logging.config.file", "read";
|
| 87 | permission java.util.PropertyPermission "catalina.base", "read";
|
| 88 |
|
| 89 | // Note: To enable per context logging configuration, permit read access to
|
| 90 | // the appropriate file. Be sure that the logging configuration is
|
| 91 | // secure before enabling such access.
|
| 92 | // E.g. for the examples web application (uncomment and unwrap
|
| 93 | // the following to be on a single line):
|
| 94 | // permission java.io.FilePermission "${catalina.base}${file.separator}
|
| 95 | // webapps${file.separator}examples${file.separator}WEB-INF
|
| 96 | // ${file.separator}classes${file.separator}logging.properties", "read";
|
| 97 | };
|
| 98 |
|
| 99 | // These permissions apply to the server startup code
|
| 100 | grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
|
| 101 | permission java.security.AllPermission;
|
| 102 | };
|
| 103 |
|
| 104 | // These permissions apply to the servlet API classes
|
| 105 | // and those that are shared across all class loaders
|
| 106 | // located in the "lib" directory
|
| 107 | grant codeBase "file:${catalina.home}/lib/-" {
|
| 108 | permission java.security.AllPermission;
|
| 109 | };
|
| 110 |
|
| 111 |
|
| 112 | // If using a per instance lib directory, i.e. ${catalina.base}/lib,
|
| 113 | // then the following permission will need to be uncommented
|
| 114 | // grant codeBase "file:${catalina.base}/lib/-" {
|
| 115 | // permission java.security.AllPermission;
|
| 116 | // };
|
| 117 |
|
| 118 |
|
| 119 | // ========== WEB APPLICATION PERMISSIONS =====================================
|
| 120 |
|
| 121 |
|
| 122 | // These permissions are granted by default to all web applications
|
| 123 | // In addition, a web application will be given a read FilePermission
|
| 124 | // and JndiPermission for all files and directories in its document root.
|
| 125 | grant {
|
| 126 | // Required for JNDI lookup of named JDBC DataSource's and
|
| 127 | // javamail named MimePart DataSource used to send mail
|
| 128 | permission java.util.PropertyPermission "java.home", "read";
|
| 129 | permission java.util.PropertyPermission "java.naming.*", "read";
|
| 130 | permission java.util.PropertyPermission "javax.sql.*", "read";
|
| 131 |
|
| 132 | // OS Specific properties to allow read access
|
| 133 | permission java.util.PropertyPermission "os.name", "read";
|
| 134 | permission java.util.PropertyPermission "os.version", "read";
|
| 135 | permission java.util.PropertyPermission "os.arch", "read";
|
| 136 | permission java.util.PropertyPermission "file.separator", "read";
|
| 137 | permission java.util.PropertyPermission "path.separator", "read";
|
| 138 | permission java.util.PropertyPermission "line.separator", "read";
|
| 139 |
|
| 140 | // JVM properties to allow read access
|
| 141 | permission java.util.PropertyPermission "java.version", "read";
|
| 142 | permission java.util.PropertyPermission "java.vendor", "read";
|
| 143 | permission java.util.PropertyPermission "java.vendor.url", "read";
|
| 144 | permission java.util.PropertyPermission "java.class.version", "read";
|
| 145 | permission java.util.PropertyPermission "java.specification.version", "read";
|
| 146 | permission java.util.PropertyPermission "java.specification.vendor", "read";
|
| 147 | permission java.util.PropertyPermission "java.specification.name", "read";
|
| 148 |
|
| 149 | permission java.util.PropertyPermission "java.vm.specification.version", "read";
|
| 150 | permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
|
| 151 | permission java.util.PropertyPermission "java.vm.specification.name", "read";
|
| 152 | permission java.util.PropertyPermission "java.vm.version", "read";
|
| 153 | permission java.util.PropertyPermission "java.vm.vendor", "read";
|
| 154 | permission java.util.PropertyPermission "java.vm.name", "read";
|
| 155 |
|
| 156 | // Required for OpenJMX
|
| 157 | permission java.lang.RuntimePermission "getAttribute";
|
| 158 |
|
| 159 | // Allow read of JAXP compliant XML parser debug
|
| 160 | permission java.util.PropertyPermission "jaxp.debug", "read";
|
| 161 |
|
| 162 | // All JSPs need to be able to read this package
|
| 163 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
|
| 164 |
|
| 165 | // Precompiled JSPs need access to these packages.
|
| 166 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
|
| 167 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
|
| 168 | permission java.lang.RuntimePermission
|
| 169 | "accessClassInPackage.org.apache.jasper.runtime.*";
|
| 170 |
|
| 171 | // Precompiled JSPs need access to these system properties.
|
| 172 | permission java.util.PropertyPermission
|
| 173 | "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
|
| 174 | permission java.util.PropertyPermission
|
| 175 | "org.apache.el.parser.COERCE_TO_ZERO", "read";
|
| 176 |
|
| 177 | // The cookie code needs these.
|
| 178 | permission java.util.PropertyPermission
|
| 179 | "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
|
| 180 | permission java.util.PropertyPermission
|
| 181 | "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
|
| 182 | permission java.util.PropertyPermission
|
| 183 | "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
|
| 184 |
|
| 185 | // Applications using Comet need to be able to access this package
|
| 186 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
|
| 187 |
|
| 188 | // Applications using WebSocket need to be able to access this package
|
| 189 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.websocket";
|
| 190 | };
|
| 191 |
|
| 192 |
|
| 193 | // The Manager application needs access to the following packages to support the
|
| 194 | // session display functionality. These settings support the following
|
| 195 | // configurations:
|
| 196 | // - default CATALINA_HOME == CATALINA_BASE
|
| 197 | // - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
|
| 198 | // - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
|
| 199 | grant codeBase "file:${catalina.base}/webapps/manager/-" {
|
| 200 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
|
| 201 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
|
| 202 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
|
| 203 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
|
| 204 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
|
| 205 | };
|
| 206 | grant codeBase "file:${catalina.home}/webapps/manager/-" {
|
| 207 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
|
| 208 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
|
| 209 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
|
| 210 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
|
| 211 | permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
|
| 212 | };
|
| 213 |
|
| 214 | // You can assign additional permissions to particular web applications by
|
| 215 | // adding additional "grant" entries here, based on the code base for that
|
| 216 | // application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
|
| 217 | //
|
| 218 | // Different permissions can be granted to JSP pages, classes loaded from
|
| 219 | // the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
|
| 220 | // directory, or even to individual jar files in the /WEB-INF/lib/ directory.
|
| 221 | //
|
| 222 | // For instance, assume that the standard "examples" application
|
| 223 | // included a JDBC driver that needed to establish a network connection to the
|
| 224 | // corresponding database and used the scrape taglib to get the weather from
|
| 225 | // the NOAA web server. You might create a "grant" entries like this:
|
| 226 | //
|
| 227 | // The permissions granted to the context root directory apply to JSP pages.
|
| 228 | // grant codeBase "file:${catalina.base}/webapps/examples/-" {
|
| 229 | // permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
|
| 230 | // permission java.net.SocketPermission "*.noaa.gov:80", "connect";
|
| 231 | // };
|
| 232 | //
|
| 233 | // The permissions granted to the context WEB-INF/classes directory
|
| 234 | // grant codeBase "file:${catalina.base}/webapps/examples/WEB-INF/classes/-" {
|
| 235 | // };
|
| 236 | //
|
| 237 | // The permission granted to your JDBC driver
|
| 238 | // grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
|
| 239 | // permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
|
| 240 | // };
|
| 241 | // The permission granted to the scrape taglib
|
| 242 | // grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
|
| 243 | // permission java.net.SocketPermission "*.noaa.gov:80", "connect";
|
| 244 | // };
|
| 245 |
|