• XSS.stack #1 – первый литературный журнал от юзеров форума

Статья RocketChat on the Tor Network

blackhunt

(L2) cache
Пользователь
Регистрация
10.05.2023
Сообщения
334
Решения
8
Реакции
338
Installing and Setting Up Rocket.Chat on the Tor Network If you're looking to set up a secure and anonymous messaging platform, Rocket.Chat is one of the best options available. In this article, I'll guide you through the process of installing Rocket.Chat on an Ubuntu server and running it over the Tor network.

What is Rocket.Chat and Why is it Important?

Rocket.Chat is an open-source, customizable messaging platform that allows you to host your own private chat server. Running it on the Tor network enhances security and privacy for users.

Advantages of Rocket.Chat
- Private and group chats
- End-to-end encryption (E2EE)
- Voice and video calls
- User management and access control

Steps to Install Rocket.Chat on Ubuntu

1. Install Node.js

curl -o- https://fnm.vercel.app/install | bash
source ~/.bashrc
fnm install 20
npm install -g npm@11
node -v
npm -v

Next, locate the Node.js path and link it to /usr/bin/node:

ln -s $(which node) /usr/bin/node

1738485774183.png

2. Install MongoDB

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.1.tgz
tar -xvzf mongodb-linux-x86_64-ubuntu2004-6.0.1.tgz
sudo mv mongodb-linux-x86_64-ubuntu2004-6.0.1/bin/* /usr/local/bin/
mongod --version

1738485962141.png

3. Install Rocket.Chat

curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
tar -xvzf rocket.chat.tgz
cd bundle/programs/server/
npm install
1738485746952.png

5. Install mongosh for MongoDB Configuration

To configure MongoDB, we’ll use mongosh. Download and install it:

wget https://downloads.mongodb.com/compass/mongosh-2.3.8-linux-x64.tgz
tar -xvzf mongosh-2.3.8-linux-x64.tgz
sudo mv mongosh-2.3.8-linux-x64/bin/mongosh /usr/local/bin/
mongosh --version

1738490939532.png


Next, enable replication in MongoDB. Edit the mongod.conf file:

nano /etc/mongod.conf

Add the following lines under the replication section:
Код:
replication:
  replSetName: "rs0"

1738485660366.png


Restart the MongoDB service:

sudo systemctl restart mongod

Connect to MongoDB using mongosh:

mongosh

Initialize replication:

rs.initiate()

Verify the replication status:

rs.status()

1738485855031.png


Create a database for Rocket.Chat:

use rocketchat

Create a user for Rocket.Chat to access the database:

Код:
db.createUser(
  {
    user: "rocketchat",
    pwd: "xss@123",
    roles: [{ role: "readWrite", db: "rocketchat" }]
  }
)

Important Note: If your username or password contains special characters (e.g., @, !, #), you must URL-encode them. For example:
  • xss@123 becomes xss%40123
You can use an online tool like URL Encoder to encode your password.

Exit the MongoDB shell:

exit

Start Rocket.Chat Manually

Navigate to the Rocket.Chat directory and start the server:

cd /path/to/bundle

MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local?replicaSet=rs0 ROOT_URL=http://127.0.0.1:3000 PORT=3000 /usr/bin/node main.js

If everything is configured correctly, Rocket.Chat should start without issues.

Setting Up Rocket.Chat on the Tor Network


1. Install Tor and Nginx

Install Tor and Nginx to route Rocket.Chat through the Tor network:

apt install tor nginx

2. Configure Tor

Edit the Tor configuration file to create a hidden service:

nano /etc/tor/torrc

Add the following lines:

Код:
HiddenServiceDir /var/lib/tor/rocketchat/
HiddenServicePort 80 127.0.0.1:80
HiddenServicePort 443 127.0.0.1:443

Restart Tor:

sudo systemctl restart tor

Retrieve your onion address:

cat /var/lib/tor/rocketchat/hostname

3. Configure Nginx

Edit the Nginx configuration file:

nano /etc/nginx/nginx.conf

Set the server_names_hash_bucket_size to 128:

1738486230056.png


Create a self-signed SSL certificate for your onion site:

cd /etc/nginx/ssl/
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout rocketchat.key -out rocketchat.crt

When prompted for the Common Name (CN), enter your onion site address.

Create an Nginx configuration file for Rocket.Chat:

nano /etc/nginx/sites-enabled/rocketchat

Add the following configuration:

1738489621357.png


Код:
server {
    listen 0.0.0.0:443 ssl;
    server_name onion.onion;

    ssl_certificate /etc/nginx/ssl/rocketchat.crt;
    ssl_certificate_key /etc/nginx/ssl/rocketchat.key;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
    }

}

server {
    listen 0.0.0.0:80;
    server_name onion.onion;
    return 301 https://$host$request_uri;
}


Link the configuration file to the sites-available directory:

ln -s /etc/nginx/sites-enabled/rocketchat /etc/nginx/sites-available/rocketchat

Test the Nginx configuration:

nginx -t

1738486475482.png


Restart Nginx:

systemctl restart nginx

4. Update Rocket.Chat Configuration


Update the ROOT_URL in your Rocket.Chat startup command to use your onion address:

Код:
MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local?replicaSet=rs0 ROOT_URL=http://your-onion-site.onion:3000 PORT=3000 /usr/bin/node main.js

5. Set Up Rocket.Chat as a Service

Create an environment file for Rocket.Chat:

nano /etc/rocketchat.env

Add the following configuration:

Код:
OVERWRITE_SETTING_Show_Setup_Wizard=false
ADMIN_USERNAME=admin
ADMIN_PASS=yoursecurepasswordxss
ADMIN_EMAIL=admin@xss.pro
MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat
MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local
ROOT_URL=http://your-onion-site.onion
PORT=3000

These settings are all about making Rocket.Chat easier to set up and use, especially if you want to skip some of the usual setup steps. Let me break it down for you:

OVERWRITE_SETTING_Show_Setup_Wizard=false

This setting is a lifesaver if you don’t want to deal with the setup wizard that pops up the first time you run Rocket.Chat. Normally, you’d have to go through a bunch of steps, like entering a valid email address, just to create an admin account. But with this set to false, you can skip all that and jump straight into using Rocket.Chat with the admin account you define in the config.

Admin Account Settings

These are the credentials for your admin account. You’ll use this to log in and manage Rocket.Chat:
- ADMIN_USERNAME=admin
This is the username for your admin account. You can change it to whatever you like, but `admin` is simple and easy to remember.
- ADMIN_PASS=yoursecurepasswordxss
This is the password for your admin account.
- ADMIN_EMAIL=admin@xss.pro
This is the email address tied to your admin account. It’s mostly used for password recovery, so make sure it’s something you can access if you ever get locked out.


Database Connection Settings

Rocket.Chat needs a database to store all its data, and these settings tell it how to connect to MongoDB:

- MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat

This is the connection string for MongoDB. Let’s break it down:
-rocketchat is the username you created in MongoDB.
-xss%40123 is the password, but since it has special characters (like @), it’s URL-encoded. For example, xss@123 becomes xss%40123.
-localhost:27017 is where your MongoDB server is running (usually on the same machine).
- rocketchat is the name of the database you created for Rocket.Chat.

PS: Double-check that the username, password, and database name match what you set up in MongoDB. If they don’t, Rocket.Chat won’t be able to connect.

- MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local

This is for MongoDB’s Oplog, which helps Rocket.Chat handle real-time updates and scaling.
- It uses the same username and password as above.
- local is the Oplog database in MongoDB.

Rocket.Chat Server Settings

These settings control how the Rocket.Chat server runs:

-ROOT_URL=http://rocket-chat.onion
This is the main address of your Rocket.Chat instance. If you’re running it over Tor, replace rocket-chat.onion with your actual .onion address.

- PORT=3000
This is the port Rocket.Chat will use to run. By default, it’s set to 3000, but you can change it if needed.


Why These Settings Matter

By setting these up, you’re basically telling Rocket.Chat:
1. Skip the boring setup wizard : I don’t want to deal with it.
2. Create an admin account for me : here are the credentials.
3. Connect to my database here’s : how to find it and log in.
4. Run on this address and port : so I know where to find it.

This way, you can get Rocket.Chat up and running quickly without jumping through hoops. If you’re running it over Tor, it’s even more important to get these settings right so everything works smoothly.

Create a systemd service file for Rocket.Chat:

nano /etc/systemd/system/rocketchat.service
Код:
[Unit]
Description=Rocket.Chat Service
After=network.target

[Service]
Type=simple
EnvironmentFile=/etc/rocketchat.env
ExecStart=/usr/bin/node /path/to/bundle/main.js
Restart=always
User=root
Group=root
WorkingDirectory=/path/to/bundle
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

Enable and start the Rocket.Chat service:

systemctl enable rocketchat
systemctl start rocketchat
1738487098767.png



1738489466761.png


1738489549173.png


You now have Rocket.Chat running securely over the Tor network. This setup ensures privacy and anonymity for your messaging platform. If you encounter any issues or have questions, feel free to ask in the comments below!

BestRegards !
Author : blackhunt
Special for xss.pro
 
Установка и настройка Rocket.Chat в сети Tor Если вы хотите создать безопасную и анонимную платформу для обмена сообщениями, Rocket.Chat - один из лучших вариантов. В этой статье я расскажу вам о том, как установить Rocket.Chat на сервер Ubuntu и запустить его через сеть Tor.

Что такое Rocket.Chat и почему он важен?

Rocket.Chat - это настраиваемая платформа для обмена сообщениями с открытым исходным кодом, которая позволяет вам разместить свой собственный частный чат-сервер. Работа в сети Tor повышает безопасность и конфиденциальность пользователей.

Преимущества Rocket.Chat
- Частные и групповые чаты
- Сквозное шифрование (E2EE)
- Голосовые и видеозвонки
- Управление пользователями и контроль доступа

Шаги по установке Rocket.Chat на Ubuntu

1. Установите Node.js

Код:
curl -o- https://fnm.vercel.app/install | bash
source ~/.bashrc
fnm install 20
npm install -g npm@11
node -v
npm -v

Далее найдите путь к Node.js и привяжите его к/usr/bin/node:

Код:
ln -s $(which node) /usr/bin/node

1738529825618.png


2. Установите MongoDB

Код:
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.1.tgz
tar -xvzf mongodb-linux-x86_64-ubuntu2004-6.0.1.tgz
sudo mv mongodb-linux-x86_64-ubuntu2004-6.0.1/bin/* /usr/local/bin/
mongod --version

1738529875946.png


3. Установите Rocket.Chat

Код:
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
tar -xvzf rocket.chat.tgz
cd bundle/programs/server/
npm install

1738529912364.png


5. Установка mongosh для конфигурации MongoDB

Для конфигурирования MongoDB мы будем использовать mongosh. Скачайте и установите его:

Код:
wget https://downloads.mongodb.com/compass/mongosh-2.3.8-linux-x64.tgz
tar -xvzf mongosh-2.3.8-linux-x64.tgz
sudo mv mongosh-2.3.8-linux-x64/bin/mongosh /usr/local/bin/
mongosh --version

1738529959799.png


Далее включите replication в MongoDB. Отредактируйте файл mongod.conf:

Код:
nano /etc/mongod.conf

Добавьте следующие строки в раздел replication:

Код:
replication:
  replSetName: "rs0"

1738530098592.png


Перезапустите службу MongoDB:

Код:
systemctl restart mongod

Подключитесь к MongoDB с помощью mongosh:

Код:
mongosh

Инициализируйте replication:

Код:
rs.initiate()

Проверьте состояние replication:

Код:
rs.status()

1738530189256.png


Создайте базу данных для Rocket.Chat:

Код:
use rocketchat

Создайте пользователя Rocket.Chat для доступа к базе данных:

Код:
db.createUser(
  {
    user: "rocketchat",
    pwd: "xss@123",
    roles: [{ role: "readWrite", db: "rocketchat" }]
  }
)

Важное замечание: если ваше имя пользователя или пароль содержат специальные символы (например, @, !, #), вы должны закодировать их в URL. Например:
  • xss@123 превращается в xss%40123.
Для кодирования пароля можно использовать онлайн-инструмент, например URL Encoder.

Выйдите из оболочки MongoDB:

Код:
exit

Запустите Rocket.Chat вручную
Перейдите в каталог Rocket.Chat и запустите сервер:

Код:
cd /path/to/bundle

MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local?replicaSet=rs0 ROOT_URL=http://127.0.0.1:3000 PORT=3000 /usr/bin/node main.js

Если все настроено правильно, Rocket.Chat должен запуститься без проблем.

Настройка Rocket.Chat в сети Tor

1. Установите Tor и Nginx

Установите Tor и Nginx для маршрутизации Rocket.Chat через сеть Tor:

Код:
apt install tor nginx

2. Настройте Tor

Отредактируйте файл конфигурации Tor, чтобы создать скрытую службу:

Код:
nano /etc/tor/torrc

Добавьте следующие строки:

Код:
HiddenServiceDir /var/lib/tor/rocketchat/
HiddenServicePort 80 127.0.0.1:80
HiddenServicePort 443 127.0.0.1:443

Перезапустите Tor:

Код:
systemctl restart tor

Получите свой луковый адрес:

Код:
cat /var/lib/tor/rocketchat/hostname

3. Настройте Nginx

Отредактируйте файл конфигурации Nginx:

Код:
nano /etc/nginx/nginx.conf

Установите значение server_names_hash_bucket_size равным 128:

1738530476295.png


Создайте самоподписанный SSL-сертификат для вашего сайта onion:

Код:
cd /etc/nginx/ssl/
Код:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout rocketchat.key -out rocketchat.crt

Когда появится запрос на общее имя (CN), введите адрес вашего сайта onion.

Создайте файл конфигурации Nginx для Rocket.Chat:

Код:
nano /etc/nginx/sites-enabled/rocketchat

Добавьте следующую конфигурацию:

1738530526307.png


Код:
server {
    listen 0.0.0.0:443 ssl;
    server_name onion.onion;

    ssl_certificate /etc/nginx/ssl/rocketchat.crt;
    ssl_certificate_key /etc/nginx/ssl/rocketchat.key;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
    }

}

server {
    listen 0.0.0.0:80;
    server_name onion.onion;
    return 301 https://$host$request_uri;
}

Свяжите файл конфигурации с каталогом sites-available:

Код:
ln -s /etc/nginx/sites-enabled/rocketchat /etc/nginx/sites-available/rocketchat

Проверьте конфигурацию Nginx:

Код:
nginx -t

1738530595478.png


Перезапустите Nginx:

Код:
systemctl restart nginx

4. Обновление конфигурации Rocket.Chat

Обновите ROOT_URL в команде запуска Rocket.Chat, чтобы использовать ваш onion-адрес:

Код:
MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local?replicaSet=rs0 ROOT_URL=http://your-onion-site.onion:3000 PORT=3000 /usr/bin/node main.js

5. Настройка Rocket.Chat как службы
Создайте файл окружения для Rocket.Chat:

Код:
nano /etc/rocketchat.env

Добавьте следующую конфигурацию:

Код:
OVERWRITE_SETTING_Show_Setup_Wizard=false
ADMIN_USERNAME=admin
ADMIN_PASS=yoursecurepasswordxss
ADMIN_EMAIL=admin@xss.pro
MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat
MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local
ROOT_URL=http://your-onion-site.onion
PORT=3000

Эти настройки призваны облегчить настройку и использование Rocket.Chat, особенно если вы хотите пропустить некоторые из обычных шагов по настройке. Позвольте мне рассказать вам обо всем по порядку:

OVERWRITE_SETTING_Show_Setup_Wizard=false

Эта настройка спасет вас, если вы не хотите иметь дело с мастером настройки, который появляется при первом запуске Rocket.Chat. Обычно, чтобы создать учетную запись администратора, вам придется пройти кучу шагов, например, ввести правильный адрес электронной почты. Но если установить значение false, вы сможете пропустить все эти шаги и сразу же начать использовать Rocket.Chat с учетной записью администратора, которую вы определите в конфигурации.

Настройки учетной записи администратора

Это учетные данные для вашей учетной записи администратора. Вы будете использовать его для входа и управления Rocket.Chat:
- ADMIN_USERNAME=admin
Это имя пользователя для вашей учетной записи администратора. Вы можете изменить его на любое другое, но admin - простое и легко запоминающееся.
- ADMIN_PASS=yoursecurepasswordxss
Это пароль для вашей учетной записи администратора.
- ADMIN_EMAIL=admin@xss.pro
Это адрес электронной почты, привязанный к вашей учетной записи администратора. В основном он используется для восстановления пароля, поэтому убедитесь, что вы сможете получить доступ к нему, если вас заблокируют.


Настройки подключения к базе данных

Rocket.Chat нуждается в базе данных для хранения всех своих данных, и эти настройки указывают ему, как подключиться к MongoDB:

- MONGO_URL=mongodb://rocketchat:xss%40123@localhost:27017/rocketchat

Это строка подключения для MongoDB. Давайте разберем ее на части:
-rocketchat - это имя пользователя, которое вы создали в MongoDB.
-xss%40123 - это пароль, но поскольку в нем есть специальные символы (например, @), он кодируется в URL. Например, xss@123 превращается в xss%40123.
-localhost:27017 - это место, где запущен ваш сервер MongoDB (обычно на той же машине).
- rocketchat - это имя базы данных, которую вы создали для Rocket.Chat.

PS: Дважды проверьте, что имя пользователя, пароль и название базы данных совпадают с тем, что вы задали в MongoDB. Если они не совпадают, Rocket.Chat не сможет подключиться.

- MONGO_OPLOG_URL=mongodb://rocketchat:xss%40123@localhost:27017/local

Это Oplog для MongoDB, который помогает Rocket.Chat обрабатывать обновления и масштабирование в реальном времени.
- Здесь используются те же имя пользователя и пароль, что и выше.
- local - это база данных Oplog в MongoDB.

Настройки сервера Rocket.Chat

Эти настройки управляют работой сервера Rocket.Chat:

-ROOT_URL=http://rocket-chat.onion
Это основной адрес вашего экземпляра Rocket.Chat. Если вы запускаете его через Tor, замените rocket-chat.onion на ваш фактический адрес .onion.

- PORT=3000
Это порт, который Rocket.Chat будет использовать для работы. По умолчанию он установлен на 3000, но вы можете изменить его при необходимости.


Почему эти настройки важны

Настраивая эти параметры, вы, по сути, говорите Rocket.Chat:
1. Пропустить скучный мастер настройки: я не хочу с ним возиться.
2. Создайте для меня учетную запись администратора: вот учетные данные.
3. Подключитесь к моей базе данных: вот как ее найти и войти.
4. Запустите по этому адресу и порту, чтобы я знал, где его найти.

Таким образом, вы сможете быстро запустить Rocket.Chat без лишних хлопот. Если вы запускаете его через Tor, еще важнее правильно настроить эти параметры, чтобы все работало без сбоев.

Создайте файл службы systemd для Rocket.Chat:

Код:
nano /etc/systemd/system/rocketchat.service

Код:
[Unit]
Description=Rocket.Chat Service
After=network.target

[Service]
Type=simple
EnvironmentFile=/etc/rocketchat.env
ExecStart=/usr/bin/node /path/to/bundle/main.js
Restart=always
User=root
Group=root
WorkingDirectory=/path/to/bundle
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

Включите и запустите службу Rocket.Chat:
Код:
systemctl enable rocketchat
systemctl start rocketchat

1738530889827.png


1738530904121.png


1738530917319.png


Теперь Rocket.Chat работает в безопасном режиме через сеть Tor. Такая настройка обеспечивает конфиденциальность и анонимность вашей платформы для обмена сообщениями. Если у вас возникнут проблемы или вопросы, задавайте их в комментариях ниже!

Переведено для xss.pro
Автор : blackhunt
Статья на английском языке : https://xss.pro/threads/132159/
 
Последнее редактирование:


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх