]>
pere.pagekite.me Git - exim4-smtorp.git/blob - setup-exim-hidden-service
3 # Configure a machine without exim installed as a mail server receiving
4 # email using SMTP via Tor.
9 if [ -f "$file" ] && grep -xq "$string" "$file" ; then
13 if [ -f "$file" ] ; then cat "$file" ; fi
15 ) > "$file.new" && mv "$file.new" "$file"
19 DEBIAN_FRONTEND
=noninteractive apt
-get install -y tor xinetd
20 torhsdir
=$(awk '/^HiddenServiceDir (.*) *$
/ { print
$2 }' /etc/tor/torrc)
21 if [ -e "$torhsdir/hostname" ] ; then
22 torhsname=$(cat "$torhsdir/hostname")
24 echo "*******************************************************************"
25 echo "* Added Tor hidden service for SMTP (port 25) *"
26 echo "*******************************************************************"
27 append_if_missing /etc/tor/torrc \
28 "HiddenServiceDir /var/lib/tor/hidden_service/"
29 append_if_missing /etc/tor/torrc \
30 "HiddenServicePort 25 127.0.0.1:25"
31 mkdir -p /var/lib/tor/hidden_service
32 chown debian-tor:debian-tor /var/lib/tor/hidden_service
33 chmod og-rwx /var/lib/tor/hidden_service
35 if [ -e "$torhsdir/hostname" ] ; then
36 torhsname=$(cat "$torhsdir/hostname")
38 echo "error: unable to set up Tor hidden service"
43 if dpkg -l exim4-config > /dev/null ; then
44 echo "******************************************************************"
45 echo "* Unable to set up SMTP over Tor, exim4-config already installed *"
46 echo "* Purge the package and try again, or *"
47 echo "* run "dpkg-reconfigure exim4-config" to configure manually. *"
48 echo "******************************************************************"
49 echo "* Enable '$torhsname' as mail domain.
53 cat <<EOF | debconf-set-selections
54 exim4-config exim4/dc_eximconfig_configtype select internet site; mail is sent and received directly using SMTP
55 exim4-config exim4/dc_local_interfaces string 127.0.0.1 ; ::1
56 exim4-config exim4/dc_other_hostnames string $torhsname
57 exim4-config exim4/use_split_config boolean true
60 DEBIAN_FRONTEND=noninteractive apt-get install -y exim4