Show onion email address on user control panel

This commit is contained in:
Bob Mottram 2018-04-07 11:05:26 +01:00
parent b9cb250613
commit a9c16b9986
5 changed files with 41 additions and 6 deletions

View File

@ -50,6 +50,7 @@ install:
chmod -R +r /usr/share/${APP}
# bash -c "./translate install"
/usr/local/bin/${APP}-prepare-scripts
# copy email onion domain to somewhere where it's accessible to users
uninstall:
rm -f ${PREFIX}/share/${APP}_*.png
rm -f ${PREFIX}/share/man/man1/backup.1.gz

View File

@ -225,6 +225,7 @@ function email_create_template {
}
function create_email_onion_address {
email_hostname='/var/lib/tor/hidden_service_email/hostname'
if ! grep -q "hidden_service_email" /etc/tor/torrc; then
{ echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/';
echo 'HiddenServiceVersion 3';
@ -238,18 +239,21 @@ function create_email_onion_address {
function_check wait_for_onion_service
wait_for_onion_service email
if [ ! -f /var/lib/tor/hidden_service_email/hostname ]; then
if [ ! -f $email_hostname ]; then
echo $"email onion site hostname not found"
systemctl restart tor
exit 782352
fi
onion_address=$(cat /var/lib/tor/hidden_service_email/hostname)
onion_address=$(cat $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)
onion_address=$(cat $email_hostname)
fi
cp $email_hostname /etc/skel/.email_onion_domain
cp $email_hostname "/home/$MY_USERNAME/.email_onion_domain"
chown "$MY_USERNAME":"$MY_USERNAME" "/home/$MY_USERNAME/.email_onion_domain"
}
function configure_email_onion {

View File

@ -852,10 +852,25 @@ function menu_run_client_app {
function show_your_email_address {
GPG_FINGERPRINT=$(gpg --fingerprint "$GPG_ID" | sed -n '2p' | sed 's/^[ \t]*//')
GPG_DATE=$(gpg --fingerprint "$GPG_ID" | grep -i "pub" | head -n 1 | awk -F ' ' '{print $3}')
onion_domain=
if [ -f "$HOME/.email_onion_domain" ]; then
onion_domain=$(cat "$HOME/.email_onion_domain")
fi
if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
else
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
fi
if [ ! -f ~/.mutt/bdsmail ]; then
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox $"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE" 12 100
if [[ "$HOSTNAME" != *'.onion' ]]; then
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "$msgstr" 14 100
else
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "$msgstr" 12 100
fi
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
dialog --title $"Show your Email Address" \

View File

@ -102,6 +102,7 @@ if [ -d "$PROJECT_DIR" ]; then
email_install_tls
email_disable_chunking
rm /etc/exim4/exim4.conf.template.bak*
email_update_onion_domain
#defrag_filesystem
# reinstall tor from backports

View File

@ -1006,6 +1006,20 @@ function email_disable_chunking {
systemctl restart exim4
}
function email_update_onion_domain {
email_hostname='/var/lib/tor/hidden_service_email/hostname'
cp $email_hostname /etc/skel/.email_onion_domain
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
cp $email_hostname "/home/$USERNAME/.email_onion_domain"
chown "$USERNAME":"$USERNAME" "/home/$USERNAME/.email_onion_domain"
fi
done
}
function email_install_tls {
tls_config_file=/etc/exim4/conf.d/main/03_exim4-config_tlsoptions
tls_auth_config_file=/etc/exim4/conf.d/auth/30_exim4-config_examples