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