]> pere.pagekite.me Git - exim4-smtorp.git/blob - setup-exim-hidden-service
Start on script to set up SMTorP service automatically.
[exim4-smtorp.git] / setup-exim-hidden-service
1 #!/bin/sh
2 #
3 # Configure a machine without exim installed as a mail server receiving
4 # email using SMTP via Tor.
5
6 if dpkg -l exim4-config > /dev/null ; then
7 echo "******************************************************************"
8 echo "* Unable to set up SMTP over Tor, exim4-config already installed *"
9 echo "* Purge the package and try again, or *"
10 echo "* run "dpkg-reconfigure exim4-config" to configure manually. *"
11 echo "******************************************************************"
12 exit 1
13 fi
14
15 torhsdir=$(awk '/^HiddenServiceDir (.*) *$/ { print $2 }' /etc/tor/torrc)
16 if [ -e "$torhsdir/hostname" ] ; then
17 torhsname=$(cat "$torhsdir/hostname")
18 else
19 echo "*******************************************************************"
20 echo "* Unable to set up SMTP over TOR. There is no Tor hidden service *"
21 echo "* name in $torhsdir *"
22 echo "*******************************************************************"
23 echo "Please add lines like this to /etc/tor/torrc:"
24 echo
25 echo "HiddenServiceDir /var/lib/tor/hidden_service/"
26 echo "HiddenServicePort 25 127.0.0.1:25"
27 exit 1
28 fi
29
30 cat <<EOF | debconf-set-selections
31 exim4-config exim4/dc_eximconfig_configtype select internet site; mail is sent and received directly using SMTP
32 exim4-config exim4/dc_local_interfaces string 127.0.0.1 ; ::1
33 exim4-config exim4/dc_other_hostnames string $torhsname
34 exim4-config exim4/use_split_config boolean true
35 EOF
36
37 DEBIAN_FRONTEND=noninteractive apt-get install -y exim4