Um galego no Império Pequeno

Além da linha inimiga

May 7th, 2009 at 2:06 pm

Activar/desactivar usuário e senha na jmx-console

jmx-console

A jmx-console é umha ferramenta para controlar o funcionamento do JBoss. Com ela podemos configurar variáveis, mudar valores e até parar e arrincar o JBoss.

Num dos servidores web que administro tinhamos um JBoss a rodar mas sem nenhum tipo de controlo de acceso, o que é um importante erro de segurança porque qualquer pessoa com acceso à rede na que está o servidor poderia accesar à dita consola.

Para amanhar isto devemos editar os seguintes ficheiros:

1. /jboss/server/default/deploy/jmx-console.war/WEB-INF/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>

e descomentamos

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

2. /jboss/server/default/deploy/jmx-console.war/WEB-INF/web.xml e buscamos

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

descomentamos tamém

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

3. Para definir a senha do usuário ‘admin’. /jboss/server/default/conf/props/jmx-console-users.properties

admin=admin

por

admin=nova_senha
Tags: , ,
-

Comments are closed.