我想将几个 Java 应用程序从Jboss 4.2.3迁移到Jboss 7.0.0 EAP。
第一步,我决定迁移数据源。例如,我在 4.2.3 中有这样的数据源配置:
{profile}/deploy/some-ds.xml
<local-tx-datasource>
<jndi-name>SomeDS</jndi-name>
...
<security-domain>EncryptedSomeDBLocalRealm</security-domain>
</local-tx-datasource>
</datasources>
但我注意到数据源凭据是加密的,因此我还需要迁移安全系统。4.2.3中有相关配置:
{profile}/conf/login-config.xml
<application-policy name = "EncryptedSomeDBLocalRealm">
<authentication>
<login-module code = "org.jboss.resource.security.JaasSecurityDomainIdentityLoginModule" flag="required">
<module-option name = "username">user123</module-option>
<module-option name = "password">1ad9fNmTA/65Ufh583ZAn4</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=SomeDS</module-option>
<module-option name = "jaasSecurityDomain">jboss.security:service=JaasSecurityDomain,domain=ServerMasterPassword</module-option>
</login-module>
</authentication>
</application-policy>
{profile}/conf/jboss-service.xml
<mbean code="org.jboss.security.plugins.JaasSecurityDomain"
name="jboss.security:service=JaasSecurityDomain,domain=ServerMasterPassword">
<constructor>
<arg type="java.lang.String" value="ServerMasterPassword"/>
</constructor>
<attribute name="KeyStorePass">{CLASS}org.jboss.security.plugins.FilePassword:${jboss.server.home.dir}/conf/server.password</attribute>
<attribute name="Salt">abcdefgh</attribute>
<attribute name="IterationCount">19</attribute>
</mbean>
我为 Jboss 7 EAP 添加了这个到我的standalone.xml 中:
configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jta="true" jndi-name="java:/SomeDS" pool-name="SomeDS" enabled="true" use-ccm="true">
<connection-url>{my-oracle-ldap-connection-url}</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>ojdbc8.jar</driver>
<security>
<security-domain>jdbcDatabaseSecure</security-domain>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<background-validation>true</background-validation>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
</validation>
</datasource>
<drivers>
????? should I put here my oracle driver?
</drivers>
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:security:1.2">
<security-domains>
...
<security-domain name="jdbcDatabaseSecure">
?????
</security-domain>
</security-domains>
</subsystem>
<management>
<security-realms>
...
<security-realm name="UndertowRealm">
<server-identities>
<ssl>
<keystore path="server_as_01.keystore" relative-to="jboss.server.config.dir" keystore-password="123456"/>
</ssl>
</server-identities>
</security-realm>
</security-realms>
</management>
可能不太相关的 4.2.3 配置,但对于 SSL 配置是实际的:
{profile}/deploy/jboss-web.deployer/server.xml
<!-- SSL/TLS Connector configuration using the admin devl guide keystore -->
<Connector port="4570" address="${jboss.bind.address}"
minSpareThreads="5" maxSpareThreads="75" enableLookups="true" disableUploadTimeout="true"
acceptCount="100" maxThreads="100" scheme="https" secure="true" SSLEnabled="true"
keystoreFile="${jboss.server.home.dir}/conf/server_as_01.keystore"
keystorePass="123456"
truststoreFile="${jboss.server.home.dir}/conf/server_as_01.keystore"
truststorePass="123456"
clientAuth="false" sslProtocol="TLS" />
我在 4.2.3 中也有这些文件:
{profile}/conf/server.password
{profile}/conf/client.truststore
{profile}/conf/server_as_01.keystore
和JAVA_OPTS="-Djavax.net.ssl.trustStore=$JBOSS_SERVER/conf/client.truststore -Djavax.net.ssl.trustStorePassword=changeit"
我尝试使用 Jboss 7.0.0 EAP 配置做类似的事情,但正如我从 Google 注意到的那样,这些实现存在太多差异。似乎 7 EAP 中不再存在 JAAS。
有人可以帮我正确配置吗?