Bug 1347778

Summary: The security manager doesn't work correctly
Product: Red Hat Enterprise Linux 6 Reporter: Coty Sutherland <csutherl>
Component: tomcat6Assignee: Coty Sutherland <csutherl>
Status: CLOSED WONTFIX QA Contact: Jan Stefl <jstefl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: fgoldefu, mbabacek, tomcat-qe
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1347774 Environment:
Last Closed: 2017-12-06 12:04:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 927930, 1347774, 1347835, 1347838    
Bug Blocks:    
Attachments:
Description Flags
patch proposal none

Description Coty Sutherland 2016-06-17 15:40:28 UTC
+++ This bug was initially created as a clone of Bug #1347774 +++

Description of problem:
When using the security manager for the tomcat service, JSPs are inaccessible (they won't compile) because of access permissions.

+++
HTTP Status 500 - access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.jasper")

type Exception report

message access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.jasper")

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.org.apache.jasper")
	java.security.AccessControlContext.checkPermission(AccessControlContext.java:474)
	java.security.AccessController.checkPermission(AccessController.java:685)
	java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1525)
	sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:305)
	java.lang.ClassLoader.loadClass(ClassLoader.java:412)
	java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	org.apache.jasper.servlet.JspServletWrapper.<init>(JspServletWrapper.java:120)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:606)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
	java.security.AccessController.doPrivileged(Native Method)
	javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
	org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:169)
	java.security.AccessController.doPrivileged(Native Method)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:606)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
	java.security.AccessController.doPrivileged(Native Method)
	javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
	org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:249)
+++

Version-Release number of selected component (if applicable):
tomcat-7.0.54-2.el7_1.noarch

How reproducible:
Every time :(

Steps to Reproduce:
1. yum install tomcat
2. echo "SECURITY_MANAGER=\"true\"" >> /etc/sysconfig/tomcat
3. cp reproducer.tar /usr/share/tomcat/webapps/
4. service tomcat start
5. curl -is http://localhost:8080/reproducer/

Actual results:
JSP compilation fails and an error is observed

Expected results:
JSP compiles and displays correctly.

Additional info:
It looks like the java policy in use (catalina.policy) doesn't allow for use of jars from /usr/share/java

Comment 2 Coty Sutherland 2016-07-07 19:28:54 UTC
Created attachment 1177434 [details]
patch proposal

Comment 10 Jan Kurik 2017-12-06 12:04:19 UTC
Red Hat Enterprise Linux 6 is in the Production 3 Phase. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not meet the inclusion criteria for the Production 3 Phase and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Note that a strong business justification will be required for re-evaluation. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com/