From 1ad65f7d78e3897da776ba7ef79fb06e26ea1e0b Mon Sep 17 00:00:00 2001
From: neil <git@byneil.com>
Date: Wed, 9 Mar 2016 22:45:05 +0800
Subject: [PATCH] fix compatible to pfsense.  use "-config" for single domain
 to override the default openssl config file.

---
 le.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/le.sh b/le.sh
index cfc927a4..f91fc1de 100755
--- a/le.sh
+++ b/le.sh
@@ -175,7 +175,8 @@ createCSR() {
   if [ -z "$domainlist" ] ; then
     #single domain
     _info "Single domain" $domain
-    openssl req -new -sha256 -key "$CERT_KEY_PATH" -subj "/CN=$domain" > "$CSR_PATH"
+    printf "[ req_distinguished_name ]\n[ req ]\ndistinguished_name = req_distinguished_name\n" > "$DOMAIN_SSL_CONF"
+    openssl req -new -sha256 -key "$CERT_KEY_PATH" -subj "/CN=$domain" -config "$DOMAIN_SSL_CONF" -out "$CSR_PATH"
   else
     alt="DNS:$(echo $domainlist | sed "s/,/,DNS:/g")"
     #multi 
@@ -396,11 +397,11 @@ _initpath() {
     DOMAIN_PATH="$domainhome"
   fi
   if [ -z "$DOMAIN_CONF" ] ; then
-    DOMAIN_CONF="$domainhome/$Le_Domain.conf"
+    DOMAIN_CONF="$domainhome/$domain.conf"
   fi
   
   if [ -z "$DOMAIN_SSL_CONF" ] ; then
-    DOMAIN_SSL_CONF="$domainhome/$Le_Domain.ssl.conf"
+    DOMAIN_SSL_CONF="$domainhome/$domain.ssl.conf"
   fi
   
   if [ -z "$CSR_PATH" ] ; then