Browse Source

Show onion email address on user control panel

Bob Mottram 7 years ago
parent
commit
a9c16b9986
5 changed files with 41 additions and 6 deletions
  1. 1
    0
      Makefile
  2. 7
    3
      src/freedombone-base-email
  3. 18
    3
      src/freedombone-controlpanel-user
  4. 1
    0
      src/freedombone-upgrade
  5. 14
    0
      src/freedombone-utils-web

+ 1
- 0
Makefile View File

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

+ 7
- 3
src/freedombone-base-email View File

225
 }
225
 }
226
 
226
 
227
 function create_email_onion_address {
227
 function create_email_onion_address {
228
+    email_hostname='/var/lib/tor/hidden_service_email/hostname'
228
     if ! grep -q "hidden_service_email" /etc/tor/torrc; then
229
     if ! grep -q "hidden_service_email" /etc/tor/torrc; then
229
         { echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/';
230
         { echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/';
230
           echo 'HiddenServiceVersion 3';
231
           echo 'HiddenServiceVersion 3';
238
         function_check wait_for_onion_service
239
         function_check wait_for_onion_service
239
         wait_for_onion_service email
240
         wait_for_onion_service email
240
 
241
 
241
-        if [ ! -f /var/lib/tor/hidden_service_email/hostname ]; then
242
+        if [ ! -f $email_hostname ]; then
242
             echo $"email onion site hostname not found"
243
             echo $"email onion site hostname not found"
243
             systemctl restart tor
244
             systemctl restart tor
244
             exit 782352
245
             exit 782352
245
         fi
246
         fi
246
 
247
 
247
-        onion_address=$(cat /var/lib/tor/hidden_service_email/hostname)
248
+        onion_address=$(cat $email_hostname)
248
         set_completion_param "email onion domain" "${onion_address}"
249
         set_completion_param "email onion domain" "${onion_address}"
249
         add_email_hostname "$onion_address"
250
         add_email_hostname "$onion_address"
250
     else
251
     else
251
-        onion_address=$(cat /var/lib/tor/hidden_service_email/hostname)
252
+        onion_address=$(cat $email_hostname)
252
     fi
253
     fi
254
+    cp $email_hostname /etc/skel/.email_onion_domain
255
+    cp $email_hostname "/home/$MY_USERNAME/.email_onion_domain"
256
+    chown "$MY_USERNAME":"$MY_USERNAME" "/home/$MY_USERNAME/.email_onion_domain"
253
 }
257
 }
254
 
258
 
255
 function configure_email_onion {
259
 function configure_email_onion {

+ 18
- 3
src/freedombone-controlpanel-user View File

852
 function show_your_email_address {
852
 function show_your_email_address {
853
     GPG_FINGERPRINT=$(gpg --fingerprint "$GPG_ID" | sed -n '2p' | sed 's/^[ \t]*//')
853
     GPG_FINGERPRINT=$(gpg --fingerprint "$GPG_ID" | sed -n '2p' | sed 's/^[ \t]*//')
854
     GPG_DATE=$(gpg --fingerprint "$GPG_ID" | grep -i "pub" | head -n 1 | awk -F ' ' '{print $3}')
854
     GPG_DATE=$(gpg --fingerprint "$GPG_ID" | grep -i "pub" | head -n 1 | awk -F ' ' '{print $3}')
855
+    onion_domain=
856
+    if [ -f "$HOME/.email_onion_domain" ]; then
857
+        onion_domain=$(cat "$HOME/.email_onion_domain")
858
+    fi
859
+    if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
860
+        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"
861
+    else
862
+        msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
863
+    fi
855
     if [ ! -f ~/.mutt/bdsmail ]; then
864
     if [ ! -f ~/.mutt/bdsmail ]; then
856
-        dialog --title $"Show your Email Address" \
857
-               --backtitle $"Freedombone User Control Panel" \
858
-               --msgbox $"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE" 12 100
865
+        if [[ "$HOSTNAME" != *'.onion' ]]; then
866
+            dialog --title $"Show your Email Address" \
867
+                   --backtitle $"Freedombone User Control Panel" \
868
+                   --msgbox "$msgstr" 14 100
869
+        else
870
+            dialog --title $"Show your Email Address" \
871
+                   --backtitle $"Freedombone User Control Panel" \
872
+                   --msgbox "$msgstr" 12 100
873
+        fi
859
     else
874
     else
860
         bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
875
         bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
861
         dialog --title $"Show your Email Address" \
876
         dialog --title $"Show your Email Address" \

+ 1
- 0
src/freedombone-upgrade View File

102
         email_install_tls
102
         email_install_tls
103
         email_disable_chunking
103
         email_disable_chunking
104
         rm /etc/exim4/exim4.conf.template.bak*
104
         rm /etc/exim4/exim4.conf.template.bak*
105
+        email_update_onion_domain
105
         #defrag_filesystem
106
         #defrag_filesystem
106
 
107
 
107
         # reinstall tor from backports
108
         # reinstall tor from backports

+ 14
- 0
src/freedombone-utils-web View File

1006
     systemctl restart exim4
1006
     systemctl restart exim4
1007
 }
1007
 }
1008
 
1008
 
1009
+function email_update_onion_domain {
1010
+    email_hostname='/var/lib/tor/hidden_service_email/hostname'
1011
+
1012
+    cp $email_hostname /etc/skel/.email_onion_domain
1013
+
1014
+    for d in /home/*/ ; do
1015
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
1016
+        if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
1017
+            cp $email_hostname "/home/$USERNAME/.email_onion_domain"
1018
+            chown "$USERNAME":"$USERNAME" "/home/$USERNAME/.email_onion_domain"
1019
+        fi
1020
+    done
1021
+}
1022
+
1009
 function email_install_tls {
1023
 function email_install_tls {
1010
     tls_config_file=/etc/exim4/conf.d/main/03_exim4-config_tlsoptions
1024
     tls_config_file=/etc/exim4/conf.d/main/03_exim4-config_tlsoptions
1011
     tls_auth_config_file=/etc/exim4/conf.d/auth/30_exim4-config_examples
1025
     tls_auth_config_file=/etc/exim4/conf.d/auth/30_exim4-config_examples