Browse Source

Simplify onion routing of email

Bob Mottram 7 years ago
parent
commit
741c1c5bef
1 changed files with 29 additions and 27 deletions
  1. 29
    27
      src/freedombone-base-email

+ 29
- 27
src/freedombone-base-email View File

@@ -31,6 +31,9 @@
31 31
 # the default email address
32 32
 MY_EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
33 33
 
34
+# When sending mail to riseup.net route to this onion address
35
+RISEUP_EMAIL_ONION='wy6zk3pmcwiyhiao.onion'
36
+
34 37
 # If you want to run a public mailing list specify its name here.
35 38
 # There should be no spaces in the name
36 39
 PUBLIC_MAILING_LIST=
@@ -149,51 +152,50 @@ function configure_email_onion {
149 152
     set_completion_param "email onion domain" "${onion_address}"
150 153
     add_email_hostname "$onion_address"
151 154
 
152
-    apt-get -yq install tinycdb perl
155
+    #apt-get -yq install tinycdb perl
153 156
 
154 157
     # MX record should be:
155 158
     # _onion-mx._tcp.$DEFAULT_DOMAIN_NAME. 3600 IN SRV 0 5 25 $onion_address
156 159
 
157
-    echo "$DEFAULT_DOMAIN_NAME $onion_address" > /etc/exim4/onionrelay.txt
158
-    cdb -m -c -t ~/onionrelay.tmp /etc/exim4/onionrelay.cdb /etc/exim4/onionrelay.txt
160
+    #echo "$DEFAULT_DOMAIN_NAME $onion_address" > /etc/exim4/onionrelay.txt
161
+    #cdb -m -c -t ~/onionrelay.tmp /etc/exim4/onionrelay.cdb /etc/exim4/onionrelay.txt
159 162
 
160
-    { echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
161
-      echo "perl_at_start"; } > /etc/exim4/conf.d/main/perl
163
+    #{ echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
164
+    #  echo "perl_at_start"; } > /etc/exim4/conf.d/main/perl
162 165
 
163
-    { echo "use Net::DNS::Resolver;";
164
-      echo "sub onionLookup {";
165
-      echo "  my \$hostname = shift;";
166
-      echo "  my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
167
-      echo "  \$res->port(5300);";
168
-      echo "  my \$query = \$res->search(\$hostname);";
169
-      echo "  foreach my \$rr (\$query->answer) {";
170
-      echo "    next unless \$rr->type eq \"A\";";
171
-      echo "    return \$rr->address;";
172
-      echo "  }";
173
-      echo "  return 'no_such_host';";
174
-      echo "}"; } > /etc/exim4/perl-routines.pl
166
+    #{ echo "use Net::DNS::Resolver;";
167
+    #  echo "sub onionLookup {";
168
+    #  echo "  my \$hostname = shift;";
169
+    #  echo "  my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
170
+    #  echo "  \$res->port(5300);";
171
+    #  echo "  my \$query = \$res->search(\$hostname);";
172
+    #  echo "  foreach my \$rr (\$query->answer) {";
173
+    #  echo "    next unless \$rr->type eq \"A\";";
174
+    #  echo "    return \$rr->address;";
175
+    #  echo "  }";
176
+    #  echo "  return 'no_such_host';";
177
+    #  echo "}"; } > /etc/exim4/perl-routines.pl
175 178
 
176
-    { echo "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
177
-      echo "domainlist onion_relays     = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/main/48_exim4-config_onion_relays
179
+    #{ echo "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
180
+    #  echo "domainlist onion_relays     = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/main/48_exim4-config_onion_relays
178 181
 
179 182
     { echo "riseup:";
180 183
       echo "  driver    = manualroute";
181
-      echo "  domains   = riseup.net";
184
+      echo "  domains   = riseup.net $RISEUP_EMAIL_ONION";
182 185
       echo "  transport = onion_relay";
183
-      echo "  route_data = \${lookup dnsdb{a=wy6zk3pmcwiyhiao.onion}}";
184
-      echo "  no_more"; } > /etc/exim4/conf.d/router/49_exim4-config-riseup
186
+      echo "  route_data = \${lookup dnsdb{a=$RISEUP_EMAIL_ONION}}";
187
+      echo "  no_more"; } > /etc/exim4/conf.d/router/049_exim4-config-riseup
185 188
 
186 189
     { echo "onionrelays:";
187 190
       echo "  driver    = manualroute";
188
-      echo "  domains   = +onion_relays";
191
+      echo "  domains   = *.onion";
189 192
       echo "  transport = onion_relay";
190
-      echo "  # get the automap IP for the onion address from the tor daemon";
191
-      echo "  route_data = \${perl{onionLookup}{\${lookup{\$domain}cdb{ONION_RELAYDB}}}}";
192
-      echo "  no_more"; } > /etc/exim4/conf.d/router/50_exim4-config-onionrelays
193
+      echo "  route_data = \${lookup dnsdb{a=\$domain}}";
194
+      echo "  no_more"; } > /etc/exim4/conf.d/router/050_exim4-config-onionrelays
193 195
 
194 196
     { echo "onion_relay:";
195 197
       echo "  driver = smtp";
196
-      echo "  socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/50_exim4-config_onion_relay
198
+      echo "  socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/050_exim4-config_onion_relay
197 199
 
198 200
     if ! grep -q "AutomapHostsOnResolve" /etc/tor/torrc; then
199 201
         echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc