Hidden service path
This commit is contained in:
parent
da059f8368
commit
304963caca
|
@ -323,20 +323,10 @@ function install_rss_main {
|
||||||
rss_create_database
|
rss_create_database
|
||||||
|
|
||||||
RSS_READER_ONION_HOSTNAME=$(add_onion_service rss 80 ${RSS_READER_ONION_PORT})
|
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})
|
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 '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
|
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_PACKAGE_UPSTREAM='http://deb.torproject.org/torproject.org'
|
||||||
TOR_GPG_KEY='A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89'
|
TOR_GPG_KEY='A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89'
|
||||||
|
|
||||||
|
HIDDEN_SERVICE_PATH='/var/lib/tor/hidden_service_'
|
||||||
|
|
||||||
function add_email_hostname {
|
function add_email_hostname {
|
||||||
extra_email_hostname="$1"
|
extra_email_hostname="$1"
|
||||||
email_hostnames=$(cat /etc/exim4/update-exim4.conf.conf | grep "dc_other_hostnames" | awk -F "'" '{print $2}')
|
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"
|
onion_service_name="$1"
|
||||||
|
|
||||||
sleep_ctr=0
|
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 1
|
||||||
sleep_ctr=$((sleep_ctr + 1))
|
sleep_ctr=$((sleep_ctr + 1))
|
||||||
if [ $sleep_ctr -gt 10 ]; then
|
if [ $sleep_ctr -gt 10 ]; then
|
||||||
|
@ -68,7 +70,7 @@ function wait_for_onion_service {
|
||||||
|
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
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
|
# try a second time
|
||||||
onion_update
|
onion_update
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
wait_for_onion_service_base ${onion_service_name}
|
||||||
|
@ -95,13 +97,13 @@ function remove_onion_service {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d /var/lib/tor/hidden_service_${onion_service_name} ]; then
|
if [ -d ${HIDDEN_SERVICE_PATH}${onion_service_name} ]; then
|
||||||
shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
|
shred -zu ${HIDDEN_SERVICE_PATH}${onion_service_name}/*
|
||||||
rm -rf /var/lib/tor/hidden_service_${onion_service_name}
|
rm -rf ${HIDDEN_SERVICE_PATH}${onion_service_name}
|
||||||
fi
|
fi
|
||||||
if [ -d /var/lib/tor/hidden_service_${onion_service_name}_mobile ]; then
|
if [ -d ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile ]; then
|
||||||
shred -zu /var/lib/tor/hidden_service_${onion_service_name}_mobile/*
|
shred -zu ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile/*
|
||||||
rm -rf /var/lib/tor/hidden_service_${onion_service_name}_mobile
|
rm -rf ${HIDDEN_SERVICE_PATH}${onion_service_name}_mobile
|
||||||
fi
|
fi
|
||||||
remove_completion_param "${onion_service_name} onion domain"
|
remove_completion_param "${onion_service_name} onion domain"
|
||||||
onion_update
|
onion_update
|
||||||
|
@ -113,8 +115,8 @@ function add_onion_service {
|
||||||
onion_service_port_to=$3
|
onion_service_port_to=$3
|
||||||
onion_stealth_name="$4"
|
onion_stealth_name="$4"
|
||||||
|
|
||||||
if [ -f /var/lib/tor/hidden_service_${onion_service_name}/hostname ]; then
|
if [ -f ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname ]; then
|
||||||
echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
|
echo $(cat ${HIDDEN_SERVICE_PATH}${onion_service_name}/hostname)
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ function add_onion_service {
|
||||||
exit 877367
|
exit 877367
|
||||||
fi
|
fi
|
||||||
if ! grep -q "hidden_service_${onion_service_name}" /etc/tor/torrc; then
|
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
|
echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
|
||||||
if [ ${#onion_stealth_name} -gt 0 ]; then
|
if [ ${#onion_stealth_name} -gt 0 ]; then
|
||||||
echo "HiddenServiceAuthorizeClient stealth ${onion_stealth_name}" >> /etc/tor/torrc
|
echo "HiddenServiceAuthorizeClient stealth ${onion_stealth_name}" >> /etc/tor/torrc
|
||||||
|
@ -135,12 +137,12 @@ function add_onion_service {
|
||||||
function_check wait_for_onion_service
|
function_check wait_for_onion_service
|
||||||
wait_for_onion_service ${onion_service_name}
|
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"
|
echo $"${onion_service_name} onion site hostname not found"
|
||||||
exit 763624
|
exit 763624
|
||||||
fi
|
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
|
# Record the domain in the completion file
|
||||||
set_completion_param "${onion_service_name} onion domain" "${onion_address}"
|
set_completion_param "${onion_service_name} onion domain" "${onion_address}"
|
||||||
|
|
Loading…
Reference in New Issue