<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    AS8:  JBoss Security Manager Implementation Plan
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/anil.saldhana">Anil Saldhana</a> in <i>JBoss AS 7 Development</i> - <a href="https://community.jboss.org/docs/DOC-48386">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>This wiki article will propose an implementation plan for the security manager related changes for JBoss AS8.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2>Background</h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>Please follow </span><a class="jive-link-external-small" href="https://community.jboss.org/docs/DOC-48383" target="_blank">https://community.jboss.org/wiki/AS8JBossSecurityManagerDiscussion</a><span>&#160;&#160; for some background information.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Goal is to minimize the global policy file <em>historic</em> approach and adapt the Java Security Manager infrastructure in AS8 to a more modular approach.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2>Approach</h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li style="text-align: start;">We will have a security manager subsystem to define the global permission collection that modules will inherit by default.&#160; </li><li style="text-align: start;">module.xml can define the permission collection that governs the module.&#160; This is what the ModuleClassLoader will return to the security manager when asked for permission collection.</li><li style="text-align: start;">EE deployments can do META-INF/permissions.xml (as per EE7).&#160;&#160; The deployment permissions need to be merged into the module level permissions.</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h2 style="text-align: start;"></h2><h2 style="text-align: start;">Security Manager and Policy Implementation</h2><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">The JVM can run under a Java Security Manager via two options:</p><ul><li style="text-align: start;">Pass&#160; -Djava.security.manager as command option</li><li style="text-align: start;">Programmatically, call&#160;&#160;&#160; System.setSecurityManager(securityManager)</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">So we have two options to start the security manager in AS8.&#160; (<em>I personally like the programmatic option that will let the JVM and JBoss Modules system to start up before the security manager is put into operation</em>).</p><h3 style="text-align: start;">Command Line Option</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">When we use the command line option,&#160; the default security manager implementation (that uses Sun PolicyFile implementation)&#160;&#160; will use the java.policy file from jre/lib/security folder of the JVM to construct the permissions that the JVM will have in starting up.&#160; This takes care of the JVM starting up.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">We will need to bootstrap the JBoss Modules system.&#160; Now we have to think about providing the permissions for the jboss-modules.jar&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">The easiest way to achieve this is to add an entry into the java.policy file.&#160;&#160; or&#160; have a single entry in a policy file within the AS8 folders and mandate users not add/delete anything from this file.&#160;&#160; This will get the JBoss Modules system starting.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">Once the module system is started,&#160; we will use the programmatic stuff below.</p><h3 style="text-align: start;">Programmatic Option</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>There will be a security manager subsystem defined in the domain model.&#160;&#160; It will have a flag called <strong><em>enable</em></strong>&#160; which by default will be <em>false</em>.&#160;&#160; If the user configures the <em>enable</em> flag to true,&#160; the program will call <em>System.setSecurityManager()</em>,&#160; if&#160; <em>System.getSecurityManager() == null</em>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The security manager subsystem can define the permission block for use by default by the module class loader.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="https://community.jboss.org/docs/DOC-48386">going to Community</a></p>

        <p style="margin: 0;">Create a new document in JBoss AS 7 Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>