Skip to content

Commit

Permalink
Merge pull request #161 from BenWestgate/44-trust-individuals
Browse files Browse the repository at this point in the history
Improve Verification
  • Loading branch information
BenWestgate committed May 26, 2024
2 parents 25c0a09 + ba5c894 commit 6064cf4
Show file tree
Hide file tree
Showing 26 changed files with 3,691 additions and 311 deletions.
43 changes: 40 additions & 3 deletions b
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@
# THE SOFTWARE.

###############################################################################
# Sets environment variable and launches install-core
# Sets environment variable and launches install-core and/or installs Bails
###############################################################################

export VERSION='v0.6.0-alpha'
export ICON="--window-icon=$HOME/.local/share/icons/bails128.png"
DOTFILES='/live/persistence/TailsData_unlocked/dotfiles'

if [ "$1" == "--help" ]; then
echo "Bails Version: $VERSION"
exit 0
fi

# Check for root.
if [[ $(id -u) = "0" ]]; then
echo "
Expand All @@ -32,6 +41,34 @@ YOU SHOULD NOT RUN THIS SCRIPT AS ROOT!
read -rp "PRESS ENTER TO EXIT SCRIPT, AND RUN AGAIN AS $USER. "
exit 0
fi


BAILS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export BAILS_DIR
$BAILS_DIR/bails/.local/bin/install-core
# Installs Bails to tmpfs
rsync --recursive "$BAILS_DIR/bails/" "$HOME"
# shellcheck disable=SC1091
. "$HOME"/.profile
if [ -z "$1" ]; then # Don't update/install core if ran with a parameter
install-core
else
persistent-setup
fi &

until /usr/local/lib/tpscli is-unlocked && \
/usr/local/lib/tpscli is-active Dotfiles && \
[ -d "$DOTFILES" ] && [ -w "$DOTFILES" ]; do
sleep 1
done
# Install Bails to Persistent Storage
rsync -r --remove-source-files "$BAILS_DIR"/bails/ $DOTFILES
rsync --remove-source-files --recursive "$BAILS_DIR"/ $DOTFILES/.local/share/bails
rm -rf "$BAILS_DIR"

wait
if [ -z "$1" ]; then
zenity --info --title="Bails install successful" --text="Bails $VERSION has been installed." "$ICON" --icon-name=bails128
else
zenity --info --title="Bails update successful" --text="Bails has been updated to $VERSION." "$ICON" --icon-name=bails128
fi


3 changes: 3 additions & 0 deletions bails/.bitcoin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory is not the datadir, it will be copied to dotfiles which symlinks it into $HOME. It will contain the bitcoin.conf with the datadir= key set. This prevents accidentally ever using ~/.bitcoin, the default datadir that won't persist, even when launched from the command line as long as dotfiles are on.

This file will be clobbered by the README.md from bitcoin-core later.
5 changes: 5 additions & 0 deletions bails/.cache/fontconfig/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything in this directory
# This will create a destination in dotfiles later to preserve .cache/fontconfig from Bitcoin Core
*
# Except this file
!.gitignore
1 change: 0 additions & 1 deletion bails/.config/Bitcoin/Bitcoin-Qt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[General]
mask_values=true
strDataDir=/live/persistence/TailsData_unlocked/Persistent/.bitcoin
strThirdPartyTxUrls=explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/tx/%s
8 changes: 4 additions & 4 deletions bails/.local/bin/bails-backup
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# that they should be tested at least once a year, ideally twice or
# quarterly. The file is removed after backup is complete.



gnome-terminal --wait --title="Log of Persistent Storage Backup" --hide-menubar \
-- tails-installer --clone
stop-btc
#TODO move file described above into the autostart
tails-installer --backup
#TODO remove that file
9 changes: 7 additions & 2 deletions bails/.local/bin/bails-cloner
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@
# originals are restored and the temporary password is displayed for
# the clone's owner to photograph or write down. Files then restored.

gnome-terminal --wait --title="Log of Persistent Storage Clone" --hide-menubar \
-- tails-installer --clone
zenity --info --title='Coming soon'
exit 1
#stop-btc
#TODO move file described above into the autostart
#TODO display temporary passphrase
#tails-installer --backup
#TODO remove that file
28 changes: 16 additions & 12 deletions bails/.local/bin/bails-menu
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,33 @@

# Set environment variables
export WAYLAND_DISPLAY=""
export LOCAL_DIR="/live/persistence/TailsData_unlocked/dotfiles/.local/"
export DOTFILES="/live/persistence/TailsData_unlocked/dotfiles"
export LOCAL_DIR="$DOTFILES/.local/"
export DATA_DIR="/live/persistence/TailsData_unlocked/Persistent/.bitcoin"
export BAILS_DIR="$LOCAL_DIR"

# Fetch installed version
# shellcheck disable=SC1091
. $LOCAL_DIR/share/bails/b --help

onlynet_onion() {
zenity --question --title='Network Privacy' --width=420 --text='Bails offers different settings for connecting to the Bitcoin network. By default, Bitcoin Core connects to both clearnet and Tor (onion) peers, providing a balance between usability and privacy.
zenity --question --title='Network Privacy' --text='Bails offers two settings for connecting to the Bitcoin network. By default, Bitcoin Core connects to both clearnet and Tor (onion) peers, providing a balance between usability and privacy.
Would you like to enhance privacy by connecting exclusively to Tor (onion) peers with reduced clearnet exposure? This may limit your network diversity and can be less stable if you have limited Tor peers.' --icon-name=tor-connection --default-cancel
Would you like to enhance privacy by connecting exclusively to Tor (onion) peers with reduced clearnet exposure? This may limit your network diversity, speed and can be less stable if you have limited Tor peers.' --icon-name=tor-connection --default-cancel

zenity_exit_status=$?

if [ $zenity_exit_status = 0 ]; then
# User chose to enable -onlynet=onion
sed --in-place 's/#onlynet=<net>/onlynet=onion/' $DATA_DIR/bitcoin.conf
sed --in-place 's/#onlynet=<net>/onlynet=onion/' $DOTFILES/.bitcoin/bitcoin.conf
zenity --info --title='Network settings updated' --text='You have chosen to connect exclusively to Tor (onion) peers.
Your network settings have been updated.' --width=420 --icon-name=tor-connected-symbolic
Your network settings have been updated.' --icon-name=tor-connected-symbolic

else
# User chose default network settings
sed --in-place 's/onlynet=onion/#onlynet=<net>/' $DATA_DIR/bitcoin.conf
sed --in-place 's/onlynet=onion/#onlynet=<net>/' $DOTFILES/.bitcoin/bitcoin.conf
zenity --info --title='Default network settings' --text='You have chosen to keep the default network settings.
Bitcoin Core will continue to connect to both clearnet and Tor (onion) peers.' --width=420 --icon-name=tor-disconnected-symbolic
Bitcoin Core will continue to connect to both clearnet and Tor (onion) peers.' --icon-name=tor-disconnected-symbolic

fi
}
Expand All @@ -72,7 +76,7 @@ case "$response" in
"Clone") bails-clone ;;
"Backup") bails-backup ;;
"Settings") setting=$(zenity --window-icon="$LOCAL_DIR/share/icons/bails128.png" --question \
--icon-name=org.gnome.Settings --title=Settings --text="Coming soon\n\nConfigure Bitcoin Core on Tails" \
--icon-name=org.gnome.Settings --title=Settings --text="Configure Bitcoin Core on Tails" \
--extra-button="Update Bitcoin Core" --extra-button="Update Bails" --extra-button="Network Privacy" \
--switch --width=300) ;;
"Help") help=$(zenity --window-icon="$LOCAL/share/icons/bails128.png" --question \
Expand All @@ -83,17 +87,17 @@ case "$response" in
esac

case "$help" in
"Donate") xdg-open bitcoin: ;; # FIXME change address
"Donate") xdg-open bitcoin: ;; # FIXME: change address
"Report a Bug") tor-browser https://github.com/BenWestgate/Bails/issues ;;
"About") zenity --info --window-icon="$LOCAL_DIR/share/icons/bails128.png" \
--title="About Bails" --icon-name=bails128 --text="Bails version v0.5.0\n\nCopyright (C) 2023 Ben Westgate\n\nPlease contribute if you find Bails useful. Visit <a href='https://twitter.com/BenWestgate_'>https://twitter.com/BenWestgate_</a> for further information about the software.\nThe source code is available from <a href='https://github.com/BenWestgate/Bails'>https://github.com/BenWestgate/Bails</a>.\n\nThis is experimental software.\nDistributed under the MIT software license, see the accompanying file COPYING or <a href='https://opensource.org/licenses/MIT'>https://opensource.org/licenses/MIT</a>" --width=650 ;;
--title="About Bails" --icon-name=bails128 --text="Bails version $VERSION\n\nCopyright © 2024 Ben Westgate\n\nPlease contribute if you find Bails useful. Visit <a href='https://twitter.com/BenWestgate_'>https://twitter.com/BenWestgate_</a> for further information about the software.\nThe source code is available from <a href='https://github.com/BenWestgate/Bails'>https://github.com/BenWestgate/Bails</a>.\n\nThis is experimental software.\nDistributed under the MIT software license, see the accompanying file COPYING or <a href='https://opensource.org/licenses/MIT'>https://opensource.org/licenses/MIT</a>" --width=650 ;;
"Online Help") xdg-open https://bitcoin-core-on-tails.slack.com/ && \
xdg-open https://t.me/bails_support ;;
esac

case "$setting" in
"Update Bitcoin Core") /usr/bin/gnome-terminal --title="Updating Bitcoin Core..." --hide-menubar \
-- "$LOCAL_DIR/bin/install-core" ;;
-- "install-core" ;;
"Update Bails") /usr/bin/gnome-terminal --title="Updating Bails..." --hide-menubar \
-- rm -rf bails && git clone https://github.com/benwestgate/bails --depth=1 && bails/b ;;
"Network Privacy") onlynet_onion ;;
Expand Down
Loading

0 comments on commit 6064cf4

Please sign in to comment.