Learn how to create personalized .onion addresses on your Mac and integrate them into the Tor network.

Custom .onion Domains (macOS)

Published:

Tags:

In today’s post, we’ll explore how to use the tool mkp224o on a Mac to generate your very own .onion domain and integrate it into the Tor network. Whether you’re setting up a hidden service or experimenting with anonymity projects, this step-by-step guide will walk you through everything you need to know.


Prerequisites

Before you begin, make sure your system meets the following requirements:

  • Compiler: A C99-compatible compiler (gcc or clang)
  • Libraries: libsodium (including header files)
  • Build Tools: GNU make and GNU autoconf
  • Platform: A UNIX-like operating system

Installing Dependencies

  1. Install Homebrew (if not already installed):

    Open your terminal and run:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Install the Required Packages:

    Once Homebrew is set up, install the necessary tools by running:

    brew install gcc libsodium make autoconf
    

Building mkp224o

Follow these steps to build the tool from the source:

  1. Clone the Repository:

    git clone https://github.com/cathugger/mkp224o.git
    cd mkp224o
    
  2. Generate the Configuration Script:

    Run the autogen script to create the configure script:

    ./autogen.sh
    
  3. Set Environment Variables:

    Point the compiler to the correct libsodium paths:

    export CFLAGS="-I/opt/homebrew/Cellar/libsodium/1.0.20/include"
    export LDFLAGS="-L/opt/homebrew/Cellar/libsodium/1.0.20/lib"
    
  4. Configure the Build System:

    ./configure --enable-donna --enable-binsearch --enable-intfilter=native --enable-batchnum=64
    
  5. Build the Project:

    Clean any previous builds and compile:

    make clean
    make
    

Generating Your .onion Domain

To generate a .onion domain with a desired prefix, simply run the tool with your chosen prefix and specify a directory for the keys. For example:

./mkp224o -d mykeys myprefix

This command will create a .onion address that starts with “myprefix” and store the associated keys in the mykeys directory.

Example:

./mkp224o -d onions neko

This attempts to generate a .onion address beginning with “neko” and saves the keys in the directory named onions.


Integrating the Generated Keys into Tor

After generating your .onion domain, follow these steps to integrate it with Tor:

  1. Copy the Key Folder:

    Replace the placeholder with your generated key folder name:

    sudo cp -r myprefix54as6d54....onion /var/lib/tor/myservice
    
  2. Adjust Permissions:

    Set the appropriate ownership and permissions:

    sudo chown -R tor: /var/lib/tor/myservice
    sudo chmod -R u+rwX,og-rwx /var/lib/tor/myservice
    
  3. Update the torrc File:

    Add your new hidden service configuration:

    HiddenServiceDir /var/lib/tor/myservice/
    HiddenServicePort 80 127.0.0.1:80
    
  4. Restart Tor:

    Depending on your system, restart Tor with:

    sudo systemctl restart tor
    

    Or, if you started Tor manually:

    sudo service tor restart
    

Speeding Up the Process with Batch Mode

If you want to accelerate the key generation process, use the batch mode by adding the -B option:

./mkp224o -B -d mykeys myprefix

Summary of Commands

  • Clone Repository and Enter Directory:

    git clone https://github.com/cathugger/mkp224o.git
    cd mkp224o
    
  • Prepare the Build Environment and Compile:

    ./autogen.sh
    export CFLAGS="-I/opt/homebrew/Cellar/libsodium/1.0.20/include"
    export LDFLAGS="-L/opt/homebrew/Cellar/libsodium/1.0.20/lib"
    ./configure --enable-donna --enable-binsearch --enable-intfilter=native --enable-batchnum=64
    make clean
    make
    
  • Generate a .onion Domain:

    ./mkp224o -d mykeys myprefix
    
  • Integrate with Tor:

    sudo cp -r myprefix54as6d54....onion /var/lib/tor/myservice
    sudo chown -R tor: /var/lib/tor/myservice
    sudo chmod -R u+rwX,og-rwx /var/lib/tor/myservice
    sudo systemctl restart tor
    

Conclusion

With these steps, you’re now equipped to use mkp224o on your Mac to generate a custom .onion domain and seamlessly integrate it with Tor. Whether you’re setting up a personal hidden service or diving into deeper privacy projects, this guide provides a clear roadmap. Happy hidden service building, and good luck!