Hidden service path

This commit is contained in:
Bob Mottram 2017-06-11 14:23:24 +01:00
parent da059f8368
commit 304963caca
2 changed files with 16 additions and 24 deletions

View File

@ -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

View File

@ -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}"