From e08055163923039e2545c3d252fa212240dfcc54 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Sun, 25 Dec 2016 17:28:47 +0000
Subject: [PATCH] Include ssh onion address as an email domain

---
 src/freedombone-base-email  | 11 -----------
 src/freedombone-utils-onion | 12 ++++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/freedombone-base-email b/src/freedombone-base-email
index d01b3edd5..ec3b7b053 100755
--- a/src/freedombone-base-email
+++ b/src/freedombone-base-email
@@ -73,17 +73,6 @@ GPGIT_COMMIT='583dc76119f19420f8a33f606744faa7c8922738'
 # refresh gpg keys every few hours
 REFRESH_GPG_KEYS_HOURS=2
 
-function add_email_hostname {
-    extra_email_hostname="$1"
-    email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
-    if [[ "$email_hostnames" != *"$extra_email_hostname"* ]]; then
-        sed -i "s|dc_other_hostnames=.*|dc_other_hostnames='$emailhostnames;extra_email_hostname'|g" /etc/exim4/update-exim4.conf.conf
-        update-exim4.conf
-        dpkg-reconfigure --frontend noninteractive exim4-config
-        systemctl restart saslauthd
-    fi
-}
-
 function configure_email_onion {
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
         return
diff --git a/src/freedombone-utils-onion b/src/freedombone-utils-onion
index 1f32f46f1..6b30f6e79 100755
--- a/src/freedombone-utils-onion
+++ b/src/freedombone-utils-onion
@@ -28,6 +28,17 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+function add_email_hostname {
+    extra_email_hostname="$1"
+    email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
+    if [[ "$email_hostnames" != *"$extra_email_hostname"* ]]; then
+        sed -i "s|dc_other_hostnames=.*|dc_other_hostnames='$emailhostnames;extra_email_hostname'|g" /etc/exim4/update-exim4.conf.conf
+        update-exim4.conf
+        dpkg-reconfigure --frontend noninteractive exim4-config
+        systemctl restart saslauthd
+    fi
+}
+
 function onion_update {
     # update so that new onion services appear
     systemctl reload tor
@@ -231,6 +242,7 @@ function configure_ssh_onion {
     SSH_ONION_HOSTNAME=$(add_onion_service ssh ${SSH_PORT} ${SSH_PORT})
 
     set_completion_param "ssh onion domain" "${SSH_ONION_HOSTNAME}"
+    add_email_hostname "${SSH_ONION_HOSTNAME}"
 
     mark_completed $FUNCNAME
 }
-- 
GitLab