Opened 6 years ago

Closed 4 years ago

#10734 closed enhancement (fixed)

Include a cron in the ooni deb, to run certain tests daily?

Reported by: arma Owned by: hellais
Priority: Medium Milestone:
Component: Archived/Ooni Version:
Severity: Keywords:
Cc: lunar Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

My hope is to start with one very conservative, robust, and reasonably harmless test, and have it run by default on as many ooni deb installations as possible. As discussed with Arturo, the http header manipulation test seems like a good candidate.

But once we have that test in mind, how can we get it to run automatically? One idea is for the ooniprobe deb to install a cron entry. To not surprise users too much, should we have the ooniprobe deb install ask the user if they want to set it up to run the conservative tests nightly? (For a noninteractive install, the answer can be an auto no, on the principle of least surprise.)

weasel says

the crontab entry should probably be something like
@daily ooni [ -x /usr/bin/ooni-report ] && /usr/bin/ooni-report

and then he adds

and ooni-report reads /etc/default/ooni to find out what it should
and shouldn't do.
that file probably should be quite simple.  maybe just a shell script
snippet setting REPORT to none|stable|all .
getting the debconf scripting right is a bit of a pain, and complex
formats or data structures increase the pain manyfold.

Child Tickets

Change History (6)

comment:1 Changed 6 years ago by arma

Component: OnionooOoni
Owner: set to hellais

comment:2 Changed 6 years ago by hellais

Status: newassigned

comment:3 Changed 6 years ago by hellais

arma noted that having a ooniprobe run as a cronjob requires it to identify what is the current status of it's network connection. This means that it must understand if wether or not it is connected to the internet.

We want this to be something that is not very easy to fingerprint so I propose we make it attempt to resolve a random hostname and if it receives any type of response (let that be a NXDOMAIN or an A record) then we consider the network to be working properly. If name resolution fails because of a connection timeout, then we consider the network to not be working.

comment:4 Changed 6 years ago by hellais

A pull request implementing this feature is here: https://github.com/TheTorProject/ooni-probe/pull/276. I ended up for the time being doing the most simple thing which is schedule the running of ooniprobe with a test deck called "stable.deck" daily.
This has two main issues:

1) If the user does not have anacron installed (the default in ubuntu) and ooniprobe it misses the scheduled time to run it will not run for that day.

2) If the network is down it will not reschedule to run the test later that day.

To overcome these issues I think the best solution would be to have ooniprobe be a daemon and have an internal scheduling system for routinely running a series of specified tests.
This would be a major feature though, so for the time being we are going to be satisfied with the current solution.

I will open a separate ticket to discuss adding cron like scheduling support to ooniprobe as a daemon.

comment:5 Changed 5 years ago by hellais

From #raspbian on irc.freenode.net:

20:49 -!- vagrantc [~vagrant@freegeek/vagrantc] has joined #raspbian
20:49 -!- mode/#raspbian [+o vagrantc] by ChanServ
20:49 < diederik_> you got the most important part ... getting it into debian
20:50 < diederik_> then to also get it into raspbian, is pinging the 'ftp-master' of it, which is plugwash
20:50 < hellais> diederik_: I would also like it to have some additional behavior in the post.install script that is specific to raspberries
20:50 < hellais> so that when you install it there it sets up a particular type of cronjob, as an example
20:51 < diederik_> there is a specific section in the raspbian archive which (I think) could enable that. But you really have to ask plugwash about it
20:51 < hellais> got it
20:51 < hellais> diederik_: do you know when I am most likely to find this girl/guy?
20:51 <@vagrantc> seems like that would be better done in a supplimentary package?
20:52 <@vagrantc> the raspbian-specific cron jobs
20:52 < hellais> vagrantc: that would be painful to push into debian since our current maintainer is on a leave
20:52 < diederik_> he often comes online during EU evenings/night
20:52 < hellais> in general if it's to add to the existing package it's ok
20:52 < hellais> but add new ones is currently a bit complex
20:53 < hellais> unless we can add it to raspbian without adding it to debian
20:53 < hellais> that is an option
20:53  * vagrantc would find cron jobs only enabled on raspbian installs to be particularly annoying
20:53 <@vagrantc> YMMV
20:53 < hellais> vagrantc: the cronjob is enabled by means of a prompt in the post.install script
20:53 < hellais> and will be part of debian also
20:53 < hellais> the thing is that I want a different cronjob in raspbian than I do in debian
20:54 <@vagrantc> prompts sound even uglier
20:54 <@vagrantc> depending on how implemented, debian policy violations
20:54 < hellais> vagrantc: your feedback on this ticket would be greatly appreciated: https://trac.torproject.org/projects/tor/ticket/10734
20:55 < hellais> vagrantc: this is how it's done: https://github.com/TheTorProject/ooni-probe/commit/8983d370461b29f84d614f761fcad0cf7bb374b1
20:55 < hellais> vagrantc: pull requests are also very welcome: https://github.com/TheTorProject/ooni-probe/pulls :)
20:58 <@vagrantc> hellais: i'd recommend dropping a file in /etc/cron.d/ as part of the package, and having a configuration option to disable it doing anything

21:00 <@vagrantc> hellais: if you want to cut-and-paste from irc, that would be easier for me :)
21:01 <@vagrantc> packages shouldn't really use the "crontab" command
21:02 < hellais> https://trac.torproject.org/projects/tor/ticket/10734
21:02 < hellais> done
21:02 <@vagrantc> packages should use /etc/cron.* directories
21:03 < hellais> vagrantc: that is a good suggestions, thanks!
21:04 <@vagrantc> hellais: then the cron job, or file it runs should source the configuration file ... and the admin and/or postinst can manage the configuration file
Last edited 5 years ago by hellais (previous) (diff)

comment:6 Changed 4 years ago by hellais

Resolution: fixed
Status: assignedclosed

ooniprobe 1.3.1 is now inside of debian stretch

Note: See TracTickets for help on using tickets.