Skip to content
Snippets Groups Projects
Commit 304963ca authored by Bob Mottram's avatar Bob Mottram
Browse files

Hidden service path

parent da059f83
No related branches found
No related tags found
No related merge requests found
......@@ -323,20 +323,10 @@ function install_rss_main {
rss_create_database
RSS_READER_ONION_HOSTNAME=$(add_onion_service rss 80 ${RSS_READER_ONION_PORT})
if [[ "$RSS_READER_ONION_HOSTNAME" != *".onion" ]]; then
echo $'Unable to create onion address for rss reader site'
echo "$RSS_READER_ONION_HOSTNAME"
exit 7352582
fi
sleep 4
sleep 2
RSS_MOBILE_READER_ONION_HOSTNAME=$(add_onion_service rss_mobile 80 ${RSS_MOBILE_READER_ONION_PORT})
if [[ "$RSS_MOBILE_READER_ONION_HOSTNAME" != *".onion" ]]; then
echo $'Unable to create onion address for rss mobile site'
echo "$RSS_MOBILE_READER_ONION_HOSTNAME"
exit 7639532
fi
echo 'server {' > /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo " listen 127.0.0.1:$RSS_MOBILE_READER_ONION_PORT;" >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
......
......@@ -34,6 +34,8 @@ TOR_MAX_TRAFFIC_PER_DAY_GB=3
TOR_PACKAGE_UPSTREAM='http://deb.torproject.org/torproject.org'
TOR_GPG_KEY='A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89'
HIDDEN_SERVICE_PATH='/var/lib/tor/hidden_service_'
function add_email_hostname {
extra_email_hostname="$1"
email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
......@@ -54,7 +56,7 @@ function wait_for_onion_service_base {
onion_service_name="$1"
sleep_ctr=0
while [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; do
while [ ! -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; do
sleep 1
sleep_ctr=$((sleep_ctr + 1))
if [ $sleep_ctr -gt 10 ]; then
......@@ -68,7 +70,7 @@ function wait_for_onion_service {
wait_for_onion_service_base ${onion_service_name}
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
if [ ! -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then
# try a second time
onion_update
wait_for_onion_service_base ${onion_service_name}
......@@ -95,13 +97,13 @@ function remove_onion_service {
fi
fi
fi
if [ -d /var/lib/tor/hidden_service_${onion_service_name} ]; then
shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
rm -rf /var/lib/tor/hidden_service_${onion_service_name}
if [ -d ${HIDDEN_SERVICE_PATH}${onion_service_name} ]; then
shred -zu ${HIDDEN_SERVICE_PATH}${onion_service_name}/*
rm -rf ${HIDDEN_SERVICE_PATH}${onion_service_name}
fi
if [ -d /var/lib/tor/hidden_service_${onion_service_name}_mobile ]; then
shred -zu /var/lib/tor/hidden_service_${onion_service_name}_mobile/*
rm -rf /var/lib/tor/hidden_service_${onion_service_name}_mobile
if [ -d ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile ]; then
shred -zu ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile/*
rm -rf ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile
fi
remove_completion_param "${onion_service_name} onion domain"
onion_update
......@@ -113,8 +115,8 @@ function add_onion_service {
onion_service_port_to=$3
onion_stealth_name="$4"
if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
if [ -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then
echo $(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname)
return
fi
......@@ -123,7 +125,7 @@ function add_onion_service {
exit 877367
fi
if ! grep -q "hidden_service_${onion_service_name}" /etc/tor/torrc; then
echo "HiddenServiceDir /var/lib/tor/hidden_service_${onion_service_name}/" >> /etc/tor/torrc
echo "HiddenServiceDir ${HIDDEN_SERVICE_PATH}${onion_service_name}/" >> /etc/tor/torrc
echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
if [ ${#onion_stealth_name} -gt 0 ]; then
echo "HiddenServiceAuthorizeClient stealth ${onion_stealth_name}" >> /etc/tor/torrc
......@@ -135,12 +137,12 @@ function add_onion_service {
function_check wait_for_onion_service
wait_for_onion_service ${onion_service_name}
if [ ! -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
if [ ! -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then
echo $"${onion_service_name} onion site hostname not found"
exit 763624
fi
onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
onion_address=$(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname)
# Record the domain in the completion file
set_completion_param "${onion_service_name} onion domain" "${onion_address}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment