This commit is contained in:
Bob Mottram 2018-03-23 17:17:31 +00:00
parent 2a4f71ddf4
commit 9754e7c21d
1 changed files with 27 additions and 27 deletions

View File

@ -156,37 +156,37 @@ function configure_email_onion {
echo "$DEFAULT_DOMAIN_NAME $onion_address" > /etc/exim4/onionrelay.txt
cdb -m -c -t ~/onionrelay.tmp /etc/exim4/onionrelay.cdb /etc/exim4/onionrelay.txt
{ "perl_startup = do '/etc/exim4/perl-routines.pl'";
"perl_at_start"; } > /etc/exim4/conf.d/main/perl
{ echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
echo "perl_at_start"; } > /etc/exim4/conf.d/main/perl
{ "use Net::DNS::Resolver;";
"sub onionLookup {";
" my \$hostname = shift;";
" my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
" \$res->port(5300);";
" my \$query = \$res->search(\$hostname);";
" foreach my \$rr (\$query->answer) {";
" next unless \$rr->type eq \"A\";";
" return \$rr->address;";
" }";
" return 'no_such_host';";
"}"; } > /etc/exim4/perl-routines.pl
{ echo "use Net::DNS::Resolver;";
echo "sub onionLookup {";
echo " my \$hostname = shift;";
echo " my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
echo " \$res->port(5300);";
echo " my \$query = \$res->search(\$hostname);";
echo " foreach my \$rr (\$query->answer) {";
echo " next unless \$rr->type eq \"A\";";
echo " return \$rr->address;";
echo " }";
echo " return 'no_such_host';";
echo "}"; } > /etc/exim4/perl-routines.pl
{ "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
"domainlist onion_relays = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/domainlists
{ echo "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
echo "domainlist onion_relays = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/domainlists
{ "# send things over tor where we have an entry for it";
"onionrelays:";
" driver = manualroute";
" domains = +onion_relays";
" transport = onion_relay";
" # get the automap IP for the onion address from the tor daemon";
" route_data = \${perl{onionLookup}{\${lookup{\$domain}cdb{ONION_RELAYDB}}}}";
" no_more"; } > /etc/exim4/conf.d/router/50_exim4-config-onion
{ echo "# send things over tor where we have an entry for it";
echo "onionrelays:";
echo " driver = manualroute";
echo " domains = +onion_relays";
echo " transport = onion_relay";
echo " # get the automap IP for the onion address from the tor daemon";
echo " route_data = \${perl{onionLookup}{\${lookup{\$domain}cdb{ONION_RELAYDB}}}}";
echo " no_more"; } > /etc/exim4/conf.d/router/50_exim4-config-onion
{ "onion_relay:";
" driver = smtp";
" socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/50_exim4-config_onion
{ echo "onion_relay:";
echo " driver = smtp";
echo " socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/50_exim4-config_onion
if ! grep -q "AutomapHostsOnResolve" /etc/tor/torrc; then
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc