poniedziałek, grudnia 05, 2011

TIBCO, IAIK, BIG-IP

11-letni (sic!) IAIK używany jako domyślny stos SSL w produktach Tibco (np. BusinessWorks) cache-uje sesje SSL i nie radzi sobie z tym, że długość życia sesji na urządzeniu F5 to domyślnie 1 godzina. Stale włączony komponent realizujący zabezpieczoną komunikację po protokole SOAP, przy niewygasającym ruchu, będzie z godzinną regularnością rzucał błędami. Żeby naprawić problem Tibco musi poprawić menedżera sesji: sslContext.setSessionManager(). Pewnie się naczekamy. Wnioski: należy używać ESB OpenSource a nie zamkniętych rozwiązań, w których samemu (albo zwinną firmą np. Touk) nic nie można poprawić.


Jak zasymulować F5? Spróbujmy Apache-em: odeśle stare zaakceptowane Session ID lub nowe.

httpd-ssl.conf:
SSLSessionCache "shmcb:c:/Users/user/Apache/ssl_scache(512000)"
SSLSessionCacheTimeout 30

javax.net.debug=all w implementacji Sun Microsystems:
%% Client cached [Session-2, TLS_DHE_RSA_WITH_AES_128_CBC_SHA]
%% Try resuming [Session-2, TLS_DHE_RSA_WITH_AES_128_CBC_SHA] from port 49499

Najnowszy IAIK też działa:
ssl_debug(8): Starting handshake (iSaSiLk 4.4 Evaluation Version)...
ssl_debug(8): Sending v3 client_hello message to localhost:443, requesting version 3.1...
ssl_debug(8): Trying to resume session CA:FE:BA:BE:00:01:02:03...

public class Lab {
private final static boolean useIAIK = true;
static {
System.setProperty("javax.net.debug", "all");
System.setProperty("javax.net.ssl.trustStore", "D://dev//ssl.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "secret");
System.setProperty("com.entrust.toolkit.ssl.trustroots.type", "JKS");
System.setProperty("com.entrust.toolkit.ssl.trustroots", "D://dev//ssl.jks");
System.setProperty("com.entrust.toolkit.trace", "FINEST");
Security.insertProviderAt(new Entrust(), 1);
}
    
public static void main(String[] args) throws Exception {
while (true) {
SSLClientContext ctx = new SSLClientContext();
ctx.setDebugStream(System.out);
ctx.setChainVerifier(null);
Socket s = useIAIK ? new SSLSocket(InetAddress.getByName("localhost"), 443, ctx) :
SSLSocketFactory.getDefault().createSocket(InetAddress.getByName("localhost"), 443);
s.setKeepAlive(true);
OutputStream os = s.getOutputStream();
os.write("GET / HTTP/1.1\r\n".getBytes());
os.write("Host: localhost\r\n".getBytes());
for (int i=0; i < 1; i++) {
os.write(("Header-"+i+": 0\r\n").getBytes());
os.flush();
Thread.sleep(1000);
}
os.write("\r\n".getBytes());
os.flush();
InputStream is = s.getInputStream();
int b = 0;
while ( (b=is.read())!=-1 )
System.out.print( (char)b );
is.close();
s.close();
Thread.sleep(40000);
}
}
}

0 komentarze: