How to Set Up and Host a Chat on the Dark Web

Setting up a PHP-based chat application like Le Chat on a Linux virtual machine (VM) with MySQL and Apache, specifically configured to run over the Tor network, involves several steps. Even if you don’t want to run an entire .onion empire, it is good to know the basic rules of such systems, how to set it up and what are the limits of Tor’s privacy. After some research in the topic I found dozens of very different chats on the Onion network that run Le Chat, some are very friendly and legal, the other are dark and hostile. Let’s take a look at how can you host your own instance from the comfort of your chair!

Tor, short for “The Onion Router,” is an open-source network designed to enable private communication and browsing on the internet. It achieves this by encrypting user data and routing it through a series of volunteer-operated servers known as onion routers, which peel away layers of encryption to conceal users’ identities and locations like the layers of an onion.

.onion domains are a unique feature of the Tor network, representing a special top-level domain that can only be accessed via the Tor browser. These domains are not indexed by traditional search engines and are often associated with the dark web.

Running a .onion site offers significant advantages for privacy, primarily by enhancing the anonymity of both the server and its users. Unlike traditional websites, .onion sites operate exclusively within the Tor network, which means they do not require an exit node to connect to the clearnet. This setup eliminates potential vulnerabilities associated with exit nodes, where user data could be exposed or monitored. Additionally, the use of layered encryption in Tor ensures that both the location of the server and the identity of its visitors remain concealed from prying eyes, including ISPs and government entities.

Prerequisites

Before starting, ensure you have the following:

  • A Linux VM
  • Root (sudo) access to the VM
  • Basic knowledge of Linux commands
  • Installed packages: Apache, MySQL, PHP, and Tor

Step 1: Setting Up the Linux Environment

  1. Install the Apache webserver:
    Use the package manager to install Apache. For Ubuntu, run:
   sudo apt update
   sudo apt install apache2
  1. Install the MySQL database server:
    Install MySQL server to manage your database:
   sudo apt install default-mysql-server
  1. Install PHP:
    Install PHP along with necessary extensions:
   sudo apt install php php-intl php-gettext-languages php-mbstring php-mysql php-gd
  1. Install Tor:
    To enable Tor functionality, install the Tor service:
   sudo apt install tor
  1. Start the services:
    Ensure all services are running:
   sudo systemctl start apache2
   sudo systemctl start mysql
   sudo systemctl start tor

Step 2: Downloading and Configuring Le Chat

  1. Download Le Chat:
    Clone the repository from GitHub or download it directly:
   git clone https://github.com/DanWin/le-chat-php.git /var/www/html/le-chat
  1. Set Permissions:
    Adjust permissions to allow web server access:
   sudo chown -R www-data:www-data /var/www/html/le-chat
  1. Configure Database:
  • Log into MySQL and create a database for Le Chat:
    sql CREATE DATABASE le_chat; CREATE USER 'chat_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON le_chat.* TO 'chat_user'@'localhost'; FLUSH PRIVILEGES;
  1. Edit Configuration File:
    Modify the configuration file in /var/www/html/le-chat/config.php to include your database settings.

Step 3: Configuring Apache for Tor

  1. Set up a Virtual Host in Apache:
    Create a new configuration file for your chat application in /etc/apache2/sites-available/le-chat.conf:
   <VirtualHost *:80>
       DocumentRoot /var/www/html/le-chat
       <Directory /var/www/html/le-chat>
           AllowOverride All
       </Directory>
       ErrorLog ${APACHE_LOG_DIR}/le-chat_error.log
       CustomLog ${APACHE_LOG_DIR}/le-chat_access.log combined
   </VirtualHost>
  1. Enable the site and restart Apache:
    Enable your new site configuration and restart Apache:
   sudo a2ensite le-chat.conf
   sudo systemctl restart apache2
  1. Configure Tor Hidden Service:
    Edit the Tor configuration file located at /etc/tor/torrc to add your hidden service:
   HiddenServiceDir /var/lib/tor/lechat_service/
   HiddenServicePort 80 127.0.0.1:80
  1. Restart the Tor service:
    Restart the Tor service to apply changes: sudo systemctl restart tor
  2. Retrieve your .onion address:
    After restarting Tor, check the file hostname in /var/lib/tor/lechat_service/ for your new .onion address.

Step 4: Finalizing Setup

  1. Accessing your chat application:
    Open your Tor browser and navigate to your .onion address to access Le Chat.
  2. Testing the functionality:
    Test all features of Le Chat to ensure everything is functioning correctly.
  3. Security considerations:
    • Regularly update your packages.
    • Use strong passwords for your database and admin accounts.
    • Consider additional security measures such as firewalls or fail2ban.

Final thoughts

Hosting a PHP chat application like Le Chat on a Linux VM using MySQL and Apache over Tor provides an excellent platform for secure communication. By following these steps, you can set up a robust environment that respects user privacy while offering real-time chat capabilities. Regular maintenance and updates will ensure that your application remains secure and efficient over time.

2 thoughts on “How to Set Up and Host a Chat on the Dark Web

  1. Hi,

    Thanks for the guide. I am working through this now for testing and on step 2.3, you mention modifying a config file that seems non-existent:

    “`

    root@le-chat:~# ls /var/www/html/le-chat/
    CHANGELOG README.md chat.php locale update-translation.sh
    COPYING SECURITY.md chatters_list_on_right_example.css sounds

    “`

    It seems we need to plug the DB settings in for Le-Chat, but that config file doesn’t exist at that path and I don’t see anthing in the chat.php file that seems related to the database. Can you please clarify that step?

    Thanks!

    Like

  2. Actually, I think I found it. It is in that chat.php file. But when I get up and running, I just get the default Apache2 page. Even though the site enabled has the document root set to the le-chat folder.

    Like

Leave a comment