[Mod] Extended Ban v2 [xban2]

Post Reply
User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

[Mod] Extended Ban v2 [xban2]

by kaeza » Post

Extended Ban Mod for Minetest

This mod attempts to be an improvement to Minetest's ban system.
  • It supports normal bans and temporary bans (from 60 seconds up to the end of time, with 1 second granularity).
  • Records and joins all accounts using the same IP address and several IP addresses using the same name into a single record, and can ban/unban them as a single user.
  • Can ban offline players if you know their IP or username.
  • Holds a record of bans for each user, so moderators and administrators can consult it to know if a player is a repeat offender.
  • Does not modify the default ban database in any way (`ipban.txt').
  • Has an API to ban and check the ban database to allows other mods to manage users (for example, anticheat mods).
Usage
Install the mod as always and rename to `xban2'.

The mod provides the following chat commands:

Code: Select all

/xban <player_or_ip> <reason>
Ban a player permanently.

Code: Select all

/xtempban <player_or_ip> <time> <reason>
Ban a player temporarily. The syntax for `<time>' is:
  • 1s - Ban for one second.
  • 1m - Ban for one minute.
  • 1h - Ban for one hour.
  • 1D - Ban for one day (24 hours).
  • 1W - Ban for one week (7 days).
  • 1M - Ban for one month (30 days).
  • 1Y - Ban for one year (360 days).
Values can be combined. For example "1D3h3m7s" will ban for 1 day, 3 hours, 3 minutes, and 7 seconds.
Note that the units are just for convenience. You are not required to provide values within the bounds. It is possible to specify "3600s", which is the same as "60m" or "1h". Also note that the 's' is optional. Specifying just "42" is the same as "42s".

Code: Select all

/xunban <player_or_ip>
Unban a player.

Advanced Use

Code: Select all

/xban_record <player_or_ip>
See a player's ban record.

Code: Select all

/xban_dbi <importer>
Import a database. Valid values for `<importer>' are:
  • "minetest" - Import ban list from `ipban.txt' (Minetest ban database).
  • "v1" - Import ban list from `players.iplist' (xban v1 database).
All commands except for `/xban_dbi' require `ban' privilege to execute. The `/xban_dbi' command requires `server' privilege.

License: BSD 2 Clause License.
Dependencies: None.

Links
Download .zip
Download .tar.gz
Browse code on Github
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
LazyJ
Member
Posts: 687
Joined: Wed Sep 12, 2012 12:29
Location: Podunk, Nowhere, USA

Re: [Mod] Extended Ban v2 [xban2]

by LazyJ » Post

Is this compatible with the previous version of "xban's" files, kaeza?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

LazyJ wrote:Is this compatible with the previous version of "xban's" files, kaeza?
Not currently. I'm working on providing converters from MT's ipban.txt, old xban v1 `players.iplist', and newer `players.iplist.v2' formats, along with more utilities.

BTW, for those who used my old xban mod, the advantages of this one are:
  • Has a saner DB format (using a minetest.(de)serialize-compatible format.
  • Fixes an old bug where some users were not actually getting banned under some circumstances.
  • As said above, ban record :)
  • It's title says v2! so it must be better than v1! the internet said it, so it must be true!
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by Krock » Post

*shuts down server*
*installs*
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

*BUMP*

LazyJ: Added command to import old v1 DB and Minetest `ipban.txt'.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

Update:
  • Added `/xban_record' command to list players' ban records.
  • The mod now saves the last position of the banned player (if they are online). The `/xban_record' command also shows the last known position of the player, if available.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
LazyJ
Member
Posts: 687
Joined: Wed Sep 12, 2012 12:29
Location: Podunk, Nowhere, USA

Re: [Mod] Extended Ban v2 [xban2]

by LazyJ » Post

kaeza, is xban2 capable of importing players.iplist.v2 ?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

Update:
  • Fixed an ugly bug that could cause unwanted bans on servers. It is recommended to delete the database and start anew, or run this script in the standalone Lua interpreter (get it from your favorite package manager, or from here) to purge duplicate entries. Thanks to Zeno` for testing :)
  • Added importer for old v2 database format. Thanks to LazyJ for helping with testing :)
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
stormchaser3000
Member
Posts: 422
Joined: Sun Oct 06, 2013 21:02
GitHub: stormchaser3000

Re: [Mod] Extended Ban v2 [xban2]

by stormchaser3000 » Post

ok um here is a bug: when i xtempban someone they get permanetly banned until i execute xunban. and yes i did use xtempban

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

Update:
  • Fixed temporary bans not working at all (the function responsible for removing expired bans was not being run).
  • The `/xban_record` command now lists the ban "source". The "source" is the player or mod that performed the ban (the source was always stored in the database, but the report did not include it).
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
Lejo
Member
Posts: 718
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: [Mod] Extended Ban v2 [xban2]

by Lejo » Post

Is it possible to see the ips of the players?
Can I ban player per mac-Address?

This mod is soooooo nice!

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

The players' IP(s) are recorded in the database, but are not currently visible anywhere (except when banning).

Banning by MAC address is not possible as we don't have access to that info.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

Lichtbringer
New member
Posts: 1
Joined: Fri Feb 24, 2017 21:36
In-game: Lichtbringer

Re: [Mod] Extended Ban v2 [xban2]

by Lichtbringer » Post

But if trollip/trollname is banned and he tries to login as trollip/myname, wouldn't that ban me too?
(because myname gets linked to trollip's account)

If someone lives in a living group or orphanage, banning one would ban all.
It is also a very certain ban on all shared ips like school-ips, internet-coffee-shops, …

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

That's a known issue, and I don't feel it's worth it to resolve it. Will accept suitable patches of course.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

redblade7
Member
Posts: 316
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Extended Ban v2 [xban2]

by redblade7 » Post

Is it safe to manually remove all (or all but one) IPs out of the xban.db file (from the "names" section with the usernames)?
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Extended Ban v2 [xban2]

by kaeza » Post

Yes it is. The database has no circular references or anything hidden, so simply removing a name or IP from an entry disassociates it from the "user".
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

redblade7
Member
Posts: 316
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Extended Ban v2 [xban2]

by redblade7 » Post

kaeza wrote:Yes it is. The database has no circular references or anything hidden, so simply removing a name or IP from an entry disassociates it from the "user".
Right after posting that message two weeks ago, I decided to try anyway, and the server (Creative Gardens) has worked fine with no problems. Thank you!
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

redblade7
Member
Posts: 316
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Extended Ban v2 [xban2]

by redblade7 » Post

Could you please add the ability to ban IP ranges? Currently the only way to do this is iptables which can cause massive server lag if the range is too large.
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

User avatar
scottwolff
Member
Posts: 129
Joined: Sat Apr 30, 2016 06:15
In-game: scottwolff or some variant of iasiney
Location: Central Illinois

Re: [Mod] Extended Ban v2 [xban2]

by scottwolff » Post

I banned a hacker for one year with this. My moderator asked why not forever, so I banned for 99 years.

redblade7
Member
Posts: 316
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Extended Ban v2 [xban2]

by redblade7 » Post

redblade7 wrote:Could you please add the ability to ban IP ranges? Currently the only way to do this is iptables which can cause massive server lag if the range is too large.
Actually the "massive server lag" was another issue I dealt with some time ago, see other posts. Still it would be nice to have IP range bans.

Question: Is this compatible with IPv6? My ISP doesn't have IPv6 support, so I never enabled it on my servers as accessing it via IPv6 would only be possible through Microsoft's built-in gateway on my Win10 computer. IPv6 would be more effective at banning people, for those whose ISPs or mobile devices support it.
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [Mod] Extended Ban v2 [xban2]

by Lone_Wolf » Post

redblade7 wrote:
redblade7 wrote:Could you please add the ability to ban IP ranges? Currently the only way to do this is iptables which can cause massive server lag if the range is too large.
Actually the "massive server lag" was another issue I dealt with some time ago, see other posts. Still it would be nice to have IP range bans.

Question: Is this compatible with IPv6? My ISP doesn't have IPv6 support, so I never enabled it on my servers as accessing it via IPv6 would only be possible through Microsoft's built-in gateway on my Win10 computer. IPv6 would be more effective at banning people, for those whose ISPs or mobile devices support it.
I'm pretty sure this does support IPv6
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

Ruslan1
Member
Posts: 70
Joined: Wed Dec 21, 2016 04:13
GitHub: ruslan1-dev
IRC: Ruslan1
In-game: Ruslan1

Re: [Mod] Extended Ban v2 [xban2]

by Ruslan1 » Post

can you add /ban_list
cdb_9fcc437a79b1

User avatar
Lejo
Member
Posts: 718
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: [Mod] Extended Ban v2 [xban2]

by Lejo » Post

There is already /xban_gui

redblade7
Member
Posts: 316
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Extended Ban v2 [xban2]

by redblade7 » Post

-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests