Skip to content

Automatically creates onion domains for different services with a single command. E.g. Dash, SSH and ...

License

Notifications You must be signed in to change notification settings

HiveMinds/bash-create-onion-domains

Repository files navigation

Sets onion domain over tor for different services

WIP! Sets up an onion domain for:

  • SSH access over Tor into this device
  • Dash plots
  • ..

Creating Onion Domains

git clone https://github.com/HiveMinds/bash-ssh-over-tor.git
cd bash-create-onion-domains
chmod +x install-dependencies.sh
./install-dependencies.sh

chmod +x src/main.sh
src/main.sh --ssh --random

To generate a random new onion domain for the ssh service. Or to create an onion domain for a dash website/plot:

src/main.sh --dash --random

Reading Onion Domains

To see what the actual onion domain is, run:

src/main.sh --<your service> --get-onion

Like:

src/main.sh --ssh --get-onion

Developer Information

Below is information for developers, e.g. how to use this as a dependency in other projects.

Install this bash dependency in other repo

  • In your other repo, include a file named: .gitmodules that includes:
[submodule "dependencies/bash-ssh-over-tor"]
 path = dependencies/bash-ssh-over-tor
 url = https://github.com/hiveminds/bash-ssh-over-tor
  • Create a file named install-dependencies.sh with content:
# Remove the submodules if they were still in the repo.
git rm --cached dependencies/bash-ssh-over-tor

# Remove and re-create the submodule directory.
rm -r "$SCRIPT_PATH/dependencies"/bash-ssh-over-tor
mkdir -p "$SCRIPT_PATH/dependencies"/bash-ssh-over-tor

# (Re) add the BATS submodules to this repository.
git submodule add --force https://github.com/hiveminds/bash-ssh-over-tor dependencies/bash-ssh-over-tor
  • Install the submodule with:
chmod +x install-dependencies.sh
./install-dependencies.sh

Call this bash dependency from other repo

After including this dependency you can use the functions in this module like:

#!/bin/bash

# Source the file containing the functions
source "$(dirname "${BASH_SOURCE[0]}")/src/main.sh"

# Naming conventions:
# server - The pc that you access and control.
# client - The pc that you use to control the server.

# Configure tor and ssh such that allows ssh access over tor.
configure_ssh_over_tor_at_boot

The 0 and 1 after the package name indicate whether it will update the package manager afterwards (0 = no update, 1 = package manager update after installation/removal)

Testing

Put your unit test files (with extension .bats) in folder: /test/

Developer Prerequisites

(Re)-install the required submodules with:

chmod +x install-dependencies.sh
./install-dependencies.sh

Install:

sudo gem install bats
sudo apt install bats -y
sudo gem install bashcov
sudo apt install shfmt -y
pre-commit install
pre-commit autoupdate

Pre-commit

Run pre-commit with:

pre-commit run --all

Tests

Run the tests with:

bats test

If you want to run particular tests, you could use the test.sh file:

chmod +x test.sh
./test.sh

Code coverage

bashcov bats test

How to help

  • Include bash code coverage in GitLab CI.
  • Add additional (relevant) pre-commit hooks.
  • Develop Bash documentation checks here, and add them to this pre-commit.

About

Automatically creates onion domains for different services with a single command. E.g. Dash, SSH and ...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published