Verified Commit 2b7ae7f8 authored by Silvio Rhatto's avatar Silvio Rhatto
Browse files

Feat: replace Makefile by the onionmine wrapper (Closes #18)

parent e4c313ba
pools
onionmine.conf
bin/mkp224o
Makefile.local
......@@ -74,11 +74,6 @@ when setting up Onion Services, and Onionmine aims to ease this process.
* Can be integrated with an external password manager
to store the random seed.
## Dependencies
* [Debian GNU/Linux](https://www.debian.org).
* [GNU Make](https://tracker.debian.org/pkg/make-dfsg) package.
## Usage
### Getting
......@@ -100,26 +95,28 @@ configuration](onionmine.conf.sample) with lots of examples:
The following command installs the needed dependencies on an Debian-compatible
system and compiles `mkp224o` (requires `sudo` privileges):
make provision
./onionmine provision
You might run it on a dedicated enviroment, such as an Raspberry Pi mini-server
or a dedicated virtual machine.
Currently testes only on [Debian GNU/Linux](https://www.debian.org).
### Mining
Create a configuration, use yor favourite `$EDITOR` to create filters
and start mining!
make config pool=my-pool # create a config called "my-pool"
./onionmine config my-pool # create a config called "my-pool"
$EDITOR pools/my-pool/filters.lst # populate your filters
make mine pool=my-pool # start mining
./onionmine mine my-pool # start mining
This command takes care of compiling `mkp224o` and start mining with the
desired configuration.
Run the above `make config` command for each Onion Service you're mining keys.
Configuration and mined keys are stored under the `pool/my-pool` folder, with
mined keys at the `pool/my-pool/candidates`.
Run the above `onionmine config` command for each Onion Service you're mining
keys. Configuration and mined keys are stored under the `pool/my-pool` folder,
with mined keys at the `pool/my-pool/candidates`.
Check [this configuration](pools/example.org) for an example mining pool.
......@@ -135,7 +132,7 @@ If by any change a `mkp224o` recompilation is neeed without triggering
additional key generation, use this command (e.g. after you change it's build
flags at the `onionmine.conf` file):
make compile
./onionmine compile
### Stopping and resuming
......@@ -186,7 +183,9 @@ related keys.
Once you selected a candidate address that suits your needs, you might want to
test if the keys are validated by the Tor process, just to make sure.
Onionmine provides a test script for that, located at `bin/test-keys`.
Onionmine provides a test script for that:
./onionmine test-keys
Check [this
issue](https://gitlab.torproject.org/tpo/onion-services/onionmine/-/issues/2)
......@@ -200,7 +199,7 @@ compiled.
It can be invoked by running
./bin/onion-csr
./onionmine onion-csr
## Tasks
......
......@@ -25,7 +25,7 @@ source $DIRNAME/params
# Check
if [ -z "$CONFIG" ]; then
echo "usage: $BASENAME <config-pool-name>"
echo "usage: onionmine $BASENAME <config-pool-name>"
exit 1
fi
......
......@@ -25,7 +25,7 @@ source $DIRNAME/params
# Check
if [ -z "$CONFIG" ]; then
echo "usage: $BASENAME <config-pool-name>"
echo "usage: onionmine $BASENAME <config-pool-name>"
exit 1
elif [ ! -e "$FILTERS" ]; then
echo "$BASENAME: no such file $FILTERS"
......@@ -47,7 +47,7 @@ fi
# Compile
echo "$BASENAME: compiling mkp224o to make sure it's built with the current flags..."
make -C $BASEDIR compile
$DIRNAME/compile
# Start log
echo ">started at: $DATE" > $LOG
......
......@@ -39,5 +39,5 @@ for pool in `ls $POOLS`; do
# Start mining
echo ">batch: processing pool: $pool"
make -C $BASEDIR mine pool=$pool
$DIRNAME/mine $pool
done
......@@ -28,7 +28,7 @@ echo "$BASENAME: installing $DEPENDENCIES..."
sudo apt install -y $DEPENDENCIES
# Compile
#make -C $BASEDIR compile
#$DIRNAME/compile
# Build HARICA's onion-csr
sudo gem install ffi
......
#!/usr/bin/env bash
#
# Mine Onion Service keys using mkp224o on remote servers.
# Sync Onionmine to remote servers.
#
# Copyright (C) 2022 Silvio Rhatto <rhatto@torproject.org>
#
......
......@@ -51,7 +51,7 @@ function teardown() {
}
function usage() {
echo "usage: $BASENAME <pool> <candidate> [wait]"
echo "usage: onionmine $BASENAME <pool> <candidate> [wait]"
echo ""
echo "Test an Onion Service keypair candidate mined in a pool"
echo ""
......
# Onionmine Makefile
#!/usr/bin/env bash
#
# Onionmine wrapper.
#
# Copyright (C) 2022 Silvio Rhatto <rhatto@torproject.org>
#
......@@ -16,28 +18,32 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Include the sample config
#-include onionmine.conf.sample
# Include the config file so Makefile includes custom configs and
# overrides
-include onionmine.conf
# Provision the environment
provision:
@bin/provision
# Compile mkp224o
compile:
@bin/compile
# Parameters
BASENAME="`basename $0`"
DIRNAME="`dirname $0`"
source $DIRNAME/bin/params
# Create a pool configuration
config:
@bin/config ${pool}
# Additional parameters
COMMAND="$1"
# Start mining
mine:
@bin/mine ${pool}
# Usage
function usage() {
echo "usage: $BASENAME <command> [options]"
echo ""
echo "available commands"
echo ""
ls -1 $DIRNAME/bin | sed -e 's/^/\t/'
echo ""
}
# Include local targets
-include Makefile.local
# Dispatch
if [ -z "$COMMAND" ]; then
usage
exit 1
elif [ -e "$DIRNAME/bin/$COMMAND" ]; then
shift
$DIRNAME/bin/$COMMAND "$@"
else
usage
exit 1
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment