Skip to content

Commit

Permalink
Adding conditional to check for blank .onion and also trying sudo wit…
Browse files Browse the repository at this point in the history
…h cat.
  • Loading branch information
David Huerta committed Mar 30, 2016
1 parent 476305a commit 5d102ff
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ mv /etc/tor/torrc /etc/tor/torrc.orig
cp blooming-onion/config/tor/torrc /etc/tor/.
service tor reload

ONION_ADDRESS=`cat /var/lib/tor/hidden_service/hostname`

echo 'Setting up the web server NGINX to use Tor onion service...'
mv /etc/nginx/sites-available/ghost /etc/nginx/sites-available/ghost.orig
cp blooming-onion/config/nginx/ghost /etc/nginx/sites-available/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /etc/nginx/sites-available/ghost

echo 'Updating Ghost config to use .onion address...'
mv /var/www/ghost/config.js /var/www/ghost/config.js.orig
cp blooming-onion/config/ghost/config.js /var/www/ghost/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.js

echo 'Restarting NGINX...'
service nginx reload

echo 'Congrats! You now have your very own Tor onion service.'
echo 'Enter this address into the Tor browser: '$ONION_ADDRESS
ONION_ADDRESS=`sudo cat /var/lib/tor/hidden_service/hostname`

if [ -n "$ONION_ADDRESS" ]; then
echo 'Setting up the web server NGINX to use Tor onion service...'
mv /etc/nginx/sites-available/ghost /etc/nginx/sites-available/ghost.orig
cp blooming-onion/config/nginx/ghost /etc/nginx/sites-available/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /etc/nginx/sites-available/ghost

echo 'Updating Ghost config to use .onion address...'
mv /var/www/ghost/config.js /var/www/ghost/config.js.orig
cp blooming-onion/config/ghost/config.js /var/www/ghost/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.js

echo 'Restarting NGINX...'
service nginx reload

echo 'Congrats! You now have your very own Tor onion service.'
echo 'Enter this address into the Tor browser: '$ONION_ADDRESS
else
echo 'Could not get a .onion address. :( Try running this script one more time?'
fi

0 comments on commit 5d102ff

Please sign in to comment.