General

Monitoring the uptime of a hidden service.

Started by AncientIdai · Jan 23, 2025

#5723
Hi everyone. In this tutorial I will be explaining how to minotor the uptime of a hidden service.

Why can this be usefull?

Keeping your service online requires dedication and hard work. Shit happens.

It's good to have something set up that gives you a notification when there are problems.

Requirements:

-The linux mon tool

-tor

-torsocks

First we will be installing the neccesary tools to do this.



sudo apt-get install tor torsocks mon



Now, let's create a new monitor that wraps mon with torsocks, so it is compatible with .onion addresses.



sudo nano /usr/lib/mon/mon.d/torsocks_http.monitor



and fill it with this:



#!/bin/bash

export DIR_PATH=`dirname ${0}`

exec /usr/bin/torsocks --isolate ${DIR_PATH}/http.monitor -t 60 "$@"



Don't forget to give this file execution rights, otherwise it won't run!

Now let's edit the main mon.cf file and add these lines in /etc/mon/mon.cf



hostgroup torproject_onion http://tforum.pro/

watch torproject_onion

service http

interval 5m

monitor torsocks_http.monitor

period

alertafter 10

alertevery 1h strict

alert /home/Desktop/TorIsDown.sh



What this will do is monitor the tforum onion and checks every 5 mins.

After 10 consecutive failures it will perform the TorIsDown script once, with a maximum of 1 time each hour.

The torisDown script can be configured to be anything, ranging from just simply restarting the service and hoping for the best, to sending you a notification on jabber or through email or even telegram.

for now the torisdown script looks like this:



#!/bin/bash

LOG_PATH='/var/log/mon/torisdown.log'

msg="$(date -u --iso-8601=seconds) INFO: tor is down :("

echo ${msg} >> ${LOG_PATH}



Now restart the service using systemctl restart mon.service

and test if everything works correctly by running the command:



time /usr/lib/mon/mon.d/torsocks_http.monitor [your onion address]

#5724
↳ Replying to @AncientIdai
/u/AncientIdai there's actually anyway to see connection at my hidden service?

Like a log program or something like that?

Of course I will just see Relays IP, but I doesn't know if there is any software for that propose.

I enjoy the article.
#5725
↳ Replying to @MxUfWD9IfexeJCyUyXF
Well to check uptime of your onion website you can use this tutorial, you will just need to adjust the torisdown script to work with your needs.
#5726
↳ Replying to @AncientIdai
in more legitimate projects i used uptime kuma, nice little script on github. Monitor ports/http/services. Never tested on tor but should work the same with the right configuration.