Skip to content

Commit

Permalink
better ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
rainer-prosi committed Jun 16, 2023
1 parent ee90f7a commit ee3b9c9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,22 @@ protected void customize(SSLEngine sslEngine, Request request)

try
{
InetAddress add = InetAddress.getByName(server);
if (InetAddress.getLocalHost().equals(add) || "localhost".equalsIgnoreCase(add.getHostName()))
InetAddress[] adds = InetAddress.getAllByName(server);
for (InetAddress add : adds)
{
String message = "bypassing sni for " + server;
if (logged.add(message))
if (InetAddress.getLocalHost().equals(add) || "localhost".equalsIgnoreCase(add.getHostName()) || add.isLoopbackAddress())
{
log.warn(message);
String message = "bypassing sni for " + server;
if (logged.add(message))
{
log.warn(message);
}
BambiRequestCustomizer delegate = new BambiRequestCustomizer(this);
delegate.setSniHostCheck(false);
delegate.setSniRequired(false);
delegate.delegate(sslEngine, request);
return;
}
BambiRequestCustomizer delegate = new BambiRequestCustomizer(this);
delegate.setSniHostCheck(false);
delegate.setSniRequired(false);
delegate.delegate(sslEngine, request);
return;
}
}
catch (UnknownHostException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,19 @@ public void testCustomize() throws UnknownHostException

Mockito.when(request.getServerName()).thenReturn("localhost");
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn("127.0.0.1");
rq.customize(e, request);

Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName().toLowerCase());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName().toUpperCase());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostAddress());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getCanonicalHostName());
rq.customize(e, request);

}

Expand Down

0 comments on commit ee3b9c9

Please sign in to comment.