Skip to content

Commit

Permalink
ATOR-173 - Fix cron and add todos for later improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
yumirkov committed Mar 5, 2024
1 parent 83cbf3f commit 70a2d92
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions docker/scanner/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mkdir -p /root/.sbws/logs
mkdir -p /root/.sbws/log

crontab -l | { cat; echo "*/5 * * * * /usr/local/bin/sbws -c /root/.sbws.ini generate >> /root/.sbws/logs/generate.log 2>&1"; } | crontab -
crontab -l | { cat; echo "30 0 * * * /usr/local/bin/sbws -c /root/.sbws.ini cleanup >> /root/.sbws/logs/cleanup.log 2>&1"; } | crontab -
crontab -l | { cat; echo "*/5 * * * * /usr/local/bin/sbws -c /root/.sbws.ini generate >> /root/.sbws/log/generate.log 2>&1"; } | crontab -
crontab -l | { cat; echo "30 0 * * * /usr/local/bin/sbws -c /root/.sbws.ini cleanup >> /root/.sbws/log/cleanup.log 2>&1"; } | crontab -

service cron start

sbws scanner
3 changes: 2 additions & 1 deletion docs/source/config_tor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ connection to an existing Tor daemon.
Default configuration:

- ``SocksPort auto``: To proxy requests over Tor.
- ``CookieAuthentication 1``: The easiest way to authenticate to Tor.
- ``CookieAuthentication 0``: The easiest way to authenticate to Tor.
- ``HashedControlPassword``: The how to authenticate using password
- ``UseEntryGuards 0``: To avoid path bias warnings.
- ``UseMicrodescriptors 0``: Because full server descriptors are needed.
- ``SafeLogging 0``: Useful for logging, since there's no need for anonymity.
Expand Down
3 changes: 2 additions & 1 deletion sbws/util/stem.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def is_bootstrapped(c):
def _init_controller_port(port):
try:
c = Controller.from_port(port=port)
# todo - extract password to config
c.authenticate(password="password")
except (IncorrectSocketType, SocketError):
fail_hard("Unable to connect to control port %s.", port)
Expand All @@ -177,6 +178,7 @@ def _init_controller_port(port):
def _init_controller_socket(socket):
try:
c = Controller.from_socket_file(path=socket)
# todo - extract password to config
c.authenticate(password="password")
except (IncorrectSocketType, SocketError):
log.debug("Error initting controller socket: socket error.")
Expand Down Expand Up @@ -305,7 +307,6 @@ def launch_tor(conf):

torrc = parse_user_torrc_config(torrc, conf["tor"]["extra_lines"])
# Finally launch Tor
log.info(torrc)
try:
# If there is already a tor process running with the same control
# socket, this will exit here.
Expand Down
1 change: 1 addition & 0 deletions scripts/tools/get-per-relay-budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def print_regular(bws):

def main(args):
cont = get_controller(args)
# todo - extract password to config
cont.authenticate(password="password")
bws = [ns.bandwidth for ns in cont.get_network_statuses()]
if args.quiet:
Expand Down

0 comments on commit 70a2d92

Please sign in to comment.