exclude_badExits/exclude_badExits.bash

62 lines
1.8 KiB
Bash
Raw Normal View History

2022-11-16 23:15:00 +01:00
#!/bin/bash
# -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-
PROG=exclude_badExits.py
SOCKS_PORT=9050
2022-11-29 15:52:48 +01:00
SOCKS_HOST=127.0.0.1
2022-11-16 23:15:00 +01:00
CAFILE=/etc/ssl/certs/ca-certificates.crt
2022-11-29 13:54:36 +01:00
# you may have a special python for installed packages
EXE=`which python3.bash`
2024-01-17 15:12:46 +01:00
MOD=exclude_badExits
2022-11-16 23:15:00 +01:00
2024-01-17 15:12:46 +01:00
[ -f exclude_badExits.hlp -a exclude_badExits.hlp -nt src/exclude_badExits/exclude_badExits.py] || \
PYTHONPATH=$PWD/src \
$EXE src/${MOD}/exclude_badExits.py --help > exclude_badExits.hlp
[ -f README.md -a README.md -nt src/exclude_badExits/exclude_badExits.py] || \
PYTHONPATH=$PWD/src \
$EXE -c 'from exclude_badExits.exclude_badExits import __doc__; print(__doc__)' \
> README.md
2022-11-16 23:15:00 +01:00
# an example of running exclude_badExits with full debugging
2022-11-29 15:52:48 +01:00
# expected to 20 minutes or so
2022-11-16 23:15:00 +01:00
declare -a LARGS
LARGS=(
2022-11-29 15:52:48 +01:00
# --saved_only
2022-11-29 13:54:36 +01:00
# --strict_nodes 1
2022-11-29 15:52:48 +01:00
--points_timeout 150
2022-11-16 23:15:00 +01:00
--log_level 10
2022-11-29 13:54:36 +01:00
--https_cafile $CAFILE
2022-11-29 15:52:48 +01:00
)
[ -z "$socks_proxy" ] || \
2022-11-16 23:15:00 +01:00
LARGS+=(
2022-11-29 15:52:48 +01:00
--proxy-host $SOCKS_HOST
2022-11-16 23:15:00 +01:00
--proxy-port $SOCKS_PORT
)
2022-11-29 15:52:48 +01:00
if [ -f /var/lib/tor/.SelekTOR/3xx/cache/9050/notice.log ] ; then
LARGS+=(--notice_log /var/lib/tor/.SelekTOR/3xx/cache/9050/notice.log)
fi
if [ -d /var/lib/tor/hs ] ; then
LARGS+=( --hs_dir /var/lib/tor/hs )
fi
2022-11-16 23:15:00 +01:00
if [ -f '/run/tor/control' ] ; then
LARGS+=(--proxy-ctl '/run/tor/control' )
else
LARGS+=(--proxy-ctl 9051 )
fi
ddg=duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad
# for example, whitelist the introduction points to DuckDuckGo
LARGS+=( --white_onions $ddg )
# you may need to be the tor user to read /run/tor/control
grep -q ^debian-tor /etc/group && TORU=debian-tor || {
grep -q ^tor /etc/group && TORU=tor
2022-11-29 13:54:36 +01:00
}
# --saved_only
2024-01-15 12:09:20 +01:00
sudo -u $TORU $EXE src/exclude_badExits/exclude_badExits.py "${LARGS[@]}" "$@" \
2022-11-16 23:15:00 +01:00
2>&1|tee exclude_badExits6.log
# The DEBUG statements contain the detail of why the relay was considered bad.