Server-tutorials.net
  • Home
  • CentOS
    • All
    • Game Hosting
    • Hosting Control Panel
    How to Install Laravel on CentOS 8 Linux Server

    How to Install Laravel on CentOS 8 Linux Server

    How to Host a Minecraft Server on a CentOS 8 Server

    How to Host a Minecraft Server on a CentOS 8 Server

    How to Install and Configure an Email Server on CentOS 8 (dovecot,postfix,mariadb,roundcube)

    How to Install and Configure an Email Server on CentOS 8 (dovecot,postfix,mariadb,roundcube)

    How To Set Up a Firewall Using FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    How to Install VestaCP on CentOS 7: A Comprehensive Guide

    How to Install VestaCP on CentOS 7: A Comprehensive Guide

    engineer holding laptop

    How to Install cPanel on CentOS 8: A Comprehensive Guide

    close up photo of ethernet cables on network switch

    Setup a Firewall Using FirewallD on CentOS 7

    security logo

    Installing and Configuring a Firewall on CentOS 8 Server

    Step-by-Step Guide how to Install Elgg on Debian 12

    Setp-by-Setp Guide how to Install Elgg on CentOS 7

    Step-by-Step Guide: How to Install Elasticsearch 8 on Debian 11

    Installing Elasticsearch on CentOS 7

    Custom installation VestaCP on Debian/Ubuntu (Nginx,Apache2)

    How to install VestaCP on CentOS

    Trending Tags

    • centos
  • Debian
    • All
    • Game Hosting
    • Hosting Control Panel
    How to Install and Configure an Email Server on Debian 11 (Postfix, Dovecot, and Roundcube)

    How to Install and Configure an Email Server on Debian 11 (Postfix, Dovecot, and Roundcube)

    How to Install LEMP Stack on Debian 11 Server

    How to Install LEMP Stack on Debian 11 Server

    How to Identify and Remediate Security Breaches or Malware on Your Debian 12 Server

    How to Identify and Remediate Security Breaches or Malware on Your Debian 12 Server

    Upgrading ISPConfig from Debian 11 to Debian 12

    Upgrading ISPConfig from Debian 11 to Debian 12

    How to Downgrade PHP Version on Debian 11: A Step-by-Step Guide

    How to Downgrade PHP Version on Debian 11: A Step-by-Step Guide

    How to Host an OpenRA Game Server on Debian 12

    How to Host an OpenRA Game Server on Debian 12

    How to Install WireGuard VPN on Debian 12: A Step-by-Step Guide

    How to Install WireGuard VPN on Debian 12: A Step-by-Step Guide

    black headphones on black laptop computer

    How to Host a Counter-Strike: Global Offensive Game Server on Debian 12

    close up photo of ethernet cables on network switch

    How to Create a User for ProFTPD Server on Debian 12

    close up photo of mining rig

    Debian 12 (Bookworm) Setup with Apache, BIND, Dovecot, PureFTPD, and ISPConfig 3.2

    wooden robot

    How to Host a Minecraft Server on Debian 12: A Step-by-Step Guide

    modern computer placed near server racks

    Installing and Configuring a Firewall on Debian 12 Server

    black server racks

    A Comprehensive Guide to Backing Up a Debian 12 Server

    data codes through eyeglasses

    How to Install OpenVPN on Debian 12 Server: A Step-by-Step Guide

    close up photo of plugged cables

    Setting Up a Secure FTP Server on Debian 12

    Installing PostgreSQL 15 on Debian 11 Step-by-Step Tutorial

    Installing PostgreSQL 15 on Debian 11 Step-by-Step Tutorial

    Installing Tomcat 10 on Debian 11: Step-by-Step Guide

    Installing Tomcat 10 on Debian 11: Step-by-Step Guide

    Step-by-Step Guide how to Install Elgg on Debian 12

    Step-by-Step Guide how to Install Elgg on Debian 12

    Step-by-Step Guide: How to Install Elasticsearch 8 on Debian 11

    Step-by-Step Guide: How to Install Elasticsearch 8 on Debian 11

    Installing Laravel on Ubuntu 22.04 / Ubuntu 20.04: A Step-by-Step Guide

    Installing Laravel on Ubuntu 22.04 / Ubuntu 20.04: A Step-by-Step Guide

    Trending Tags

    • debian
    • debian 10
  • Ubuntu
    • All
    • Game Hosting
    • Hosting Control Panel
    • Network Monitoring
    How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

    How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

    Securing Nginx with Let’s Encrypt on Ubuntu 22.04: A Step-by-Step Guide

    Securing Nginx with Let’s Encrypt on Ubuntu 22.04: A Step-by-Step Guide

    How to install Counter-Strike: Global Offensive CSGO on Ubuntu 22.04 Server

    How to install Counter-Strike: Global Offensive CSGO on Ubuntu 22.04 Server

    Step-by-Step Guide: Installing Terraform on Ubuntu Server 22.04

    Step-by-Step Guide: Installing Terraform on Ubuntu Server 22.04

    How to Deploy a Secure CockroachDB Cluster on Ubuntu 22.04

    How to Deploy a Secure CockroachDB Cluster on Ubuntu 22.04

    How to Downgrade PHP Version on Ubuntu 22.04: A Step-by-Step Guide

    How to Downgrade PHP Version on Ubuntu 22.04: A Step-by-Step Guide

    How to Install and Configure an Email Server on Ubuntu 22.04 (Postfix, Dovecot, and Roundcube)

    How to Install and Configure an Email Server on Ubuntu 22.04 (Postfix, Dovecot, and Roundcube)

    How to Install Zabbix Monitoring Tool on Ubuntu 22.04

    How to Install Zabbix Monitoring Tool on Ubuntu 22.04

    How to Install Apache Guacamole via Docker on Ubuntu 22.04

    How to Install Apache Guacamole via Docker on Ubuntu 22.04

    How to Install and Configure a Proxy Server on Ubuntu 22.04 Server

    How to Install and Configure a Proxy Server on Ubuntu 22.04 Server

    close up photo of programming of codes

    How to Setup Zabbix Monitoring Tool on Ubuntu 22.04

    modern computer placed near server racks

    How to Install Plesk on Ubuntu 22.04 Server: A Comprehensive Guide

    Free server network image

    How to Install ClickHouse on Ubuntu 22.04: A Step-by-Step Guide

    man people night dark

    Installing and Configuring a Firewall on Ubuntu 22.04 Server

    ethernet cables plugged in network switch

    Securing Nginx on Ubuntu 22.04: Best Practices and Step-by-Step Guide

    close up photo of ethernet cables on network switch

    Installing FileRun on Ubuntu 22.04

    cables connected to ethernet ports

    How to Install ClickHouse on Ubuntu 22.04

    engineer holding laptop

    Install OpenNMS Network Monitoring System on Ubuntu 22.04

    Step by Step Guide how to install CakePHP on Ubuntu 22.04

    Step by Step Guide how to install CakePHP on Ubuntu 22.04

    Installing MySQL on Ubuntu 22.04: A Step-by-Step Guide

    Installing MySQL on Ubuntu 22.04: A Step-by-Step Guide

    Trending Tags

    • Ubuntu 20.04 LTS
    • Ubuntu 20.04
  • Others
    • All
    • Beginners
    industry internet connection technology

    Understanding the Differences Between Nginx and Apache

    Free server network image

    How to Install ClickHouse on Ubuntu 22.04: A Step-by-Step Guide

    crop hacker typing on laptop with data on screen

    Choosing Between VPS and Dedicated Server: A Comprehensive Comparison

    unrecognizable hacker with smartphone typing on laptop at desk

    Choosing the Best Control Panel for Server Management: A Comprehensive Guide

    close up photo of ethernet cables on network switch

    Installing FileRun on Ubuntu 22.04

    cables connected to ethernet ports

    How to Install ClickHouse on Ubuntu 22.04

    Installing Tomcat 10 on Debian 11: Step-by-Step Guide

    Installing Tomcat 10 on Debian 11: Step-by-Step Guide

    Step-by-Step Guide how to Install Elgg on Debian 12

    Step-by-Step Guide how to Install Elgg on Debian 12

    Step-by-Step Guide: How to Install Elasticsearch 8 on Debian 11

    Step-by-Step Guide: How to Install Elasticsearch 8 on Debian 11

    Trending Tags

    • php
No Result
View All Result
Server-tutorials.net
Home Debian

How to host a Tor .onion site on a Debian Server (nginx + tor)

Chris Thompson by Chris Thompson
September 12, 2023
in Tor Hosting
0

Description:
This guide will walk you through the process of setting the server for hosting a static website on the Dark Web. This can be accomplished through the use of Tor Hidden Services. To keep things simple and secure, we’ll use static files.

This article is designed for and tested on a remote Debian-based server. This server should be adequately protected prior to being used in production.

Tor

The packages of Tor in Ubuntu or Debian’s default repositories aren’t always up to date. Tor maintains its own repositor. That repository must be added.
sources.list: Before you can acquire Tor, you must first configure our package repository. First, you must determine the identity of your distribution. lsb release -c or cat /etc/debian version are easy commands to execute. Visit the Debian website if you are unsure regarding your Debian version. Ask Wikipedia about Ubuntu.

For creating a new file you should run the following lines to /etc/apt/sources.list

sudo nano /etc/apt/sources.list

To the end of the file, append the following:

deb https://deb.torproject.org/torproject.org stretch main
deb-src https://deb.torproject.org/torproject.org stretch main

Add your gpg key using the commands below at your command prompt. Then your packages are signed.

gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
root@n0d3:~# gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key EE8CBC9E886DDD89: public key "deb.torproject.org archive signing key" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

Execute the update.

sudo apt-get update

Then install Tor on your server

sudo apt-get install tor deb.torproject.org-keyring

Note: If you run the last command, you may obtain the following: tor : Depends: libevent-2.0-5 (>= 2.0.10-stable), however it is not installable. Then you should fix it manually  : wget
http://ftp.de.debian.org/debian/pool/main/libe/libevent/libevent-2.0-5_2.0.21-stable-3_arm64.deb ; apt install ./libevent-2.0-5_2.0.21-stable-3_arm64.deb ; rm ./libevent-2.0-5_2.0.21-stable-3_arm64.deb

The Hidden Service

To activate our hidden service, we must change the Tor configuration file. To begin, we’ll create a backup copy of this configuration file.

sudo cp /etc/tor/torrc /etc/tor/OLD.torrc

Also you can make changes to your configuration file.

sudo vi /etc/tor/torrc

All Tor customer services, relays, and hidden services are deactivated and commented out by default. Let us begin by activating the hidden service. Locate the area devoted to secret services. It will resemble this.

############### This section is just for location-hidden services ###
## Once you have configured a hidden service, you can look at the
## contents of the file ".../hidden_service/hostname" for the address
## to tell people.
##
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.
#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServicePort 22 127.0.0.1:22

Then uncommented the following lines:

#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80 127.0.0.1:80

This is how the hidden services section should appear now.

############### This section is just for location-hidden services ###
## Once you have configured a hidden service, you can look at the
## contents of the file ".../hidden_service/hostname" for the address
## to tell people.
##
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServicePort 22 127.0.0.1:2

Then tor is restarted by:

sudo service tor restart

Also, evaluate the Tor status

sudo systemctl status tor
root@nθd3: # systemctl status tor
tor.service - Anonymizing overlay network for TCP (multi-instance-master)
Loaded: loaded (/lib/systemd/system/tor.service; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2020-11-12 13:14:57 UTC; 7s ago
Process: 11664 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 11664 (code=exited, status=0/SUCCESS)
Nov 12 13:14:57 nød3 systemd[1]: Starting Anonymizing overlay network for TCP (multi-instance-master)... 
Nov 12 13:14:57 nød3 systemd[1]: Started Anonymizing overlay network for TCP (multi-instance-master).

Tor should have generated a couple of files. The first step is to create a hostname file. Open it to obtain your .onion address.

sudo cat /var/lib/tor/hidden_service/hostname

The file I contained includes 6ad4242dqvoc7e7jgh5laivs2fs7l4u2ej2gscaxtc5wbxlskow4vqd.onion. Something similar should be in your file. The other file contains a private and public key pair. Open it up and look inside.

sudo ls -lrt /var/lib/tor/hidden_service/
[root@nθd3:/var/lib/tor/hidden_service# ls -lrt 
total 16 
-rw------- 1 debian-tor debian-tor 96 Nov 12 13:14 hs_ed25519_secret_key 
-rw------- 1 debian-tor debian-tor 64 Nov 12 13:14 hs_ed25519_public_key
-rw------- 1 debian-tor debian-tor 63 Nov 12 13:14 hostname
drwx--S--- 2 debian-tor debian-tor 4096 Nov 12 13:14 authorized clients

If it becomes essential in the future, you can transfer your server to a new machine using these two files. Make a copy of these files and keep them safe.

Nginx

For this project, nginx is an excellent web server. So  Nginx should be installed as.

sudo apt-get install nginx

Note your server must have a firewall installed. I suggest the Uncomplicated  Firewall (UFW). If you require assistance with UFW, see A Guide to the Simple Firewall (UFW) for Linux. Allow HTTP traffic with the following command.

sudo ufw allow 'Nginx HTTP'

Verify that your server’s IP address is operational by visiting it.
Remove this rule if everything is working properly. After that, restart the firewall.

sudo ufw deny 'Nginx HTTP'
sudo ufw reload

nginx.conf

Disable unwanted information sharing by editing the main Nginx configuration file.

sudo vi /etc/nginx/nginx.conf

Add the following to the http block:

server_name_in_redirect off;
server_tokens off;
port_in_redirect off;

Now restart the Nginx server by following command.

sudo systemctl restart nginx

Web Server Root Directory

Create a directory to store our web server files.

sudo mkdir /var/www/dark_net

Create and edit a file called index.html for your website.

sudo nano /var/www/dark_net/index.html

Add whatever you want within. We don’t require real HTML; instead, we require something unique for the time being.

Welcome to my page

Permissions must be set so the file can be easily accessed by Nginx.

sudo chmod 755 /var/www/dark_net

Remove Nginx Default

Delete the default website.

sudo rm /etc/nginx/sites-enabled/default
sudo rm /etc/nginx/sites-available/default

Add Available Site

Creating a new site in the available-sites directory.

sudo nano /etc/nginx/sites-available/dark_net

Within, insert the following for your instance’s root and server name variables.

server {
listen 127.0.0.1:80;
root /var/www/dark_net/;
index index.php index.html;
server_name 6ad4242dqvoc7e7jgh5laivs11s734u2ej2gscaxtc5wbxlskow4vqd.onion; 
}

Note: Add your own .onion address in server_name and Safe the file.

Adding the given site to the site_enabled list.

sudo ln -s /etc/nginx/sites-available/dark_net/etc/nginx/sites-enabled/

Then Nginx sever is restarted.

sudo systemctl restart nginx

Tor Browser

Access the Tor Browser (which you can download here) and navigate to your previously generated .onion address. If functioning of the system is proper, then the previously created dummy index.html page will be shown.
Conclusion
Therefore, you now have a website here on Dark Web. Any documents located inside the /var/www/dark web directory would be accessible online. If you are using a static website builder, this is the location where the result will be saved.

Tags: debianhostinghowtotortutorialubuntu
Previous Post

VNC Installation and Configuration on CentOS 8

Next Post

How to use nginx as reverse proxy on ubuntu 20.04

Chris Thompson

Chris Thompson

Next Post
How to use nginx as reverse proxy on ubuntu 20.04

How to use nginx as reverse proxy on ubuntu 20.04

How to install and Set up osTicket with Nginx on Debian 11

How to install and Set up osTicket with Nginx on Debian 11

How to Install and Set up Wireguard VPN on Debian 11

How to Install and Set up Wireguard VPN on Debian 11

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categorys

  • AI Server Technology
  • Apache
  • Backup
  • CentOS
    • Game Hosting
    • Hosting Control Panel
  • Crypto
  • Debian
    • Game Hosting
    • Hosting Control Panel
  • Email
  • FTP
  • Laravel
  • MySQL
  • Nginx
  • Others
    • Beginners
  • PHP
  • Security
    • Firewall
  • Tor Hosting
  • Ubuntu
    • Game Hosting
    • Hosting Control Panel
      • Plesk
      • VestaCP
    • Network Monitoring
  • VNC
  • VPN
  • Webhosting

Popular Posts

  • How to install WHM & CPanel on Ubuntu 20.04 LTS Linux

    How to install WHM & CPanel on Ubuntu 20.04 LTS Linux

    664 shares
    Share 266 Tweet 166
  • Ubuntu 20.04 LTS Nginx Performance Optimization

    606 shares
    Share 242 Tweet 152
  • How to host a Tor .onion site on a Debian Server (nginx + tor)

    602 shares
    Share 241 Tweet 151
  • How to upgrade php7.2 to php7.4 in VestaCP on Ubuntu ?

    601 shares
    Share 240 Tweet 150
  • How to use nginx as reverse proxy on ubuntu 20.04

    600 shares
    Share 240 Tweet 150

Recent Posts

How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

September 26, 2023
How to Install Laravel on CentOS 8 Linux Server

How to Install Laravel on CentOS 8 Linux Server

September 26, 2023
Securing Nginx with Let’s Encrypt on Ubuntu 22.04: A Step-by-Step Guide

Securing Nginx with Let’s Encrypt on Ubuntu 22.04: A Step-by-Step Guide

September 14, 2023

About Us

Server-tutorials.net - Linux Debian, Ubuntu, CentOS Server Tutorials.

Popular Tag

7.2 7.4 18.04 22.04 Apache apache2 backup server centos CentOS 7 centos 8 cpanel debian debian 11 Dovecot Elasticsearch firewall centos 8 FTP Server how to howto How to Install ClickHouse on Ubuntu 22.04 install installation kvm lavarel lemp linux mariadb MySQL nginx node openvz php Postfix server setup tutorial ubuntu Ubuntu 20.04 Ubuntu 22.04 update vesta vestacp vnc vserver Wireguard

Recent News

How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

How to Upgrade PHP from 7.2 to 7.4 and 8.0 on VestaCP Ubuntu 18.04

September 26, 2023
How to Install Laravel on CentOS 8 Linux Server

How to Install Laravel on CentOS 8 Linux Server

September 26, 2023
  • Cookie Policy
  • Privacy & Policy
  • Change privacy settings
  • Privacy settings history
  • Revoke consents
  • Contact
  • Imprint

© 2022 Server-tutorials.net - Linux Server Tutorials

No Result
View All Result
  • Home
  • CentOS
    • Hosting Control Panel
  • Debian
    • Backup
    • FTP
    • Hosting Control Panel
    • Laravel
    • Laravel
    • Network Monitoring
    • Security
      • Firewall
    • Tor Hosting
    • VPN
    • Webhosting
  • Ubuntu
    • VestaCP
    • Nginx
  • Others
    • Beginners
  • Contact
  • Privacy Policy
  • Cookie Policy
  • Imprint

© 2022 Server-tutorials.net - Linux Server Tutorials