Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Adding SSL Support #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
31 changes: 31 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,34 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey-version>1.6</jersey-version>
</properties>
<repositories>
<repository>
<id>pircbot</id>
<url>file://${project.basedir}/repository/</url>
</repository>
</repositories>
<dependencies>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>pircbot</groupId>
<artifactId>pircbot</artifactId>
<version>1.5.0</version>
</dependency>
-->
<dependency>
<groupId>pircbot</groupId>
<artifactId>pircbot-ssl</artifactId>
<version>1.5.0</version>
<!--<scope>system</scope>-->
<!--<systemPath>${project.basedir}/dependency/pircbot-1.5.0-ssl.jar</systemPath>-->
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
Expand Down Expand Up @@ -84,6 +100,11 @@
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
Expand All @@ -98,6 +119,15 @@
<build>
<finalName>PushBot</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
Expand Down Expand Up @@ -140,6 +170,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archive>
<manifest>
Expand Down
Binary file not shown.
9 changes: 9 additions & 0 deletions repository/pircbot/pircbot-ssl/1.5.0/pircbot-ssl-1.5.0.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>pircbot</groupId>
<artifactId>pircbot-ssl</artifactId>
<version>1.5.0</version>
<description>POM was created from install:install-file</description>
</project>
12 changes: 12 additions & 0 deletions repository/pircbot/pircbot-ssl/maven-metadata-local.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>pircbot</groupId>
<artifactId>pircbot-ssl</artifactId>
<versioning>
<release>1.5.0</release>
<versions>
<version>1.5.0</version>
</versions>
<lastUpdated>20160601161756</lastUpdated>
</versioning>
</metadata>
22 changes: 18 additions & 4 deletions src/main/java/com/etsy/pushbot/PushBot.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.etsy.pushbot;

import com.etsy.pushbot.command.TrainCommand;
import com.etsy.pushbot.config.ConfigServer;
import com.etsy.pushbot.config.Status;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import com.etsy.pushbot.config.ConfigServer;
import com.etsy.pushbot.config.Status;
import org.apache.commons.cli.CommandLineParser;
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
Expand Down Expand Up @@ -258,6 +259,10 @@ public static void main(String[] args)
option.setRequired(false);
options.addOption(option);

option = new Option("s", "ssl", false, "Use SSL");
option.setRequired(false);
options.addOption(option);

option = new Option("g", "graphite-enabled", false, "Set to true to log stats to graphite");
options.addOption(option);

Expand All @@ -280,6 +285,7 @@ public static void main(String[] args)
System.err.println(" -h,--irc-host IRCD hostname");
System.err.println(" -p,--irc-port IRCD port");
System.err.println(" -a,--irc-passwod Optional IRCD server password");
System.err.println(" -s,--ssl Connect using SSL");
System.err.println(" -g,--graphite-enabled Enable graphite logging");
System.err.println(" -r,--graphite-host Graphite hostname");
System.err.println(" -t,--graphite-port Graphite port");
Expand All @@ -299,11 +305,19 @@ public static void main(String[] args)
commandLine.getOptionValue('r', null),
Integer.valueOf(commandLine.getOptionValue('t', "2003")));

SSLSocketFactory socketFactory = null;

if (commandLine.hasOption('s')) {
socketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
}

// Connect to IRCD
pushBot.connect(
commandLine.getOptionValue('h'),
Integer.valueOf(commandLine.getOptionValue('p')),
commandLine.getOptionValue('a', null));
commandLine.getOptionValue('a', null),
socketFactory
);

// Launch the web interface
ConfigServer configServer = new ConfigServer(pushBot);
Expand Down