【问题标题】:SBT - How to configure ssl for Jetty running locally?SBT - 如何为本地运行的 Jetty 配置 ssl?
【发布时间】:2017-04-04 01:04:54
【问题描述】:

我需要为我的项目实施本地 ssl 以实现 OAuth。我通读了 xsbt-web-plugin 页面 (here)。我按照here 的建议创建了密钥库。

keytool -genkey -alias localhost -keyalg RSA -keystore localhost.jks -keysize 2048

我使用我找到的 here 的码头配置文件让它为 https 服务。这是它的样子:

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Call name="addConnector">
     <Arg>
         <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
             <Arg>
                 <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
                     <Set name="keyStore">localhost.jks</Set>
                     <Set name="keyStorePassword">password</Set>
                     <Set name="keyManagerPassword">password</Set>
                     <Set name="trustStore">localhost.jks</Set>
                     <Set name="trustStorePassword">password</Set>
                 </New>
             </Arg>
             <Set name="port">8443</Set>
             <Set name="maxIdleTime">30000</Set>
         </New>
     </Arg>
    </Call>
</Configure>

我的 SBT 配置如下所示:

customConfiguration in container.Configuration := true                                                                                                        
ssl in container.Configuration := Some("127.0.0.1", 8443, "localhost.jks", "password", "password")                                                      
configurationFiles in container.Configuration := Seq(file("path\\to\\jetty.xml"))

现在的问题是服务器为每个请求提供 404:

控制台上也有这个警告:

2017-03-13 16:06:56.819:WARN:oeji.nio:javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?

码头:8.1.7/电梯:2.6.2

请指教。谢谢。

【问题讨论】:

标签: jetty lift xsbt-web-plugin


【解决方案1】:

在为此苦苦挣扎了几天之后,我只使用了STunnel,它基本上只是另一个在本地运行的服务器,它将所有请求从 8443 转发到我在 8080 上运行的开发服务器。

【讨论】:

  • 这里的另一个选择是在本地将 nginx 粘贴在它的前面。与 stunnel 相同的想法,相对简单的配置。我总是这样做——作为奖励,我可以将不同的本地 URL 指向不同的本地应用程序。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-14
  • 1970-01-01
相关资源
最近更新 更多