[Tor] - Write tests to test the onion services. #578

Open
opened 2023-07-26 01:18:03 +02:00 by emdee · 4 comments

Monitoring the service's internals to determine the state of the service will not give enough info to know when something's up. There are some things that can be seen in the log but it's best to test the onion links directly. You can't assume if plain works so should onion.

A simple script that extracts the onion URLs from the /en/tor page an then wget's them through a tor proxy should work just fine, and be simple to write. You could easily run this hourly etc.

For http hosts we additionally monitor by checking http reponse code.

You can check the http return code for get of the onion URL if the proxy of the testharness is setuo correctly.

Monitoring the service's internals to determine the state of the service will not give enough info to know when something's up. There are some things that can be seen in the log but it's best to test the onion links directly. You can't assume if plain works so should onion. A simple script that extracts the onion URLs from the /en/tor page an then wget's them through a tor proxy should work just fine, and be simple to write. You could easily run this hourly etc. > For http hosts we additionally monitor by checking http reponse code. You can check the http return code for get of the onion URL if the proxy of the testharness is setuo correctly.
Author

Add a dependency to #369

Add a dependency to https://git.disroot.org/Disroot/Disroot-Project/issues/369
Author

Attached is a basic bash script to start testing.

@muppeth Running it is not a pretty sight:

sh /var/local/bin/privacy_test_disroot.bash 2>&1|grep ERROR
2023-08-01 01:41:50 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion retval=1
2023-08-01 01:41:50 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/akkoma retval=1
2023-08-01 01:41:51 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/audio retval=1
2023-08-01 01:41:51 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/calls' retval=1
2023-08-01 01:41:51 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/cryptpad retval=1
2023-08-01 01:41:52 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/email retval=1
2023-08-01 01:41:52 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/email/ retval=1
2023-08-01 01:41:53 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/git' retval=1
2023-08-01 01:41:53 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/nextcloud/ retval=1
2023-08-01 01:41:54 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/pads retval=1
2023-08-01 01:41:54 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/privatebin retval=1
2023-08-01 01:41:54 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/search retval=1
2023-08-01 01:41:55 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/upload retval=1
2023-08-01 01:41:55 ERROR 503: Forwarding failure.
ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/xmpp retval=1

Attached is a basic bash script to start testing. @muppeth Running it is not a pretty sight: sh /var/local/bin/privacy_test_disroot.bash 2>&1|grep ERROR 2023-08-01 01:41:50 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion retval=1 2023-08-01 01:41:50 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/akkoma retval=1 2023-08-01 01:41:51 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/audio retval=1 2023-08-01 01:41:51 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/calls' retval=1 2023-08-01 01:41:51 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/cryptpad retval=1 2023-08-01 01:41:52 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/email retval=1 2023-08-01 01:41:52 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/email/ retval=1 2023-08-01 01:41:53 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/git' retval=1 2023-08-01 01:41:53 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/nextcloud/ retval=1 2023-08-01 01:41:54 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/pads retval=1 2023-08-01 01:41:54 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/privatebin retval=1 2023-08-01 01:41:54 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/search retval=1 2023-08-01 01:41:55 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/upload retval=1 2023-08-01 01:41:55 ERROR 503: Forwarding failure. ERROR http://j4dhkkxfcsvzvh3p5djkmuehhgd6t6l7wmzih6b4ss744hegwkiae7ad.onion/services/xmpp retval=1
Author

@meaz I tried attaching the script as a file, but don't see it. It's simple enough...

#!/bin/bash                                                                     
# -*- mode: sh; tab-width: 8; encoding: utf-8-unix -*-                          

ROLE=privacy
TIMEO=40

wget -cO /tmp/disroot.tor https://disroot.org/en/tor || exit 2

export http_proxy=localhost:3128 # privoxy                                      
grep href= /tmp/disroot.tor | grep '\.onion'| \
    sed -e 's@.*href=.@@' -e 's/["].*//' | sort -u | \
    while read elt ; do
        timeout $TIMEO wget -O /dev/null $elt
        retval=$?
        [ $retval = 0 ] && continue
        [ $retval = 124 ] && echo ERROR $elt TIMEOUT $TIMEO && continue
        echo ERROR $elt retval=$? && continue
    done
@meaz I tried attaching the script as a file, but don't see it. It's simple enough... ``` #!/bin/bash # -*- mode: sh; tab-width: 8; encoding: utf-8-unix -*- ROLE=privacy TIMEO=40 wget -cO /tmp/disroot.tor https://disroot.org/en/tor || exit 2 export http_proxy=localhost:3128 # privoxy grep href= /tmp/disroot.tor | grep '\.onion'| \ sed -e 's@.*href=.@@' -e 's/["].*//' | sort -u | \ while read elt ; do timeout $TIMEO wget -O /dev/null $elt retval=$? [ $retval = 0 ] && continue [ $retval = 124 ] && echo ERROR $elt TIMEOUT $TIMEO && continue echo ERROR $elt retval=$? && continue done ```
Author

What do you use as tools for testing the website?

What do you use as tools for testing the website?
meaz changed title from Write tests to test the onion services. to [Tor] - Write tests to test the onion services. 2023-11-25 23:55:05 +01:00
muppeth added the
TOR
label 2024-03-03 12:02:36 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Disroot/Disroot-Project#578
No description provided.