Monday 2 January 2012

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

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

Step2: execute the below command to find web-console.war directory

    #find . -iname web-console.war

Step3: Based on the output go to web-console.war/WEB-INF directory

Step4: Open jboss-web.xml file 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/web-console</security-domain>
<!-- The war depends on the -->
<depends>jboss.admin:service=PluginManager</depends>
</jboss-web>

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

Step5: Open web.xml file using vim editor and uncomment security-constraint

    # vim web.xml

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

<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>

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

Step6: Go to deploy folder and find web-console-users.properties file

    # find . -iname web-console-users.properties

Step7: Based on the output open web-console-users.properties file and put an entry for uname and password

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

Step8: Restart jboss and test accessing web-console page

No comments:

Post a Comment