Skip to content

Commit

Permalink
Updating for newer Ghost one-click app.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Huerta committed Jan 5, 2018
1 parent 3090e76 commit b969683
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 17 deletions.
30 changes: 30 additions & 0 deletions config/ghost/config.production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"url": "http://ONION_PLACEHOLDER",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "ghost",
"password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a",
"database": "ghost_production"
},
"debug": false
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/ghost/content"
}
}
29 changes: 29 additions & 0 deletions config/ghost/config.production.json.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"url": "http://my-ghost-blog.com",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "ghost",
"password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a",
"database": "ghost_production"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/ghost/content"
}
}
4 changes: 2 additions & 2 deletions config/tor/torrc.orig
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ DataDirectory /var/lib/tor
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80 127.0.0.1:80

#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
Expand Down
7 changes: 4 additions & 3 deletions restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ echo 'Restoring NGINX config...'
cp blooming-onion/config/nginx/ghost.orig /etc/nginx/sites-available/ghost

echo 'Restoring Ghost config...'
cp blooming-onion/config/ghost/config.js.orig /var/www/ghost/config.js
#cp blooming-onion/config/ghost/config.js.orig /var/www/ghost/config.js
cp blooming-onion/config/ghost/config.production.json.orig /var/www/ghost/config.production.json

echo 'Restoring torrc...'
cp blooming-onion/config/tor/torrc.orig /etc/tor/torrc

echo 'Removing auto-upgrades config...'
rm /etc/apt/apt.conf.d/20auto-upgrades
#echo 'Removing auto-upgrades config...'
#rm /etc/apt/apt.conf.d/20auto-upgrades

# DANGERZONE
echo 'REMOVING hidden service ***CANNOT UNDO*** (requires confirmation)...'
Expand Down
25 changes: 13 additions & 12 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
#!/bin/bash
#!/usr/bin/env bash
# Blooming Onion (c) David Huerta. Distributed under the GPL v3 license. See LICENSE.txt for deets.

echo 'Removing any installed mail servers because they will hurt you.'
echo 'Type "y" and hit enter to remove when asked.'
apt-get remove --purge exim postfix sendmail
apt-get -y remove --purge exim postfix sendmail

echo 'Applying software updates...'
#echo 'Type "y" and hit enter to install when asked.'
apt-get update
apt-get -y upgrade
apt-get -y --force-confold upgrade

echo 'Installing Tor from official Tor software repository...'
#echo 'Type "y" and hit enter to install Tor when asked.'
add-apt-repository http://deb.torproject.org/torproject.org
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
apt-get update
apt-get -y install tor deb.torproject.org-keyring
apt-get -y --force-confold install tor deb.torproject.org-keyring

echo 'Setting up Tor onion service...'
#echo 'Configuring automatic security upgrades...'
#apt-get -y install unattended-upgrades
#cp blooming-onion/config/apt/20auto-upgrades /etc/apt/apt.conf.d/.

echo 'Setting up Tor onion service and waiting 5 seconds for .onion address creation...'
cp blooming-onion/config/tor/torrc /etc/tor/.
service tor reload
sleep 5s

echo 'Configuring automatic security upgrades...'
apt-get -y install unattended-upgrades
cp blooming-onion/config/apt/20auto-upgrades /etc/apt/apt.conf.d/.

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

if [ -n "$ONION_ADDRESS" ]; then
echo 'Setting up the web server NGINX to use Tor onion service...'
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...'
cp blooming-onion/config/ghost/config.js /var/www/ghost/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.js
cp blooming-onion/config/ghost/config.production.json /var/www/ghost/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.production.json

echo 'Restarting NGINX...'
service nginx reload
Expand Down

0 comments on commit b969683

Please sign in to comment.