EJBCA Pas à Pas

De FrozenWiki
Aller à la navigation Aller à la recherche

Installer JBOSS

Des Instructions d'installation plus générales se trouvent ici

  • Télécharger JBOSS depuis http://www.jboss.org/jbossas/downloads/
  • Dé-zipper l'archive dans /opt
  • Renommer le dossier /opt/jboss-x.x.x en /opt/jboss
  • Editer le fichier /opt/jboss/bin/run.conf et changer les paramètres mémoire -Xms***m -Xmx***m etc...
  • Editer le fichier /opt/jboss/server/default/bootstrap/bindings.xml pour modifier (éventuellement) les ports 8080 et 8443 selon le besoin. Ne pas modifier les valeurs des ports dans la section des transform à la fin du fichier.
  • Créer un nouvel utilisateur et groupe jboss avec la commande
useradd -r -U -d /opt/jboss jboss
  • Associer tous les fichiers dans /opt/jboss à l'utilisateur jboss via
chown -R jboss:jboss /opt/jboss
  • Il faudra se rappeler de réallouer tous les fichiers modifiés par root à l'utilisateur jboss, ou alors les modifications futures de fichiers devront se faire en tant qu'utilisateur jboss via:
su - jboss

Options de sécurité

Pour sécuriser l'accès aux différentes consoles jboss, accessibles par défaut sur http://localhost:8080/ il faut éditer les fichiers suivants:

Sécuriser la console JMX

  • /opt/jboss/server/default/conf/props/jmx-console-users.properties et modifier la ligne admin=admin en username=password
  • /opt/jboss/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml et dé-commenter la section:
<!DOCTYPE jboss-web PUBLIC
   "-//JBoss//DTD Web Application 5.0//EN"
   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">

<jboss-web>
      <security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>
  • /opt/jboss/server/default/deploy/jmx-console.war/WEB-INF/web.xml et dé-commenter la section suivante:
   <!-- 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>

Sécuriser l'accès au status

  • /opt/jboss/server/default/deploy/ROOT.war/WEB-INF/jboss-web.xml et y mettre le contenu:
<!DOCTYPE jboss-web PUBLIC
   "-//JBoss//DTD Web Application 5.0//EN"
   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
   
<jboss-web>
      <security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>
  • jboss/server/default/deploy/ROOT.war/WEB-INF/web.xml et y ajouter les lignes:
  <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 status application
       </description>
       <url-pattern>/status</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>
   
   <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>JBoss Status</realm-name>
   </login-config>

   <security-role>
      <role-name>JBossAdmin</role-name>
   </security-role>

Sécuriser la Web Console Java

  • /opt/jboss/server/default/conf/props/web-console-users.properties et y mettre la ligne username=password
  • /opt/jboss/server/default/conf/props/web-console-roles.properties et y mettre la ligne admin=JBossAdmin,HttpInvoker
  • jboss/server/default/conf/login-config.xml et y mettre à jour le chemin vers web-console-users.properties en /props/web-console-users.properties, et de même pour web-console-roles.properties
  • jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml et dé-commenter la ligne security-domain:
!DOCTYPE jboss-web
    PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">

<jboss-web>
   <security-domain>java:/jaas/web-console</security-domain>
   <!-- The war depends on the -->
   <depends>jboss.admin:service=PluginManager</depends>
</jboss-web>
  • /opt/jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml et dé-commenter la section:
   <!-- 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>


Installer EJBCA