|  | @@ -4325,49 +4325,50 @@ function configure_email {
 | 
	
		
			
			| 4325 | 4325 |          sed -i "s|Email onion domain.*|Email onion domain:${EMAIL_ONION_HOSTNAME}|g" $COMPLETION_FILE
 | 
	
		
			
			| 4326 | 4326 |      fi
 | 
	
		
			
			| 4327 | 4327 |  
 | 
	
		
			
			| 4328 |  | -    echo '# tor stuff first' > /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4329 |  | -    echo '#' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4330 |  | -    echo '# if were submitting mail *from* a .tor/.onion address,' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4331 |  | -    echo '# make sure any header lines that may give us away is' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4332 |  | -    echo '# stripped out, and add a new, cryptic Message-ID.' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4333 |  | -    echo '# In address_data we store the name we should HELO as.' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4334 |  | -    echo 'tor_to_any:' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4335 |  | -    echo '        debug_print     = "R: manualroute from .onion to $local_part@$domain"' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4336 |  | -    echo '        driver          = manualroute' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4337 |  | -    echo '        domains         = ! +local_domains' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4338 |  | -    echo '        condition       = ${if match {$sender_address_domain}{\N.*\.(onion|tor)$\N}}' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4339 |  | -    echo '        address_data    = $sender_address_domain' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4340 |  | -    echo '        transport       = remote_smtp_onion' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4341 |  | -    echo '        self            = send' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4342 |  | -    echo '        route_list      = * localhost' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4343 |  | -    echo '        headers_remove  = Received:Message-ID:X-Mailer:User-Agent' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4344 |  | -    echo '        headers_add     = Message-ID: <${lc:${sha1:$message_id}}@$sender_address_domain>' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4345 |  | -    echo '' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4346 |  | -    echo '# this catches the case where were submitting mail' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4347 |  | -    echo '# from a regular email address where we dont need to' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4348 |  | -    echo '# rewrite any headers' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4349 |  | -    echo 'any_to_tor:' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4350 |  | -    echo '        debug_print     = "R: manualroute for $local_part@$domain"' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4351 |  | -    echo '        driver          = manualroute' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4352 |  | -    echo '        domains         = ! +local_domains' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4353 |  | -    echo '        transport       = remote_smtp_onion' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4354 |  | -    echo '        self            = send' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4355 |  | -    echo '        route_list      = *.onion localhost ; *.tor localhost' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4356 |  | -    echo '        address_data    = $smtp_active_hostname' >> /etc/exim4/conf.d/router/100_smtorp
 | 
	
		
			
			| 4357 |  | -
 | 
	
		
			
			| 4358 |  | -    echo 'remote_smtp_onion:' > /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4359 |  | -    echo '        debug_print = "T: remote_smtp_onion for $local_part@$original_domain"' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4360 |  | -    echo '        driver = smtp' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4361 |  | -    echo '' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4362 |  | -    echo '        # set helo_data to where we want to connect to,' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4363 |  | -    echo '        # for the proxy program tor-smtp' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4364 |  | -    echo '        helo_data = "$address_data $original_domain"' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4365 |  | -    echo '' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4366 |  | -    echo '        # wherever we configured our script at' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4367 |  | -    echo '        port = 12668' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4368 |  | -    echo '' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4369 |  | -    echo '        # cannot use TLS otherwise it will EHLO again!!' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			| 4370 |  | -    echo '        hosts_avoid_tls = *' >> /etc/exim4/conf.d/transport/100_smtorp
 | 
	
		
			
			|  | 4328 | +    # see https://github.com/petterreinholdtsen/exim4-smtorp
 | 
	
		
			
			|  | 4329 | +    echo '# tor stuff first' > /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4330 | +    echo '#' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4331 | +    echo '# if were submitting mail *from* a .tor/.onion address,' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4332 | +    echo '# make sure any header lines that may give us away is' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4333 | +    echo '# stripped out, and add a new, cryptic Message-ID.' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4334 | +    echo '# In address_data we store the name we should HELO as.' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4335 | +    echo 'tor_to_any:' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4336 | +    echo '        debug_print     = "R: manualroute from .onion to $local_part@$domain"' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4337 | +    echo '        driver          = manualroute' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4338 | +    echo '        domains         = ! +local_domains' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4339 | +    echo '        condition       = ${if match {$sender_address_domain}{\N.*\.(onion|tor)$\N}}' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4340 | +    echo '        address_data    = $sender_address_domain' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4341 | +    echo '        transport       = remote_smtp_onion' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4342 | +    echo '        self            = send' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4343 | +    echo '        route_list      = * localhost' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4344 | +    echo '        headers_remove  = Received:Message-ID:X-Mailer:User-Agent' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4345 | +    echo '        headers_add     = Message-ID: <${lc:${sha1:$message_id}}@$sender_address_domain>' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4346 | +    echo '' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4347 | +    echo '# this catches the case where were submitting mail' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4348 | +    echo '# from a regular email address where we dont need to' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4349 | +    echo '# rewrite any headers' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4350 | +    echo 'any_to_tor:' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4351 | +    echo '        debug_print     = "R: manualroute for $local_part@$domain"' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4352 | +    echo '        driver          = manualroute' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4353 | +    echo '        domains         = ! +local_domains' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4354 | +    echo '        transport       = remote_smtp_onion' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4355 | +    echo '        self            = send' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4356 | +    echo '        route_list      = *.onion localhost ; *.tor localhost' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4357 | +    echo '        address_data    = $smtp_active_hostname' >> /etc/exim4/conf.d/router/100_exim4-smtorp
 | 
	
		
			
			|  | 4358 | +
 | 
	
		
			
			|  | 4359 | +    echo 'remote_smtp_onion:' > /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4360 | +    echo '        debug_print = "T: remote_smtp_onion for $local_part@$original_domain"' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4361 | +    echo '        driver = smtp' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4362 | +    echo '' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4363 | +    echo '        # set helo_data to where we want to connect to,' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4364 | +    echo '        # for the proxy program tor-smtp' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4365 | +    echo '        helo_data = "$address_data $original_domain"' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4366 | +    echo '' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4367 | +    echo '        # wherever we configured our script at' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4368 | +    echo '        port = 12668' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4369 | +    echo '' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4370 | +    echo '        # cannot use TLS otherwise it will EHLO again!!' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			|  | 4371 | +    echo '        hosts_avoid_tls = *' >> /etc/exim4/conf.d/transport/100_exim4-smtorp
 | 
	
		
			
			| 4371 | 4372 |  
 | 
	
		
			
			| 4372 | 4373 |      if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			| 4373 | 4374 |          mkdir -p $INSTALL_DIR
 | 
	
	
		
			
			|  | @@ -4412,8 +4413,7 @@ function configure_email {
 | 
	
		
			
			| 4412 | 4413 |          # both ICANN and onion domains
 | 
	
		
			
			| 4413 | 4414 |          echo "dc_other_hostnames='${DEFAULT_DOMAIN_NAME};${EMAIL_ONION_HOSTNAME}'" >> /etc/exim4/update-exim4.conf.conf
 | 
	
		
			
			| 4414 | 4415 |      else
 | 
	
		
			
			| 4415 |  | -        # in onion-only mode the default domain is the same as the onion domain for email
 | 
	
		
			
			| 4416 |  | -        echo "dc_other_hostnames='${DEFAULT_DOMAIN_NAME}'" >> /etc/exim4/update-exim4.conf.conf
 | 
	
		
			
			|  | 4416 | +        echo "dc_other_hostnames='${EMAIL_ONION_HOSTNAME}'" >> /etc/exim4/update-exim4.conf.conf
 | 
	
		
			
			| 4417 | 4417 |      fi
 | 
	
		
			
			| 4418 | 4418 |      echo "dc_local_interfaces=''" >> /etc/exim4/update-exim4.conf.conf
 | 
	
		
			
			| 4419 | 4419 |      echo "dc_readhost=''" >> /etc/exim4/update-exim4.conf.conf
 |