]>
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.
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 "******************************************************************"
18 if [ -f "$file" ] && grep -xq "$string" "$file" ; then
22 if [ -f "$file" ] ; then cat "$file" ; fi
24 ) > "$file.new" && mv "$file.new" "$file"
28 DEBIAN_FRONTEND
=noninteractive apt
-get install -y tor
29 torhsdir
=$(awk '/^HiddenServiceDir (.*) *$
/ { print
$2 }' /etc/tor/torrc)
30 if [ -e "$torhsdir/hostname" ] ; then
31 torhsname=$(cat "$torhsdir/hostname")
33 echo "*******************************************************************"
34 echo "* Added Tor hidden service for SMTP (port 25) *"
35 echo "*******************************************************************"
36 append_if_missing /etc/tor/torrc \
37 "HiddenServiceDir /var/lib/tor/hidden_service/"
38 append_if_missing /etc/tor/torrc \
39 "HiddenServicePort 25 127.0.0.1:25"
40 mkdir -p /var/lib/tor/hidden_service
41 chown debian-tor:debian-tor /var/lib/tor/hidden_service
42 chmod og-rwx /var/lib/tor/hidden_service
44 if [ -e "$torhsdir/hostname" ] ; then
45 torhsname=$(cat "$torhsdir/hostname")
47 echo "error: unable to set up Tor hidden service"
52 cat <<EOF | debconf-set-selections
53 exim4-config exim4/dc_eximconfig_configtype select internet site; mail is sent and received directly using SMTP
54 exim4-config exim4/dc_local_interfaces string 127.0.0.1 ; ::1
55 exim4-config exim4/dc_other_hostnames string $torhsname
56 exim4-config exim4/use_split_config boolean true
59 DEBIAN_FRONTEND=noninteractive apt-get install -y exim4