Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Looking for feedback on bash scripts used for geoblocking
Looking for feedback on bash scripts used for geoblocking
Hi all,
I wrote a collection of 7 scripts (3 of them I actually adopted from other sources and then modified). The idea is a simple bash implementation of an automatic geoblocker based on a whitelist that would work on my Debian server.
I am not a professional coder, so I'm looking to hear feedback on the scripts. So far they seem to do the job for me. I want them to be publicly available for other people to use as well, so I'm mainly concerned about how they will work in other environments.
Comments and testing would be appreciated.
The scripts are hosted on Github:
https://github.com/blunderful-scripts/geoblocker_bash
I wrote a collection of 7 scripts (3 of them I actually adopted from other sources and then modified). The idea is a simple bash implementation of an automatic geoblocker based on a whitelist that would work on my Debian server.
I am not a professional coder, so I'm looking to hear feedback on the scripts. So far they seem to do the job for me. I want them to be publicly available for other people to use as well, so I'm mainly concerned about how they will work in other environments.
Comments and testing would be appreciated.
The scripts are hosted on Github:
https://github.com/blunderful-scripts/geoblocker_bash
Last edited by benzine on 2023-05-27 05:44, edited 1 time in total.
Re: Looking for feedback on bash scripts used for geoblocking
P.s. currently I can't reply to private messages (because I'm new to the forum), but you are more than welcome to discuss the code here.
@bw123
@bw123
-
- Global Moderator
- Posts: 2966
- Joined: 2014-07-20 18:12
- Location: Europe
- Has thanked: 73 times
- Been thanked: 405 times
Re: Looking for feedback on bash scripts used for geoblocking
@benzine: it could be useful to check the scripts with shellcheck [1] for example:
[1] https://packages.debian.org/bullseye/shellcheck;
Code: Select all
$ su -l -c "apt install shellcheck"
$ git clone https://github.com/blunderful-scripts/geoblocker_bash
$ cd geoblocker_bash
$ shellcheck *.sh
Re: Looking for feedback on bash scripts used for geoblocking
Thanks, I'll try that.Aki wrote: ↑2023-05-27 14:51 @benzine: it could be useful to check the scripts with shellcheck [1] for example:[1] https://packages.debian.org/bullseye/shellcheck;Code: Select all
$ su -l -c "apt install shellcheck" $ git clone https://github.com/blunderful-scripts/geoblocker_bash $ cd geoblocker_bash $ shellcheck *.sh
-
- Posts: 444
- Joined: 2023-02-07 13:35
- Been thanked: 105 times
Re: Looking for feedback on bash scripts used for geoblocking
Even the sid version is almost a year and a half old.
Use the web interface instead, that's always the latest version:
https://www.shellcheck.net/
The certificate has just ran out but I'm sure they'll fix that soon.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.
Re: Looking for feedback on bash scripts used for geoblocking
Thanks, good suggestion. The shellcheck's website pointed me to codefactor.io which allows to automatically check the whole repo with shellcheck. Actually found and fixed a few minor bugs with its help.Random_Troll wrote: ↑2023-05-28 09:07Even the sid version is almost a year and a half old.
Use the web interface instead, that's always the latest version:
https://www.shellcheck.net/
The certificate has just ran out but I'm sure they'll fix that soon.
Re: Looking for feedback on bash scripts used for geoblocking
Actually putting the code directly into shellcheck website interface revealed some more bugs (mostly stylistic but a couple real bugs as well) which codefactor.io didn't mention.
-
- Global Moderator
- Posts: 2966
- Joined: 2014-07-20 18:12
- Location: Europe
- Has thanked: 73 times
- Been thanked: 405 times
Re: Looking for feedback on bash scripts used for geoblocking
@Random_Troll: the current testing and sid versions of shellcheck are the same 0.9.0-1 [1]. The git repository [2] cited in https://www.shellcheck.net/ refers to version 0.9.0 . Is there a more freshly updated version of shellcheck ?
@benzine: what is the Debian version you are running ?
---
[1] https://tracker.debian.org/pkg/shellcheck
[2] https://github.com/koalaman/shellcheck
-
- Posts: 444
- Joined: 2023-02-07 13:35
- Been thanked: 105 times
Re: Looking for feedback on bash scripts used for geoblocking
I think the website uses the latest commits from the GitHub repository rather than the release version.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.
-
- Global Moderator
- Posts: 2966
- Joined: 2014-07-20 18:12
- Location: Europe
- Has thanked: 73 times
- Been thanked: 405 times
Re: Looking for feedback on bash scripts used for geoblocking
@benzine: Debian repository hosts different version of distributed packages according to the Debian Release (for example, see https://tracker.debian.org/pkg/shellcheck). I was looking for the shellcheck version distributed with your Debian installed release that is probably much older the current Debian Testing (next Debian Stable on june 10th) release. That's probably why the on line version of shellcheck suggested more corrections or warnings.