post-setup scripts to enable tor

This commit is contained in:
nahuhh 2024-01-29 22:38:18 -05:00
parent 97d30e6a07
commit 4be6b3c549
5 changed files with 60 additions and 6 deletions

View file

@ -12,15 +12,31 @@ cd basicswap-bash && ./install.sh
basicswap-bash basicswap-bash
``` ```
### Add coins #### Enable/Disable Tor [post install]
```
bsx-enabletor
```
```
bsx-disabletor
```
#### Add coins
``` ```
bsx-addcoin bsx-addcoin
``` ```
### Update BSX core #### Update blockchains
```
bsx-update
```
### Update blockchains
``` ```
bsx-upgrade-coins bsx-upgrade-coins
``` ```
#### Update BSX core
```
bsx-update
```
A small donation goes a long way. Thanks
- ofrnxmr
```
8Bb9z1bbiKmD9XekA7uESXRzunasN1ndej6FUm1bRFEtSPFqVWvHPtD2LDwhARikcxNkCsmaBcGGF2VSeFWhMe57FGXNaZP
```
[WASS](getwishlisted.xyz/ofrnxmr)

4
bsx-disabletor Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/disabletor.sh

4
bsx-enabletor Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/enabletor.sh

2
bsx/disabletor.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
basicswap-prepare --datadir=$SWAP_DATADIR --disabletor

28
bsx/enabletor.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
# TODO: check for tor instead of YOLOing it
# Install and configure tor
sudo apt install tor -y
# Create HashesControlPassword
echo -e "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT."
read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass
torhashedpass=$(tor --hash-password $torcontrolpass)
# Remove conflicting ControlPort if enabled
sudo sed -i -z "s/\nControlPort 9051//" /etc/tor/torrc
# Add New ControlPort and HashedControlPassword
echo -e "\n#Added by BSX\nControlPort 9051\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc
# Restart tor to apply
sudo systemctl restart tor
echo "waiting for tor" && sleep 5
# lol are we there yet?
TOR_PROXY_HOST=127.0.0.1
basicswap-prepare --datadir=$SWAP_DATADIR --enabletor
# Replace torpassword in various config files
oldtorpass=$(cat $SWAP_DATADIR/basicswap.json | jq -r .tor_control_password)
sed -i "s/$oldtorpass/$torcontrolpass/" $SWAP_DATADIR/*/*.conf $SWAP_DATADIR/basicswap.json
# localhost binding for btc/ltc/part (etc) configs
sed -i -z "s/\nbind=0.0.0.0/\nbind=127.0.0.1/" $SWAP_DATADIR/*/*.conf
# TODO edit use tor proxy for with coin upgrades