opn-repo icon indicating copy to clipboard operation
opn-repo copied to clipboard

Speedtest package lacking executable permissions

Open zimmertr opened this issue 1 year ago • 5 comments

I installed the speedtest package today and, after setting up a cron, found that the Speedtest probes integer at Reporting -> Speedtest wasn't incrementing according to my cron schedule.

After poking around a bit I saw a log message in System -> Log Files -> Backend that indicated it was failing to run /usr/local/opnsense/scripts/OPNsense/speedtest/opn_speedtest.py. I solved this by SSHing into the server and running chmod +x /usr/local/opnsense/scripts/OPNsense/speedtest/opn_speedtest.py. My cron then worked on the next try.

However, after solving this problem I cleared my logs and tried to reproduce it by removing the permission to be sure. But I actually got temporarily IP Banned from Speedtest.net for setting too aggressive of a cron lol. So I can't share the log message with you until that falls off. But you should be able to reproduce this yourself by installing the latest version of the package from a clean state. Unless it was somehow tied to my specific installation.

PS: The UI does not indicate when you are IP banned. Which might be confusing to some users trying to test the plugin with an, initially, aggressive cron schedule. It simply fails to select a server and then returns a null error:

Screenshot 2023-09-23 at 7 57 15 PM

I figured it out by trying to run the command again manually:

root@sol:~ # speedtest
[2023-09-23 19:49:09.962] [error] Limit reached:

Speedtest CLI. Too many requests received. To maintain a fair and stable environment, please review and adjust the frequency of your requests.

It might also be beneficial to explain somewhere that a Cron must be set up to actually schedule this plugin. And that a user should specify the server ID as a command parameter. I puzzled this together from a random Reddit comment myself.

zimmertr avatar Sep 24 '23 02:09 zimmertr

Also, do you know why System -> Firmware -> Plugins reports the package as misconfigured after installation via pkg?

Screenshot 2023-09-23 at 8 06 16 PM

zimmertr avatar Sep 24 '23 03:09 zimmertr

Lack of permissions is just the packaging problem of setting the executable flag on .py file before it is packaged into .txz file; I will submit the fix to Michael, thanks for noticing it.

There is so much wrong with this plugin, including clicking HELP (top right corner) to reveal additional features. And no documentation worth reading. And no comments in the (poorly written) code so even I am lost staring at the logic, trying to remember what I wanted to achieve. Shame, shame shame! :-)

To my defense, this was my first project using Python and PHP/Phalcon on FreeBSD, and I am happy that it works at all!

I will gather some courage to give it a lick of new paint, and am happy to gather requests, suggestions and complaints so I can do all the changes in one go.

mihakralj avatar Sep 28 '23 14:09 mihakralj

I checked the speedtest cli code (well, the old Python version) - and it does not report back if the host IP is banned. I doubt that Ookla binary does it either.

mihakralj avatar Sep 28 '23 14:09 mihakralj

this issue is ready to be closed.

mihakralj avatar Oct 06 '23 19:10 mihakralj

Hey, sorry for never following up. Thank you for working on this! I don't think you should feel any shame at all. Tons of people are using this! That's awesome!

As for the response not indicating the IP is banned, couldn't you check if the response is null instead?

zimmertr avatar Oct 06 '23 19:10 zimmertr