2016-02-05 37 views
0

我們有一個相當古老的Grails站點(2.3),它已經服務了我們很長一段時間的需求。服務器需要呼叫另一個服務以獲取客戶詳細信息,該服務將很快只需要TLS 1.1或更高版本。我們的網站運行在Java 1.7上,它應該支持TLS 1.1和1.2,但需要明確啓用它。我在grails網站中啓用它時遇到問題。爲舊版grails站點(Grails 2.3)設置Java System.Property(爲了啓用TLS1.1)

主要是什麼,我已經試過是通過運行

grails -Dhttps.protocols=TLSv1.1 run-app 

基於這些指令here開始的Grails,並提示here

Message: Connection reset 
    Line | Method 
->> 196 | read     in java.net.SocketInputStream 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 122 | read     in  '' 
|  82 | flushBuffer . . . . . . in java.io.BufferedOutputStream 
| 140 | flush     in  '' 
| 191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream 
|  99 | flush     in com.ctc.wstx.io.UTF8Writer 
| 214 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter 
| 311 | flush     in com.ctc.wstx.sw.BaseStreamWriter 
|  50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper 
| 230 | flush     in org.apache.axiom.om.impl.MTOMXMLStreamWriter 
|  91 | serialize . . . . . . . in org.apache.axis2.databinding.ADBDataSource 
| 638 | internalSerialize  in org.apache.axiom.om.impl.llom.OMSourcedElementImpl 
| 563 | serializeChildren . . . in org.apache.axiom.om.impl.util.OMSerializerUtil 
| 846 | internalSerialize  in org.apache.axiom.om.impl.llom.OMElementImpl 
| 267 | serializeInternally . . in org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl 
| 229 | internalSerialize  in  '' 
| 188 | serializeAndConsume . . in org.apache.axiom.om.impl.llom.OMSerializableImpl 
|  74 | writeTo     in org.apache.axis2.transport.http.SOAPMessageFormatter 
|  84 | writeRequest . . . . . in org.apache.axis2.transport.http.AxisRequestEntity 
| 499 | writeRequestBody  in org.apache.commons.httpclient.methods.EntityEnclosingMethod 
| 2114 | writeRequest . . . . . in org.apache.commons.httpclient.HttpMethodBase 
| 1096 | execute     in  '' 
| 398 | executeWithRetry . . . in org.apache.commons.httpclient.HttpMethodDirector 
| 171 | executeMethod   in  '' 
| 397 | executeMethod . . . . . in org.apache.commons.httpclient.HttpClient 
| 621 | executeMethod   in org.apache.axis2.transport.http.AbstractHTTPSender 
| 193 | sendViaPost . . . . . . in org.apache.axis2.transport.http.HTTPSender 
|  75 | send     in  '' 
| 404 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender 
| 231 | invoke     in  '' 
| 443 | send . . . . . . . . . in org.apache.axis2.engine.AxisEngine 
| 406 | send     in org.apache.axis2.description.OutInAxisOperationClient 
| 229 | executeImpl . . . . . . in  '' 
| 165 | execute     in org.apache.axis2.client.OperationClient 
| 3916 | login . . . . . . . . . in com.zuora.api.ZuoraServiceStub 
|  51 | ___init___    in com.zuora.zortal.util.ZApi$$EPbnSoym 
|  48 | <init> . . . . . . . . in com.zuora.zortal.repository.ZuoraRepository 
|  40 | login     in saaseiportal.unauthorized.LoginController 
| 195 | doFilter . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
|  63 | doFilter    in grails.plugin.cache.web.filter.AbstractFilter 
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor 
| 615 | run      in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 745 | run . . . . . . . . . . in java.lang.Thread 

我已經證實了我的系統和系統的Java支持TLS 1.1:但是當我做,插座仍當我嘗試登錄到其他站點關閉。我創建了一個示例Java客戶端來直接連接到該網站。它讓我定期運行它類似的連接重置消息,但它得到一個有效的響應,當我嘗試

java -Dhttps.protocols=TLSv1.1 SampleHttpTest 

我懷疑的地方在Grails是真正清理出我的設置。立即登錄調用生成異常之前,我添加了一個記錄調用

System.out.println(System.getProperty("https.protocols")); 

它只是記錄一個空。在我嘗試登錄之前立即設置該屬性沒有任何作用,可能是因爲它在應用程序的生命中已經太晚了(某些工廠已經創建或者其他東西)。

我實際上是Grails新手的東西,所以將應用程序升級到grails 2.5和java 8實際上是一個相當艱鉅的前景。我希望有人能說出喜歡簡單的東西:

「這是哪裏的Grails可以讓你運行任何其他Java代碼之前設置系統屬性」 或 「這裏就是Grails的設置爲數衆多的默認設置,你應該檢查值已經「 或 」這可能是身份驗證插件(或東西),需要清除/擺弄這些設置「

在此先感謝您的任何幫助!

+0

首先,你如何部署這個grails應用程序的生產?通常這種類型的設置是基於jvm的。所以如果你使用glassfish或tomcat,那麼你應該在那裏配置它。 – Quchie

回答

1

它可能是分叉模式。要通過JVM參數的派生的Java,你必須改變BuildConfig.groovy了一下:

grails.project.fork = [ 
    ... 
    run : [maxMemory: 1280, minMemory: 128, debug: false, maxPerm: 256, forkReserve: true, jvmArgs: ['-Dhttps.protocols=TLSv1.1']], 
    ... 
] 

但也有可能是別的東西爲好。

+0

它* WAS *分叉!謝謝!這終於讓我把標誌傳遞給用於grails站點的JVM(在我的日誌記錄中證實)。不幸的是,它還沒有就TLSv1.1握手進行談判,所以它一定是別的。我稍微改述了我的頭銜。我也發現我不應該使用雙引號。我確信你只是在複製我,但如果你將它們從你的答案中刪除,我會將其標記爲解決方案。 – user3033893