Use onion address as the main email address on onion-only installs

This commit is contained in:
Bob Mottram 2018-03-25 18:05:26 +01:00
parent 741c1c5bef
commit 90dd6b1183
1 changed files with 37 additions and 23 deletions

View File

@ -120,21 +120,13 @@ function email_create_template {
fi
}
function configure_email_onion {
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ "$SYSTEM_TYPE" == "mesh"* ]]; then
return
fi
function create_email_onion_address {
if ! grep -q "hidden_service_email" /etc/tor/torrc; then
{ echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/';
echo 'HiddenServiceVersion 3';
echo 'HiddenServicePort 25 127.0.0.1:25';
echo 'HiddenServicePort 587 127.0.0.1:587';
echo 'HiddenServicePort 465 127.0.0.1:465'; } >> /etc/tor/torrc
fi
function_check onion_update
onion_update
@ -151,6 +143,20 @@ function configure_email_onion {
onion_address=$(cat /var/lib/tor/hidden_service_email/hostname)
set_completion_param "email onion domain" "${onion_address}"
add_email_hostname "$onion_address"
else
onion_address=$(cat /var/lib/tor/hidden_service_email/hostname)
fi
}
function configure_email_onion {
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ "$SYSTEM_TYPE" == "mesh"* ]]; then
return
fi
create_email_onion_address
#apt-get -yq install tinycdb perl
@ -218,6 +224,7 @@ function configure_email_onion {
sed -i 's|DNSListenAddress.*|DNSListenAddress 127.0.0.1|g' /etc/tor/torrc
fi
update-exim4.conf.template -r
update-exim4.conf
dpkg-reconfigure --frontend noninteractive exim4-config
systemctl restart tor
@ -247,6 +254,12 @@ function check_email_address_exists {
MY_EMAIL_ADDRESS="${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}"
write_config_param "MY_EMAIL_ADDRESS" "$MY_EMAIL_ADDRESS"
fi
if [[ $ONION_ONLY != 'no' ]]; then
my_email=$onion_address
MY_EMAIL_ADDRESS=$onion_address
write_config_param "MY_EMAIL_ADDRESS" "$MY_EMAIL_ADDRESS"
fi
}
function backup_email {
@ -1543,6 +1556,7 @@ function install_email {
return
fi
create_email_onion_address
check_email_address_exists
install_email_basic
configure_email_onion