Sfoglia il codice sorgente

Building exim with socks support

Bob Mottram 7 anni fa
parent
commit
29bc38dace
1 ha cambiato i file con 46 aggiunte e 18 eliminazioni
  1. 46
    18
      src/freedombone-base-email

+ 46
- 18
src/freedombone-base-email Vedi File

@@ -71,6 +71,33 @@ GPGIT_COMMIT='583dc76119f19420f8a33f606744faa7c8922738'
71 71
 # refresh gpg keys every few hours
72 72
 REFRESH_GPG_KEYS_HOURS=2
73 73
 
74
+exim_version='4.89'
75
+
76
+function rebuild_exim_with_socks {
77
+    # shellcheck disable=SC2154
78
+    if [ ! -d "$INSTALL_DIR" ]; then
79
+        mkdir -p "$INSTALL_DIR/exim4"
80
+    fi
81
+    cd "$INSTALL_DIR/exim4" || exit 3468356
82
+    rm -rf "$INSTALL_DIR/exim4/"*
83
+    apt-get source exim4-daemon-heavy
84
+    apt-get -qy build-dep exim4-daemon-heavy
85
+    cd "${INSTALL_DIR}/exim4/exim4-*" || exit 356835685
86
+    cp src/EDITME Local/Makefile
87
+    sed -i 's|# SUPPORT_SOCKS|SUPPORT_SOCKS|g' Local/Makefile
88
+    # TODO how to make this non-interactive
89
+    dpkg-source --commit . SOCKS
90
+    debuild -us -uc
91
+    cd "$INSTALL_DIR/exim4" || exit 3468356
92
+    mv exim4_${exim_version}-*.deb exim4_${exim_version}_all.deb
93
+    if [ ! -f exim4_${exim_version}_all.deb ]; then
94
+        ls -l "$INSTALL_DIR/exim4/"*.deb
95
+        echo "exim4_${exim_version}_all.deb not found"
96
+        exit 63857368
97
+    fi
98
+    dpkg -i exim4_${exim_version}_all.deb
99
+}
100
+
74 101
 function email_create_template {
75 102
     if [ ! -d /etc/skel/log ]; then
76 103
         mkdir -m 700 /etc/skel/log
@@ -170,37 +197,38 @@ function configure_email_onion {
170 197
     #echo "$DEFAULT_DOMAIN_NAME $onion_address" > /etc/exim4/onionrelay.txt
171 198
     #cdb -m -c -t ~/onionrelay.tmp /etc/exim4/onionrelay.cdb /etc/exim4/onionrelay.txt
172 199
 
173
-    #{ echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
174
-    #  echo "perl_at_start"; } > /etc/exim4/conf.d/main/perl
175
-
176
-    #{ echo "use Net::DNS::Resolver;";
177
-    #  echo "sub onionLookup {";
178
-    #  echo "  my \$hostname = shift;";
179
-    #  echo "  my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
180
-    #  echo "  \$res->port(5300);";
181
-    #  echo "  my \$query = \$res->search(\$hostname);";
182
-    #  echo "  foreach my \$rr (\$query->answer) {";
183
-    #  echo "    next unless \$rr->type eq \"A\";";
184
-    #  echo "    return \$rr->address;";
185
-    #  echo "  }";
186
-    #  echo "  return 'no_such_host';";
187
-    #  echo "}"; } > /etc/exim4/perl-routines.pl
200
+    { echo "perl_startup = do '/etc/exim4/perl-routines.pl'";
201
+      echo "perl_at_start"; } > /etc/exim4/conf.d/main/00_exim4-config_perl
202
+
203
+    { echo "use Net::DNS::Resolver;";
204
+      echo "sub onionLookup {";
205
+      echo "  my \$hostname = shift;";
206
+      echo "  my \$res = Net::DNS::Resolver->new(nameservers => [qw(127.0.0.1)],);";
207
+      echo "  \$res->port(5300);";
208
+      echo "  my \$query = \$res->search(\$hostname);";
209
+      echo "  foreach my \$rr (\$query->answer) {";
210
+      echo "    next unless \$rr->type eq \"A\";";
211
+      echo "    return \$rr->address;";
212
+      echo "  }";
213
+      echo "  return 'no_such_host';";
214
+      echo "}"; } > /etc/exim4/perl-routines.pl
188 215
 
189 216
     #{ echo "ONION_RELAYDB=/etc/exim4/onionrelay.cdb";
190 217
     #  echo "domainlist onion_relays     = cdb;ONION_RELAYDB"; } > /etc/exim4/conf.d/main/48_exim4-config_onion_relays
191 218
 
192 219
     { echo "riseup:";
193 220
       echo "  driver    = manualroute";
194
-      echo "  domains   = riseup.net $RISEUP_EMAIL_ONION";
221
+      echo "  domains   = riseup.net";
195 222
       echo "  transport = onion_relay";
196
-      echo "  route_data = \${lookup dnsdb{a=$RISEUP_EMAIL_ONION}}";
223
+      echo "  route_data = \${perl{onionLookup}{$RISEUP_EMAIL_ONION}}"
197 224
       echo "  no_more"; } > /etc/exim4/conf.d/router/049_exim4-config-riseup
198 225
 
199 226
     { echo "onionrelays:";
200 227
       echo "  driver    = manualroute";
201 228
       echo "  domains   = *.onion";
202 229
       echo "  transport = onion_relay";
203
-      echo "  route_data = \${lookup dnsdb{a=\$domain}}";
230
+      #echo "  route_data = \${lookup dnsdb{a=\$domain}}";
231
+      echo "  route_data = \${perl{onionLookup}{\$domain}}"
204 232
       echo "  no_more"; } > /etc/exim4/conf.d/router/050_exim4-config-onionrelays
205 233
 
206 234
     { echo "onion_relay:";