Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Commit

Permalink
Make certDir configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
bviktor committed Jun 30, 2016
1 parent 72d77fc commit 447d0af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/bviktor/certzure/Certzure.java
Expand Up @@ -38,7 +38,6 @@ public class Certzure
com.microsoft.windowsazure.credentials.Exports.class, com.microsoft.windowsazure.management.configuration.Exports.class };
}

static final String certDir = "/etc/letsencrypt/live";
static final String settingsFileName = "certzure.properties";
static final String challengeString = "_acme-challenge";
static final String[] supportedOperations = { "deploy_challenge", "clean_challenge", "deploy_cert" };
Expand Down Expand Up @@ -251,7 +250,7 @@ public static boolean httpSuccess(int code)
}
}

public static String checkCert(String domainName)
public static String checkCert(String certDir, String domainName)
{
InputStream inStream = null;
String body = "";
Expand Down Expand Up @@ -359,8 +358,8 @@ public static boolean cleanChallenge(DnsManagementClient dnsClient, String resou
}
}

public static boolean deployCert(String domainName, String smtpHost, int smtpPort, String smtpSender, String smtpRcpt, String smtpUser, String smtpPassword, boolean smtpSsl,
boolean smtpStartTls)
public static boolean deployCert(String certDir, String domainName, String smtpHost, int smtpPort, String smtpSender, String smtpRcpt, String smtpUser, String smtpPassword,
boolean smtpSsl, boolean smtpStartTls)
{
Email email = new SimpleEmail();
email.setHostName(smtpHost);
Expand All @@ -382,7 +381,7 @@ public static boolean deployCert(String domainName, String smtpHost, int smtpPor
{
email.setFrom(smtpSender);
email.addTo(smtpRcpt);
email.setMsg(checkCert(domainName));
email.setMsg(checkCert(certDir, domainName));
email.send();
}
catch (EmailException e)
Expand Down Expand Up @@ -455,6 +454,7 @@ public static void main(String[] args)
String username = parseProperty(properties, "username");
String password = parseProperty(properties, "password");
String resourceGroupName = parseProperty(properties, "resourceGroupName");
String certDir = parseProperty(properties, "certDir");
String smtpHost = parseProperty(properties, "smtpHost");
String smtpPortString = parseProperty(properties, "smtpPort");
String smtpSender = parseProperty(properties, "smtpSender");
Expand All @@ -480,8 +480,8 @@ else if (operationName.equals("clean_challenge"))
}
else if (operationName.equals("deploy_cert"))
{
deployCert(domainName, smtpHost, Integer.parseInt(smtpPortString), smtpSender, smtpRcpt, smtpUser, smtpPassword, smtpSslString.equals("true") ? true : false,
smtpStartTlsString.equals("true") ? true : false);
deployCert(certDir, domainName, smtpHost, Integer.parseInt(smtpPortString), smtpSender, smtpRcpt, smtpUser, smtpPassword,
smtpSslString.equals("true") ? true : false, smtpStartTlsString.equals("true") ? true : false);
}
}
catch (Exception e)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/certzure.properties.example
Expand Up @@ -5,6 +5,7 @@ password = "whatever"
keyStoreLocation = "c:\\azure.pfx"
keyStorePassword = "whatnever"
resourceGroupName = "DNSGroup"
certDir = "/opt/letsencrypt.sh"
smtpHost = "smtp.office365.com"
smtpPort = "587"
smtpSender = "certzure@foobar.com"
Expand Down

0 comments on commit 447d0af

Please sign in to comment.