[Mod] SQLite Ban [sban]

shivajiva
Member
 
Posts: 21
Joined: Fri Nov 27, 2015 09:41
In-game: shivajiva

[Mod] SQLite Ban [sban]

by shivajiva » Sat Oct 07, 2017 15:56

A mod based on the concepts introduced by xban2, expanding on them by using an sql database instead of a serialised table file.
This approach to ban management:

  • Improves the robustness of the data.
  • Grants an enhanced view of player accounts and ban records.
  • Provides tiered access to player record information.
  • Provides an option for automatic ban expiration.
  • Provides the capability to pre-emptively ban players.
  • Offers increased accessibility via SSH connections to the database with your
    favourite database management gui.
  • Can preserve existing bans by importing records from Minetest or xban2.

Installation requirements
This mod depends on the lua module lsqlite3 (https://github.com/LuaDist/lsqlite3) A thin wrapper for the SQLite database engine.
The preferred method is to use luarocks to install it. (https://luarocks.org/)

Download zip file
Browse code on Github

Commands

The mod provides the following chat console commands. These commands require the ban privilege. The ban_admin and server privileges extend the functionality of some commands.

ban

Bans a player permanently.

Usage: /ban <name_or_ip> <reason>

Example: /ban Steve Some reason.

The server privilege enables the pre-emptive banning of player names or IP addresses for which the server has no current record.

tempban

Bans a player temporarily.

Usage: /tempban <name_or_ip> <time> <reason>

Example: /tempban Steve 2D Some reason.

The time parameter is a string in the format <count> <unit>, where <unit> is either s for seconds, m for minutes, h for hours, D for days, W for weeks, M for months, or Y for years. If the unit is omitted, it is assumed to mean seconds. For example, 42 means 42 seconds, 1337m means 1337 minutes, and so on. You can chain more than one such group and they will add up. For example, 1Y3M3D7h will ban for 1 year, 3 months, 3 days and 7 hours.

unban

Unbans a player.

Usage: /unban <name_or_ip> <reason>

Example: /unban Steve Some reason.

Note: this command requires an unban reason.

ban_record

Displays player record and ban record.

Usage: /ban_record <name_or_ip>

Example: /ban_record Steve

This prints the player record and ban record for a player. The records are printed to the chat console with one entry per line.

The player record includes names and, if the user has the ban_admin privilege, IP addresses used by the player. The number of records displayed is limited to 10 by default to prevent chat console spam, and can be adjusted through the sban.display_max setting in minetest.conf.

The ban record includes a list of all ban related actions performed on the player under any known name or IP address. This includes the time a ban came into effect, the expiration time (if applicable), the reason, and the source of the ban.

Note: records of players with the server privilege can only be viewed by other players with the server privilege.

See the readme file for details of the admin commands and settings

Download zip file
Browse code on Github
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [MOD] SQLite Ban [sban]

by ExeterDad » Sat Oct 07, 2017 16:35

Oh I am so happy with you!
I've actually been trying to roll my own version of what you just posted! I'll be testing as soon as humanly possible. I've already been working (learning actually) with the lsqlite3 module so your module choice couldn't be more perfect for me.
 

shivajiva
Member
 
Posts: 21
Joined: Fri Nov 27, 2015 09:41
In-game: shivajiva

Re: [MOD] SQLite Ban [sban]

by shivajiva » Sat Oct 07, 2017 17:17

you should find this interesting, I've kept it clean and simple to serve as a reasonable example. You might like sauth also, I thought I'd hand roll an auth handler using lsqlite3 library, you can find it here
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [MOD] SQLite Ban [sban]

by ExeterDad » Sat Oct 07, 2017 20:12

Heh heh! This is like Christmas! Now two things off my list I wanted to tackle. It's like you've seen my TODO list or something :)
I do know one thing, your code will be a excellent learning tool for me. I was poking around the code in sban and drooling because your examples answered many questions I had while trying to figure out how to use the module in Minetest. I'll be rewriting much of what I've done (unrelated mod) as your implementation is superior to mine.

Thanks!
 

User avatar
BBmine
Member
 
Posts: 3458
Joined: Sun Jul 12, 2015 22:51
Location: USA
GitHub: BBmine
IRC: BBmine
In-game: Baggins
 

User avatar
ManElevation
Member
 
Posts: 893
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: [MOD] SQLite Ban [sban]

by ManElevation » Sun Oct 08, 2017 21:42

BBmine wrote:This has all the features any ban mod should have!

exacly! +1
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
rubenwardy
Moderator
 
Posts: 5541
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [MOD] SQLite Ban [sban]

by rubenwardy » Tue Oct 10, 2017 23:41

After a very quick bug fix by shivajiva, I can confirm that this mod is working perfectly for me. Thanks for this. Database all the things!
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 2 guests