Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ There are a few more options :
- logfile : send logs to this file instead of stdout
- logfilesize : maximum size of each log file (default 10M)
- logfilenumber : number of rotated log files (default 5)
- disableLegacySSL : disable using SSLv2Hello and SSLv3 protocols

15 changes: 12 additions & 3 deletions src/main/java/info/fetter/logstashforwarder/Forwarder.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class Forwarder {
private static String logfileSize = "10MB";
private static int logfileNumber = 5;
private static String sincedbFile = SINCEDB;
private static boolean legacySslDisabled = false;

public static void main(String[] args) {
try {
Expand Down Expand Up @@ -154,6 +155,7 @@ static void parseOptions(String[] args) {
Option debugWatcherOption = new Option("debugwatcher", "operate watcher in debug mode");
Option traceOption = new Option("trace", "operate in trace mode");
Option tailOption = new Option("tail", "read new files from the end");
Option disableLegacySSL = new Option("disableLegacySSL", "disable using SSLv2Hello and SSLv3 protocols");

Option spoolSizeOption = OptionBuilder.withArgName("number of events")
.hasArg()
Expand Down Expand Up @@ -202,7 +204,8 @@ static void parseOptions(String[] args) {
.addOption(logfileOption)
.addOption(logfileNumberOption)
.addOption(logfileSizeOption)
.addOption(sincedbOption);
.addOption(sincedbOption)
.addOption(disableLegacySSL);

CommandLineParser parser = new GnuParser();
try {
Expand Down Expand Up @@ -246,13 +249,16 @@ static void parseOptions(String[] args) {
if(line.hasOption("sincedb")) {
sincedbFile = line.getOptionValue("sincedb");
}
if(line.hasOption("disableLegacySSL")) {
legacySslDisabled = true;
}
} catch(ParseException e) {
printHelp(options);
System.exit(1);;
System.exit(1);
} catch(NumberFormatException e) {
System.err.println("Value must be an integer");
printHelp(options);
System.exit(2);;
System.exit(2);
}
}

Expand Down Expand Up @@ -284,4 +290,7 @@ private static void setupLogging() throws IOException {
// Logger.getLogger(FileReader.class).setAdditivity(false);
}

public static boolean isLegacySslDisabled() {
return legacySslDisabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import info.fetter.logstashforwarder.Event;
import info.fetter.logstashforwarder.Forwarder;
import info.fetter.logstashforwarder.ProtocolAdapter;
import info.fetter.logstashforwarder.util.AdapterException;

Expand All @@ -32,9 +33,7 @@
import java.net.ProtocolException;
import java.net.Socket;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.zip.Deflater;

import javax.net.ssl.SSLContext;
Expand Down Expand Up @@ -88,6 +87,15 @@ public LumberjackClient(String keyStorePath, String server, int port, int timeou
socket.connect(new InetSocketAddress(InetAddress.getByName(server), port), timeout);
socket.setSoTimeout(timeout);
sslSocket = (SSLSocket)socketFactory.createSocket(socket, server, port, true);
if(Forwarder.isLegacySslDisabled()) {
String[] protocols = sslSocket.getEnabledProtocols();
Set<String> set = new HashSet<String>();
for (String s : protocols) {
if (s.equals("SSLv3") || s.equals("SSLv2Hello")) continue;
set.add(s);
}
sslSocket.setEnabledProtocols(set.toArray(new String[0]));
}
sslSocket.setUseClientMode(true);
sslSocket.startHandshake();

Expand Down