|
@@ -156,37 +156,37 @@ function configure_email_onion {
|
156
|
156
|
echo "$DEFAULT_DOMAIN_NAME $onion_address" > /etc/exim4/onionrelay.txt
|
157
|
157
|
cdb -m -c -t ~/onionrelay.tmp /etc/exim4/onionrelay.cdb /etc/exim4/onionrelay.txt
|
158
|
158
|
|
159
|
|
- { "perl_startup = do '/etc/exim4/perl-routines.pl'";
|
160
|
|
- "perl_at_start"; } > /etc/exim4/conf.d/main/perl
|
161
|
|
-
|
162
|
|
- { "use Net::DNS::Resolver;";
|
163
|
|
- "sub onionLookup {";
|
164
|
|
- " my \$hostname = shift;";
|
165
|
|
- " my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
|
166
|
|
- " \$res->port(5300);";
|
167
|
|
- " my \$query = \$res->search(\$hostname);";
|
168
|
|
- " foreach my \$rr (\$query->answer) {";
|
169
|
|
- " next unless \$rr->type eq \"A\";";
|
170
|
|
- " return \$rr->address;";
|
171
|
|
- " }";
|
172
|
|
- " return 'no_such_host';";
|
173
|
|
- "}"; } > /etc/exim4/perl-routines.pl
|
174
|
|
-
|
175
|
|
- { "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
|
176
|
|
- "domainlist onion_relays = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/domainlists
|
177
|
|
-
|
178
|
|
- { "# send things over tor where we have an entry for it";
|
179
|
|
- "onionrelays:";
|
180
|
|
- " driver = manualroute";
|
181
|
|
- " domains = +onion_relays";
|
182
|
|
- " transport = onion_relay";
|
183
|
|
- " # get the automap IP for the onion address from the tor daemon";
|
184
|
|
- " route_data = \${perl{onionLookup}{\${lookup{\$domain}cdb{ONION_RELAYDB}}}}";
|
185
|
|
- " no_more"; } > /etc/exim4/conf.d/router/50_exim4-config-onion
|
186
|
|
-
|
187
|
|
- { "onion_relay:";
|
188
|
|
- " driver = smtp";
|
189
|
|
- " socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/50_exim4-config_onion
|
|
159
|
+ { echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
|
|
160
|
+ echo "perl_at_start"; } > /etc/exim4/conf.d/main/perl
|
|
161
|
+
|
|
162
|
+ { echo "use Net::DNS::Resolver;";
|
|
163
|
+ echo "sub onionLookup {";
|
|
164
|
+ echo " my \$hostname = shift;";
|
|
165
|
+ echo " my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
|
|
166
|
+ echo " \$res->port(5300);";
|
|
167
|
+ echo " my \$query = \$res->search(\$hostname);";
|
|
168
|
+ echo " foreach my \$rr (\$query->answer) {";
|
|
169
|
+ echo " next unless \$rr->type eq \"A\";";
|
|
170
|
+ echo " return \$rr->address;";
|
|
171
|
+ echo " }";
|
|
172
|
+ echo " return 'no_such_host';";
|
|
173
|
+ echo "}"; } > /etc/exim4/perl-routines.pl
|
|
174
|
+
|
|
175
|
+ { echo "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
|
|
176
|
+ echo "domainlist onion_relays = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/domainlists
|
|
177
|
+
|
|
178
|
+ { echo "# send things over tor where we have an entry for it";
|
|
179
|
+ echo "onionrelays:";
|
|
180
|
+ echo " driver = manualroute";
|
|
181
|
+ echo " domains = +onion_relays";
|
|
182
|
+ echo " transport = onion_relay";
|
|
183
|
+ echo " # get the automap IP for the onion address from the tor daemon";
|
|
184
|
+ echo " route_data = \${perl{onionLookup}{\${lookup{\$domain}cdb{ONION_RELAYDB}}}}";
|
|
185
|
+ echo " no_more"; } > /etc/exim4/conf.d/router/50_exim4-config-onion
|
|
186
|
+
|
|
187
|
+ { echo "onion_relay:";
|
|
188
|
+ echo " driver = smtp";
|
|
189
|
+ echo " socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/50_exim4-config_onion
|
190
|
190
|
|
191
|
191
|
if ! grep -q "AutomapHostsOnResolve" /etc/tor/torrc; then
|
192
|
192
|
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
|