How to Set Up an Anonymous Email Service Using Tor

Setting up an anonymous email service using Tor provides a way to send and receive emails without revealing your identity or location. Tor routes your traffic through multiple encrypted nodes, ensuring privacy and anonymity. You can configure an anonymous email server by using Tor hidden services and a secure mail server like Postfix.

In this guide, we'll show you how to set up an anonymous email service on a VPS that leverages Tor for anonymity. This will involve setting up a Tor hidden service and configuring Postfix to send and receive emails over the Tor network.


Prerequisites

  • A VPS running Ubuntu 20.04 or later (or any other Linux distribution).
  • Root access or sudo privileges on the VPS.
  • Basic knowledge of Linux command-line operations.
  • Tor installed on the VPS.
  • A domain name (e.g., example.com) that you control, which will be used to send anonymous emails.

Step 1: Install and Configure Tor

Before we set up the mail server, we need to ensure Tor is properly installed and running.

1.1 Update Your System

Ensure your system is up-to-date:

 
sudo apt update sudo apt upgrade -y

1.2 Install Tor

Install Tor using the official Ubuntu package manager:

 
sudo apt install tor -y

1.3 Enable and Start Tor

Enable and start the Tor service so it runs automatically on boot:

 
sudo systemctl enable tor sudo systemctl start tor

You can verify Tor is running by checking its status:

 
sudo systemctl status tor

Step 2: Configure Tor Hidden Service for Email

To set up the anonymous email service, we need to configure Tor to host a hidden service for your email domain.

2.1 Edit Tor Configuration

The Tor configuration file is located at /etc/tor/torrc. Open it for editing:

 
sudo nano /etc/tor/torrc

Scroll to the end of the file and add the following lines to configure the hidden service for email:

 
# Hidden Service for Email HiddenServiceDir /var/lib/tor/email_service/ HiddenServicePort 25 127.0.0.1:25 HiddenServicePort 110 127.0.0.1:110 HiddenServicePort 143 127.0.0.1:143
  • HiddenServiceDir: This directory will store the Tor hidden service configuration and keys.
  • HiddenServicePort: These lines forward the email-related ports (25, 110, and 143) from your Tor hidden service to the corresponding ports on your local machine (for SMTP, POP3, and IMAP).

2.2 Restart Tor

After saving the torrc file, restart Tor to apply the changes:

 
sudo systemctl restart tor

2.3 Retrieve Your .onion Address

Now that your Tor hidden service is configured, you can retrieve the .onion address that Tor has generated for your email service:

 
sudo cat /var/lib/tor/email_service/hostname

This will output a .onion address like:

 
 
yourhiddenaddress.onion

This is the Tor address you will use for your anonymous email service.


Step 3: Install and Configure Postfix

Next, we’ll install and configure Postfix, a popular mail transfer agent (MTA), to send and receive emails over Tor.

3.1 Install Postfix

Install Postfix using the following command:

 
sudo apt install postfix -y

During installation, you'll be prompted for configuration. Choose the "Internet Site" option, and when asked for your mail name, enter your custom domain name (e.g., example.com).

3.2 Configure Postfix to Use Tor

To route Postfix traffic through the Tor network, we need to set up the Socks5 proxy configuration.

  1. Open the Postfix main configuration file:
 
sudo nano /etc/postfix/main.cf
  1. Add the following lines to configure the Socks5 proxy for Postfix:
 
# Set up Tor Proxy smtp_host = 127.0.0.1 smtp_port = 25 relayhost = [127.0.0.1]:25 smtp_sasl_auth_enable = no smtp_use_tls = no

This configuration routes Postfix traffic through the Tor network by specifying the 127.0.0.1:25 relay (the Tor-hidden service for SMTP).

3.3 Enable and Start Postfix

After configuring Postfix, restart the service to apply the changes:

 
sudo systemctl restart postfix

Step 4: Set Up Your Domain’s DNS

To use your custom domain with the anonymous email service, you need to configure DNS records for email.

4.1 Set Up MX Records

In your DNS control panel (typically through your domain registrar), create an MX record to point to your .onion address.

 
Type: MX Host: @ Value: yourhiddenaddress.onion Priority: 10

This directs all email traffic for your domain to your Tor hidden service.

4.2 Add SPF, DKIM, and DMARC (Optional)

To ensure deliverability and to avoid emails being marked as spam, you should also set up SPF, DKIM, and DMARC records.

  1. SPF Record:
 
Type: TXT Host: @ Value: "v=spf1 mx ~all"
  1. DKIM: Set up DKIM (DomainKeys Identified Mail) to sign outgoing emails with a cryptographic signature. You can use tools like OpenDKIM for this.

  2. DMARC:

 
Type: TXT Host: _dmarc Value: "v=DMARC1; p=none; rua=mailto:[email protected]"

These configurations help ensure your emails are trusted and reduce the chances of them being flagged as spam.


Step 5: Test Your Anonymous Email Setup

After completing the setup, test your anonymous email service to ensure everything is working correctly.

  1. Send an Email: Send a test email from your custom domain to a third-party email service (like Gmail) to ensure it's being delivered.

  2. Receive an Email: Test receiving an email by sending one to your Tor-based email address and verifying it shows up in your inbox.


Step 6: Secure Your Server

To ensure the security and privacy of your email service:

  1. Firewall: Ensure your VPS firewall is configured to allow only necessary ports (e.g., 80, 443 for HTTP/HTTPS, and email ports).

  2. Update Regularly: Keep your system, Tor, and Postfix installation up-to-date with security patches.

  3. Encrypt Storage: Consider encrypting your email server’s storage to prevent data leaks in the event of a compromise.

  4. Use Strong Authentication: Consider using strong passwords and 2FA (two-factor authentication) for any web interfaces you use for managing the email service.


Conclusion

By following these steps, you have set up an anonymous email service using Tor, protecting both your privacy and the identity of your users. This solution ensures that email communication is only accessible via the Tor network, offering a high level of anonymity for both sending and receiving emails. Make sure to regularly update your system and apply additional security measures to keep your service safe and anonymous.

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution