2015-03-19 94 views
4

我想为我的web应用程序安全连接。所以,我想为我的wildfly 8.2.0服务器配置ssl。我已经创建并将.keystore文件存储在独立/配置文件夹中。如何在wildfly 8.2.0服务器中配置ssl?

$ keytool -genkey -alias foo -keyalg RSA -keystore foo.keystore -validity 10950 
Enter keystore password: secret 

有加:

<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false"> 
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="443" /> 
<connector name="https" scheme="https" protocol="HTTP/1.1" socket-binding="https" enable-lookups="false" secure="true"> 
<ssl name="foo-ssl" password="secret" protocol="TLSv1" key-alias="foo" certificate-key-file="../standalone/configuration/foo.keystore" /> 
</connector> 

在standalone.xml文件,但标签:

<subsystem xmlns="urn:jboss:domain:remoting:2.0"> 
     <endpoint worker="default"/> 
     <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/> 
    </subsystem> 

当我与上述指定标签收到错误更换此:

Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[288,106] 
Message: Unexpected element '{urn:jboss:domain:web:1.1}subsystem' 
+0

我不知道你做的是对的 - 一些使用Google的人向我暗示,对于野蛮人,你不应该配置连接器,只有绑定到identity = keystore的套接字绑定 - 但至少您添加的部分不是格式良好的XML:它会打开一个''并且不会关闭它;为了解析它,你需要添加''。 – 2015-03-19 09:47:33

回答

14

我配置了ssl f或野蛮8.2.0。

第一步:创建密钥库

cd $WILDFLY_HOME/standalone/configuration 
keytool -genkey -alias localhost -keyalg RSA -keystore keystore.jks -keysize 4096 

第二步:编辑配置/ standalone.xml

<management> 
<security-realms> 
**<security-realm name="SslRealm"> 
    <server-identities> 
    <ssl> 
     <keystore path="keystore.jks" relative-to="jboss.server.config.dir" keystore-password="changeme"/> 
    </ssl> 
    </server-identities> 
</security-realm>** 
</security-realms> 

第三步:通过编辑standalone.xml

<subsystem xmlns="urn:jboss:domain:undertow:1.2"> 
<buffer-cache name="default"/> 
<server name="default-server"> 
<http-listener name="default" socket-binding="http"/> 
**<https-listener name="default-ssl" socket-binding="https" security-realm="SslRealm"/>** 

现在SSL增加对HTTPS监听器被配置,我的网站是安全的。

相关问题