Monday 2 January 2012

How to password protect jboss jmx-console (http://:8080/jmx-console)


Step1: Go to Jboss Deploy folder (ex: cd /usr/local/jboss/server/default/deploy)

Step2: Then go to jmx-console.war/WEB-INF/ directory

Step3: Open jboss-web.xml file using vim editor and uncomment the security-domain to enable security

    # vim jboss-web.xml

------------------------------------------------------------------------------------------------
<jboss-web>
<!-- Uncomment the security-domain to enable security. You will
need to edit the htmladaptor login configuration to setup the
login modules used to authentication users. -->
<security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>
------------------------------------------------------------------------------------------------

Step4: Open web.xml using vim editor and uncomment the security-constraint

    # vim web.xml

------------------------------------------------------------------------------------------------
<!-- A security constraint that restricts access to the HTML JMX console
to users with the role JBossAdmin. Edit the roles to what you want and
uncomment the WEB-INF/jboss-web.xml/security-domain element to enable
secured access to the HTML JMX console. -->

<security-constraint>
<web-resource-collection>
<web-resource-name>HtmlAdaptor</web-resource-name>
<description>An example security config that only allows users with the
role JBossAdmin to access the HTML JMX console web application
</description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>JBossAdmin</role-name>
</auth-constraint>
</security-constraint>

------------------------------------------------------------------------------------------------

Step5: To configure username and password for accessing jmx-console page, Go to the following location
    # cd /usr/local/jboss/server/default

Step6: locate jmx-console-users.properties file

Step7: Open the jmx-console-users.properties file and configure username and password

    # vim jmx-console-users.properties
    admin=admin!23

Step8: Restart jboss service and test jmx-console page

No comments:

Post a Comment