auth_rx mod - update with compatibility fixeds the auth handler

master
mckaygerhard 2023-06-09 01:47:35 -04:00
parent 2f9a385fc5
commit 7dc1729922
9 changed files with 1223 additions and 158 deletions

66
mods/auth_rx/LICENSE Normal file
View File

@ -0,0 +1,66 @@
The MIT License (MIT)
Copyright (c) 2016-2018, Leslie Krause (leslie@searstower.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
License of modified or added source code
----------------------------------------
Copyright (C) 2020-2023 mckaygerhard <mckaygerhard@gmail.com>,
The auto initializer code and improvements were adde under CC BY-SA NC 4.0
CC-BY-SA-NC 4.0
===============
Attribution-ShareAlike 4.0 Unported (CC BY-SA 4.0)
http://creativecommons.org/licenses/by-sa/4.0/
You are free to:
* Share — copy and redistribute the material in any medium or format
* Adapt — remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow
the license terms.
Under the following terms:
* Attribution — You must give appropriate credit, provide a link to
the license, and indicate if changes were made. You may do so in any
reasonable manner, but not in any way that suggests the licensor
endorses you or your use.
* NonCommercial — You may not use the material for commercial purposes.
* ShareAlike — If you remix, transform, or build upon the material,
you must distribute your contributions under the same license as the
original.
* No additional restrictions — You may not apply legal terms or technological
measures that legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in
the public domain or where your use is permitted by an applicable exception
or limitation.
No warranties are given. The license may not give you all of the permissions
necessary for your intended use. For example, other rights such as publicity,
privacy, or moral rights may limit how you use the material.

200
mods/auth_rx/README.md Normal file
View File

@ -0,0 +1,200 @@
minetest mod Auth Redux
=======================
AUTH drop-in faster replacement for authentication handler in minetest.
Information
-----------
Auth Redux is a drop-in replacement for the builtin authentication handler
of Minetest. It is designed from the ground up to be robust and secure enough
for use on high-traffic Minetest servers, while also addressing a number of
outstanding engine bugs
Its **the most faster equilibrated authentication handler in minetest.** (its like
if you were using Redist or LevelDB but with very high stability).
![](screenshot.png)
## Technical information
------------------------
Auth Redux provides an efficient and scalable back-end solution for player
authentication, making it suitable for even the most demanding server
environments. It has been put to the test with a database of over 520,000 registered
users -- with no in-game overhead!
Recommended Enhancement: The DataMiner Mod extends the capabilities of Auth Redux,
providing comprehensive player and server statistics within a graphical user-interface,
in addition to an API for custom-tailored log analysis and reporting directly
from the command line.
- [Technical information](#technical-information)
- [Feature matrix metrics](#feature-matrix-metrics)
- [Full lua based code](#full-lua-based-code)
- [increased security and bug free](#increased-security-and-bug-free)
- [Dependencies](#dependencies)
- [Documentation](#documentation)
- [Technical features](#technical-features)
- [Integrated ruleset debugger](#integrated-ruleset-debugger)
- [benchmarks](#benchmarks)
- [Changelog](#changelog)
- [Copyright and LICENSE](#copyright-and-license)
#### Feature matrix metrics
Auth Redux is the most equilibrated faster authentication handler:
| Player Auth handler | re-joins | new join | set privilegies | database size | stability |
| ------------------- | ------------ | ----------- | ------------ | ----------- | ------------ |
| 5.0+ Builtin | 4.5 x Faster | 4 x Faster | 4.2 x Faster | 17% smaller | 100 x stable |
| 0.4.X Builtin | 592 x Faster | 3 x Faster | 633 x Faster | 32% smaller | 1000 x stable |
| sauth mod (sqlite) | 40 x Faster | 33x Faster | 48 x Faster | 32% smaller | 4 x stable |
| SQLite Builtin | 30 x Faster | 23x Faster | 40 x Faster | 30% smaller | 4 x stable |
| Redist Builtin | 8 x slower | 2 x slower | 1 x slower | unknow | 10 x stable |
| PostgreSQL Builtin | 35 x Faster | 33x Faster | 40 x Faster | 30% smaller | 4 x stable |
#### Full lua based code
Auth Redux is completely Lua-driven, with no external dependencies. It
interfaces seamlessly with Minetest's authentication handler API, therefore
no complicated setup or configuration is required. It is intended to be
compatible with all versions of Minetest 0.4.14+, providing server administrators
with both flexible and fine-grained access control.
#### increased security and bug free
It addressing following long time bugs without complicated dependencies:
* #5334 https://github.com/minetest/minetest/issues/5334
* #6783 https://github.com/minetest/minetest/issues/6783
* #4451 https://github.com/minetest/minetest/issues/4451
#### Dependencies:
* default
* formspecs (ActiveFormspecs Mod)
#### Documentation
Original documentation is on https://github.com/sorcerykid/auth_rx/wiki/Introduction
#### Technical features
* High-Performance Journaling System
To protect the master database against corruption and data loss, all
transactions are serially recorded within a journal, thereby reducing the
frequency and intensity of disk writes. In the event of a server crash or
power outage, any pending transactions are committed to the master database.
* Stateful Rule-Based Login Filtering
MARS is an easy-to-learn scripting language that affords a first line of
defense against unwanted visitors. Both restrictive and permissive security
models can be enforced via rulesets, allowing every login request to be
filtered according to conditional action-chains with custom error messages.
* Expanded Master Database Schema
The master database supports additional metadata to aid in reviewing and monitoring
login activity, including the timestamp of the first login, the total time
spent playing, the total number of player sessions, etc. This information
can prove invaluable for command-line reporting and analysis tools.
#### Integrated ruleset debugger
By entering the `/fdebug` command into chat (requires the "server privilege"),
you will be presented with a debugging console. The workspace consists of the
following elements:
![](screenshot-debugger.png)
* A. The "Show Client Output" option toggles whether to display the client output
panel. The "Show Debug Prompt" option toggles whether to insert debug status prompts
into the source code.
* B. This textarea contains the ruleset definition to be examined. Although Minetest
supports editing of text, it is strongly recommended to copy and paste your source
code into a full-fledged text editor.
* C. The client output panel renders error messages as they would appear within the
client. The status panel typically indicates whether the ruleset passed or failed,
as well as other debugging conditions.
* D. The "Save" button will export the current ruleset definition, overwriting
"greenlist.mt" in your world directory. The "Load" button will import an existing
ruleset definition from "greenlist.mt" for debugging.
* E. The "Process" button will process the ruleset definition according to the
selected login filtering criteria: Normal, New Account, or Wrong Password (thereby
changing the relevant preset variables).
* F. The preset variables are listed here with their corresponding values. These
values will never change except during the login filtering process, or unless
explicitly set in the panel below.
* G. The name and type of the selected variable is indicated here. The value can be
edited in the text field, and set with the "Set" button. The arrow buttons allow for
re-ordering any variable within the list.
Some variables, like $clock and $uptime, have an "Auto Update" option to toggle whether
the values should be derived from the system state. For a fully sandboxed environment,
you can disable this option.
The special `$__debug` variable gives you direct access to the MARS expression
interpreter. You can enter any valid expression, and the resulting value and type
will be displayed in the panel above (all variable types, except patterns, are
supported). This is particularly helpful for monitoring the values of certain
variables. To calculate the size of the $ip_names_list, for example, you would enter
```
size($ip_names_list)
```
Whenever a ruleset passes or fails, or if a syntax error is encountered, a debug
status prompt will be inserted into the source code below the line in question:
```
if $name->len() eq "administrator"`
# ====== ^ Line 12: Mismatched operands in ruleset^ ======
```
These breakpoints will be removed automatically when the ruleset definition is saved,
so there is no need to edit them out.
#### benchmarks
You can check the file [benchmark.txt](benchmark.txt) from where the
comparisons were made.
As these benchmarks reveal, there is no discernible benefit to using an SQLite3
backend for authentication over a flat-file database, whether in terms of
reliability or performance.
The cons of using LEvelDB or REdist is the unstability of those fast storage
authentication handlers, so auth_RX solves the problem and being more faster.
If anything, SQLite3/File/LevelDB databases are a hindrance when it comes to
random access of large volumes of data, and more than likely the culprit for
why some high-traffic servers lately are experiencing notable lag spikes
## Changelog
Please see [changelog](changelog) file
## Copyright and LICENSE
Copyright (c) 2016-2018, Leslie Krause (leslie@searstower.org)
Copyright (c) 2020-2023, PICCORO Lenz McKAY (mckaygerhard@gmail.com)
**License of modified or added source code**
The auto initializer code and improvements were adde under CC BY-SA NC 4.0
by mckaygerhard or "PICCORO" Lenz McKAY (mckaygerhard@gmail.com)
**License of original source files until 2018**
Auth Redux Mod v2.13 By Leslie Krause under The MIT License (MIT)
https://forum.minetest.net/viewtopic.php?f=9&t=20393
Browse orignal source code: https://bitbucket.org/sorcerykid/auth_rx
Check the [LICENSE](LICENSE) file.

View File

@ -1,159 +1,200 @@
Auth Redux Mod v2.13
By Leslie Krause
minetest mod Auth Redux
=======================
Auth Redux is a drop-in replacement for the builtin authentication handler of Minetest.
It is designed from the ground up to be robust and secure enough for use on high-traffic
Minetest servers, while also addressing a number of outstanding bugs (including #5334
and #6783 and #4451) in the Minetest 0.4.x engine.
AUTH drop-in faster replacement for authentication handler in minetest.
Auth Redux is intended to be compatible with all versions of Minetest 0.4.14+.
Information
-----------
Auth Redux is a drop-in replacement for the builtin authentication handler
of Minetest. It is designed from the ground up to be robust and secure enough
for use on high-traffic Minetest servers, while also addressing a number of
outstanding engine bugs
Its **the most faster equilibrated authentication handler in minetest.** (its like
if you were using Redist or LevelDB but with very high stability).
![](screenshot.png)
## Technical information
------------------------
Auth Redux provides an efficient and scalable back-end solution for player
authentication, making it suitable for even the most demanding server
environments. It has been put to the test with a database of over 520,000 registered
users -- with no in-game overhead!
Recommended Enhancement: The DataMiner Mod extends the capabilities of Auth Redux,
providing comprehensive player and server statistics within a graphical user-interface,
in addition to an API for custom-tailored log analysis and reporting directly
from the command line.
- [Technical information](#technical-information)
- [Feature matrix metrics](#feature-matrix-metrics)
- [Full lua based code](#full-lua-based-code)
- [increased security and bug free](#increased-security-and-bug-free)
- [Dependencies](#dependencies)
- [Documentation](#documentation)
- [Technical features](#technical-features)
- [Integrated ruleset debugger](#integrated-ruleset-debugger)
- [benchmarks](#benchmarks)
- [Changelog](#changelog)
- [Copyright and LICENSE](#copyright-and-license)
#### Feature matrix metrics
Auth Redux is the most equilibrated faster authentication handler:
| Player Auth handler | re-joins | new join | set privilegies | database size | stability |
| ------------------- | ------------ | ----------- | ------------ | ----------- | ------------ |
| 5.0+ Builtin | 4.5 x Faster | 4 x Faster | 4.2 x Faster | 17% smaller | 100 x stable |
| 0.4.X Builtin | 592 x Faster | 3 x Faster | 633 x Faster | 32% smaller | 1000 x stable |
| sauth mod (sqlite) | 40 x Faster | 33x Faster | 48 x Faster | 32% smaller | 4 x stable |
| SQLite Builtin | 30 x Faster | 23x Faster | 40 x Faster | 30% smaller | 4 x stable |
| Redist Builtin | 8 x slower | 2 x slower | 1 x slower | unknow | 10 x stable |
| PostgreSQL Builtin | 35 x Faster | 33x Faster | 40 x Faster | 30% smaller | 4 x stable |
#### Full lua based code
Auth Redux is completely Lua-driven, with no external dependencies. It
interfaces seamlessly with Minetest's authentication handler API, therefore
no complicated setup or configuration is required. It is intended to be
compatible with all versions of Minetest 0.4.14+, providing server administrators
with both flexible and fine-grained access control.
#### increased security and bug free
It addressing following long time bugs without complicated dependencies:
* #5334 https://github.com/minetest/minetest/issues/5334
* #6783 https://github.com/minetest/minetest/issues/6783
* #4451 https://github.com/minetest/minetest/issues/4451
#### Dependencies:
* default
* formspecs (ActiveFormspecs Mod)
#### Documentation
Original documentation is on https://github.com/sorcerykid/auth_rx/wiki/Introduction
#### Technical features
* High-Performance Journaling System
To protect the master database against corruption and data loss, all
transactions are serially recorded within a journal, thereby reducing the
frequency and intensity of disk writes. In the event of a server crash or
power outage, any pending transactions are committed to the master database.
* Stateful Rule-Based Login Filtering
MARS is an easy-to-learn scripting language that affords a first line of
defense against unwanted visitors. Both restrictive and permissive security
models can be enforced via rulesets, allowing every login request to be
filtered according to conditional action-chains with custom error messages.
* Expanded Master Database Schema
The master database supports additional metadata to aid in reviewing and monitoring
login activity, including the timestamp of the first login, the total time
spent playing, the total number of player sessions, etc. This information
can prove invaluable for command-line reporting and analysis tools.
#### Integrated ruleset debugger
By entering the `/fdebug` command into chat (requires the "server privilege"),
you will be presented with a debugging console. The workspace consists of the
following elements:
![](screenshot-debugger.png)
* A. The "Show Client Output" option toggles whether to display the client output
panel. The "Show Debug Prompt" option toggles whether to insert debug status prompts
into the source code.
* B. This textarea contains the ruleset definition to be examined. Although Minetest
supports editing of text, it is strongly recommended to copy and paste your source
code into a full-fledged text editor.
* C. The client output panel renders error messages as they would appear within the
client. The status panel typically indicates whether the ruleset passed or failed,
as well as other debugging conditions.
* D. The "Save" button will export the current ruleset definition, overwriting
"greenlist.mt" in your world directory. The "Load" button will import an existing
ruleset definition from "greenlist.mt" for debugging.
* E. The "Process" button will process the ruleset definition according to the
selected login filtering criteria: Normal, New Account, or Wrong Password (thereby
changing the relevant preset variables).
* F. The preset variables are listed here with their corresponding values. These
values will never change except during the login filtering process, or unless
explicitly set in the panel below.
* G. The name and type of the selected variable is indicated here. The value can be
edited in the text field, and set with the "Set" button. The arrow buttons allow for
re-ordering any variable within the list.
Some variables, like $clock and $uptime, have an "Auto Update" option to toggle whether
the values should be derived from the system state. For a fully sandboxed environment,
you can disable this option.
The special `$__debug` variable gives you direct access to the MARS expression
interpreter. You can enter any valid expression, and the resulting value and type
will be displayed in the panel above (all variable types, except patterns, are
supported). This is particularly helpful for monitoring the values of certain
variables. To calculate the size of the $ip_names_list, for example, you would enter
```
size($ip_names_list)
```
Whenever a ruleset passes or fails, or if a syntax error is encountered, a debug
status prompt will be inserted into the source code below the line in question:
```
if $name->len() eq "administrator"`
# ====== ^ Line 12: Mismatched operands in ruleset^ ======
```
These breakpoints will be removed automatically when the ruleset definition is saved,
so there is no need to edit them out.
#### benchmarks
You can check the file [benchmark.txt](benchmark.txt) from where the
comparisons were made.
As these benchmarks reveal, there is no discernible benefit to using an SQLite3
backend for authentication over a flat-file database, whether in terms of
reliability or performance.
The cons of using LEvelDB or REdist is the unstability of those fast storage
authentication handlers, so auth_RX solves the problem and being more faster.
If anything, SQLite3/File/LevelDB databases are a hindrance when it comes to
random access of large volumes of data, and more than likely the culprit for
why some high-traffic servers lately are experiencing notable lag spikes
## Changelog
Please see [changelog](changelog) file
## Copyright and LICENSE
Copyright (c) 2016-2018, Leslie Krause (leslie@searstower.org)
Copyright (c) 2020-2023, PICCORO Lenz McKAY (mckaygerhard@gmail.com)
**License of modified or added source code**
The auto initializer code and improvements were adde under CC BY-SA NC 4.0
by mckaygerhard or "PICCORO" Lenz McKAY (mckaygerhard@gmail.com)
**License of original source files until 2018**
Auth Redux Mod v2.13 By Leslie Krause under The MIT License (MIT)
https://forum.minetest.net/viewtopic.php?f=9&t=20393
Repository
----------------------
Browse orignal source code: https://bitbucket.org/sorcerykid/auth_rx
Browse source code:
https://bitbucket.org/sorcerykid/auth_rx
Check the [LICENSE](LICENSE) file.
Download archive:
https://bitbucket.org/sorcerykid/auth_rx/get/master.zip
https://bitbucket.org/sorcerykid/auth_rx/get/master.tar.gz
Revision History
----------------------
Version 2.1b (30-Jun-2018)
- initial beta version
- included code samples for basic login filtering
- included a command-line database import script
Version 2.2b (04-Jul-2018)
- added install option to database import script
- improved exception handling by AuthFilter class
- fixed parsing of number literals in rulesets
- fixed type-checking of try statements in rulesets
- included mod.conf and description.txt files
Version 2.3b (08-Jul-2018)
- general code cleanup of AuthFilter class
- moved datasets into separate directory of world
- added two more comparison operators for rulesets
- tweaked pattern matching behavior in rulesets
- changed database search method to use Lua regexes
- removed hard-coded file names from database methods
Version 2.4b (13-Jul-2018)
- moved Journal and AuthDatabase classes into library
- added rollback function to AuthDatabase class
- reworked journal audit to support rollback option
- better encapsulated database commit function
- allowed for STOPPED opcode during database update
- various changes to error and action messages
- moved command-line scripts to separate directory
- included script to rollback database via journal
- included script to extract debug log into journal
Version 2.5b (17-Jul-2018)
- implemented function parsing algorithm for rulesets
- simplified operand matching logic in rulesets
- improved transcoding of literals in rulesets
- added some basic functions for use by rulesets
- fixed validation of dataset names in rulesets
Version 2.6b (19-Jul-2018)
- introduced support for array literals in rulesets
- added array-related functions for use by rulesets
- localized references to transcoding functions
- registered chat command to control login filtering
- included support for disabling login filtering
- added reload function to AuthFilter class
- tweaked lexer to skip comments on ruleset loading
- added search function to AuthDatabase class
Version 2.7b (22-Jul-2018)
- implemented time and date datatypes for rulesets
- updated code samples with latest feature-set
- added time-related functions for use by rulesets
- added time-related variables for use by rulesets
- minor formatting fixes to source code
- optimized comparison algorithm in ruleset parser
Version 2.8b (24-Jul-2018)
- introduced support for numeric patterns in rulesets
- created polymorphic pattern-matching classes
- excluded time-zone offsets in time/date comparisons
- standardized timestamps for use in filter functions
- removed daylight saving time from preset variables
- updated comparison algorithm in ruleset parser
- passed preset variables array to filter functions
Version 2.9b (26-Jul-2018)
- implemented address datatype for rulesets
- added more helper functions for use by rulesets
- fixed missing syntax checks in ruleset parser
- developed and integrated AuthWatchdog class
- added meta-variables for stateful login filtering
Version 2.10b (29-Jul-2018)
- major code reorganization via multiple libraries
- removed extra variables from AuthFilter class
- developed interactive debugger for testing rulesets
- added optional debugger hooks in AuthFilter class
- allowed for overriding preset variables by debugger
- included line-number in results of login filter
- added missing preset variable needed by rulesets
Version 2.11 (04-Aug-2018)
- developed a command-line player analytics script
Version 2.12 (10-Aug-2018)
- better code consolidation of AuthFilter class
- reworked ruleset parser to support syntax changes
Version 2.13 (20-Aug-2018)
- developed in-game database management console
- combined generic filter functions into superclass
- updated debugger to use new GenericFilter class
- added flag for constant-value operands in rulesets
- simplified operand matching logic in rulesets
- optimized comparison algorithm in ruleset parser
- consolidated lookup tables of lexical analyzer
- fixed erroneous status message shown in debugger
- added support for per-player debugging sessions
- redesigned login filter APIs for new architecture
- switched order of return values in login filter
- various code refactoring and better comments
Installation
----------------------
1) Unzip the archive into the mods directory of your game
2) Rename the auth_rx-master directory to "auth_rx"
3) Execute the "convert.awk" script (refer to instructions)
Source Code License
----------------------
The MIT License (MIT)
Copyright (c) 2016-2018, Leslie Krause (leslie@searstower.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT

623
mods/auth_rx/benchmark.txt Normal file
View File

@ -0,0 +1,623 @@
***************************************************
* *
* BENCHMARK RESULTS :: sauth Mod *
* *
***************************************************
-----------------
-- Player Join --
-----------------
Trial #1
on_prejoinplayer: 191.557 ms
get_auth: 182.467 ms
get_auth: 0.006 ms
get_auth: 0.002 ms
on_joinplayer: 282.47 ms
Trial #2
on_prejoinplayer: 46.517 ms
get_auth: 45.812 ms
get_auth: 0.006 ms
get_auth: 0.001 ms
on_joinplayer: 283.108 ms
Trial #3
on_prejoinplayer: 222.382 ms
get_auth: 223.67 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
on_joinplayer: 286.856 ms
Trial #4
on_prejoinplayer: 40.254 ms
get_auth: 40.191 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
on_joinplayer: 277.572 ms
Trial #5
on_prejoinplayer: 113.755 ms
get_auth: 113.559 ms
get_auth: 0.005 ms
get_auth: 0.002 ms
on_joinplayer: 302.207 ms
grand total: 2652.377 ms (530.475 ms per trial)
---------------------
-- New Player Join --
---------------------
Trial #1
on_prejoinplayer: 667.582 ms
create_auth: 55.143 ms
get_auth: 239.711 ms
get_auth: 0.003 ms
on_joinplayer: 284.481 ms
Trial #2
on_prejoinplayer: 651.416 ms
create_auth: 70.514 ms
get_auth: 241.781 ms
get_auth: 0.002 ms
on_joinplayer: 291.393 ms
Trial #3
on_prejoinplayer: 653.206 ms
create_auth: 81.624 ms
get_auth: 241.273 ms
get_auth: 0.003 ms
on_joinplayer: 286.546 ms
Trial #4
on_prejoinplayer: 52.127 ms
create_auth: 47.274 ms
get_auth: 242.559 ms
get_auth: 0.003 ms
on_joinplayer: 289.712 ms
Trial #5
on_prejoinplayer: 652.577 ms
create_auth: 50.841 ms
get_auth: 241.937 ms
get_auth: 0.003 ms
on_joinplayer: 287.050 ms
grand total: 6228.747 ms (1245.749 ms per trial)
--------------------
-- SET PRIVILEGES --
--------------------
Trial #1
get_auth: 0.003 ms
get_auth: 0.001 ms
get_auth: 46.787 ms
get_auth: 0.002 ms
get_auth: 0.002 ms
get_auth: 0.000 ms
set_privileges: 332.599 ms
get_auth: 0.003
Trial #2
get_auth: 0.004 ms
get_auth: 0.001 ms
get_auth: 222.644 ms
get_auth: 0.002 ms
get_auth: 0.001 ms
get_auth: 0.001 ms
set_privileges: 296.785 ms
get_auth: 0.004 ms
Trial #3
get_auth: 0.003 ms
get_auth: 0.000 ms
get_auth: 40.614 ms
get_auth: 0.002 ms
get_auth: 0.001 ms
get_auth: 0.001 ms
set_privileges: 298.970 ms
get_auth: 0.004 ms
Trial #4
get_auth: 0.003 ms
get_auth: 0.001 ms
get_auth: 113.697 ms
get_auth: 0.002 ms
get_auth: 0.001 ms
get_auth: 0.000 ms
set_privileges: 296.746 ms
get_auth: 0.004 ms
Trial #5
get_auth: 0.003 ms
get_auth: 0.001 ms
get_auth: 182.452 ms
get_auth: 0.002 ms
get_auth: 0.002 ms
get_auth: 0.001 ms
set_privileges: 287.106 ms
get_auth: 0.003 ms
grant total: 2118.460 ms (423.692 ms per trial)
***************************************************
* *
* BENCHMARK RESULTS :: Auth Redux Mod *
* *
***************************************************
-----------------
-- Player Join --
-----------------
Trial #1
on_prejoinplayer: 0.059 ms
get_auth: 0.009 ms
get_auth: 0.016 ms
get_auth: 0.006 ms
on_joinplayer: 0.038 ms
Trial #2
on_prejoinplayer: 0.063 ms
get_auth: 0.002 ms
get_auth: 0.005 ms
get_auth: 0.002 ms
on_joinplayer: 0.039 ms
Trial #3
on_prejoinplayer: 0.066 ms
get_auth: 0.002 ms
get_auth: 0.003 ms
get_auth: 0.001 ms
on_joinplayer: 0.039 ms
Trial #4
on_prejoinplayer: 0.064 ms
get_auth: 0.002 ms
get_auth: 0.004 ms
get_auth: 0.001 ms
on_joinplayer: 0.056 ms
Trial #5
on_prejoinplayer: 0.062 ms
get_auth: 0.002 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
on_joinplayer: 0.037 ms
grand total: 0.584 ms (0.117 ms per trial)
---------------------
-- NEW PLAYER JOIN --
---------------------
Trial #1
on_prejoinplayer: 521.555 ms
create_auth: 0.101 ms
get_auth: 0.003 ms
get_auth: 0.002 ms
on_joinplayer: 0.039 ms
Trial #2
on_prejoinplayer: 231.001 ms
create_auth: 0.080 ms
get_auth: 0.003 ms
get_auth: 0.001 ms
on_joinplayer: 0.038 ms
Trial #3
on_prejoinplayer: 265.901 ms
create_auth: 0.081 ms
get_auth: 0.003 ms
get_auth: 0.001 ms
on_joinplayer: 0.037 ms
Trial #4
on_prejoinplayer: 265.861 ms
create_auth: 0.099 ms
get_auth: 0.004 ms
get_auth: 0.001 ms
on_joinplayer: 0.038 ms
Trial #5
on_prejoinplayer: 243.255 ms
create_auth: 0.082 ms
get_auth: 0.004 ms
get_auth: 0.001 ms
on_joinplayer: 0.039 ms
total: 1528.334 ms (305.667 ms per trial)
--------------------
-- SET PRIVILEGES --
--------------------
Trial #1
get_auth: 0.012 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
get_auth: 0.000 ms
get_auth: 0.007 ms
set_privileges: 0.081 ms
get_auth: 0.001 ms
Trial #2
get_auth: 0.014 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
get_auth: 0.000 ms
get_auth: 0.010 ms
set_privileges: 0.056 ms
get_auth: 0.001 ms
Trial #3
get_auth: 0.014 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
get_auth: 0.000 ms
get_auth: 0.010 ms
set_privileges: 0.056 ms
get_auth: 0.001 ms
Trial #4
get_auth: 0.013 ms
get_auth: 0.005 ms
get_auth: 0.002 ms
get_auth: 0.000 ms
get_auth: 0.005 ms
set_privileges: 0.071 ms
get_auth: 0.001 ms
Trial #5
get_auth: 0.012 ms
get_auth: 0.005 ms
get_auth: 0.001 ms
get_auth: 0.000 ms
get_auth: 0.006 ms
set_privileges: 0.071 ms
get_auth: 0.002 ms
grant total: 0.475 ms (0.095 ms per trial)
***************************************************
* *
* BENCHMARK RESULTS :: Minetest 0.4.16 Builtin *
* *
***************************************************
-----------------
-- Player Join --
-----------------
Trial #1
on_prejoinplayer: 0.001 ms
get_auth: 0.016 ms
get_auth: 0.017 ms
get_auth: 0.022 ms
on_joinplayer: 4470.633 ms
Trial #2
on_prejoinplayer: 0.000 ms
get_auth: 0.009 ms
get_auth: 0.011 ms
get_auth: 0.004 ms
on_joinplayer: 5088.943 ms
Trial #3
on_prejoinplayer: 0.001 ms
get_auth: 0.009 ms
get_auth: 0.012 ms
get_auth: 0.004 ms
on_joinplayer: 4691.093 ms
Trial #4
on_prejoinplayer: 0.001 ms
get_auth: 0.01 ms
get_auth: 0.011 ms
get_auth: 0.003 ms
on_joinplayer: 4808.14 ms
Trial #5
on_prejoinplayer: 0.001 ms
get_auth: 0.009 ms
get_auth: 0.012 ms
get_auth: 0.004 ms
on_joinplayer: 4806.502 ms
grand total: 23865.468 ms (4773.094 ms per trial)
---------------------
-- NEW PLAYER JOIN --
---------------------
Trial #1
on_prejoinplayer: 242.375 ms
create_auth: 4781.226 ms
get_auth: 0.010 ms
get_auth: 0.002 ms
on_joinplayer: 4871.191 ms
Trial #2
on_prejoinplayer: 274.661 ms
create_auth: 4876.873 ms
get_auth: 0.010 ms
get_auth: 0.003 ms
on_joinplayer: 4830.267 ms
Trial #3
on_prejoinplayer: 274.616 ms
create_auth: 5079.059 ms
get_auth: 0.010 ms
get_auth: 0.003 ms
on_joinplayer: 4688.667 ms
Trial #4
on_prejoinplayer: 281.815 ms
create_auth: 5106.088 ms
get_auth: 0.011 ms
get_auth: 0.003 ms
on_joinplayer: 4859.933 ms
Trial #5
on_prejoinplayer: 314.042 ms
create_auth: 4490.457 ms
get_auth: 0.014 ms
get_auth: 0.005 ms
on_joinplayer: 4873.050 ms
grand total: 49844.391 ms (9968.878 ms per trial)
--------------------
-- SET PRIVILEGES --
--------------------
Trial #1
get_auth: 0.018 ms
get_auth: 0.008 ms
get_auth: 0.004 ms
get_auth: 0.003 ms
set_privileges: 5112.665 ms
get_auth: 0.009 ms
Trial #2
get_auth: 0.017 ms
get_auth: 0.007 ms
get_auth: 0.004 ms
get_auth: 0.002 ms
set_privileges: 4678.318 ms
get_auth: 0.010 ms
Trial #3
get_auth: 0.022 ms
get_auth: 0.009 ms
get_auth: 0.004 ms
get_auth: 0.002 ms
set_privileges: 4772.478 ms
get_auth: 0.010 ms
Trial #4
get_auth: 0.021 ms
get_auth: 0.009 ms
get_auth: 0.003 ms
get_auth: 0.003 ms
set_privileges: 4752.323 ms
get_auth: 0.011 ms
Trial #5
get_auth: 0.020 ms
get_auth: 0.009 ms
get_auth: 0.003 ms
get_auth: 0.002 ms
set_privileges: 4820.505 ms
get_auth: 0.010 ms
grand total: 24136.500 ms (4827.300 ms per trial)
***************************************************
* *
* BENCHMARK RESULTS :: Minetest 5.0 Builtin *
* *
***************************************************
-----------------
-- Player Join --
-----------------
Trial #1
on_prejoinplayer: 0.290 ms
get_auth: 0.040 ms
get_auth: 0.053 ms
get_auth: 0.036 ms
on_joinplayer: 64.240 ms
get_auth: 0.075 ms
get_auth: 0.031 ms
get_auth: 0.029 ms
get_auth: 0.028 ms
get_auth: 0.025 ms
get_auth: 0.029 ms
get_auth: 0.029 ms
Trial #2
on_prejoinplayer: 0.075 ms
get_auth: 0.039 ms
get_auth: 0.046 ms
get_auth: 0.030 ms
on_joinplayer: 61.444 ms
get_auth: 0.057 ms
get_auth: 0.024 ms
get_auth: 0.023 ms
get_auth: 0.022 ms
get_auth: 0.020 ms
get_auth: 0.024 ms
get_auth: 0.024 ms
Trial #3
on_prejoinplayer: 0.078 ms
get_auth: 0.028 ms
get_auth: 0.047 ms
get_auth: 0.026 ms
on_joinplayer: 73.072 ms
get_auth: 0.058 ms
get_auth: 0.023 ms
get_auth: 0.020 ms
get_auth: 0.019 ms
get_auth: 0.019 ms
get_auth: 0.022 ms
get_auth: 0.033 ms
Trial #4
on_prejoinplayer: 0.077 ms
get_auth: 0.026 ms
get_auth: 0.048 ms
get_auth: 0.026 ms
on_joinplayer: 94.677 ms
get_auth: 0.056 ms
get_auth: 0.024 ms
get_auth: 0.021 ms
get_auth: 0.019 ms
get_auth: 0.019 ms
get_auth: 0.022 ms
get_auth: 0.023 ms
Trial #5
on_prejoinplayer: 0.076 ms
get_auth: 0.050 ms
get_auth: 0.045 ms
get_auth: 0.026 ms
on_joinplayer: 50.702 ms
get_auth: 0.058 ms
get_auth: 0.023 ms
get_auth: 0.020 ms
get_auth: 0.020 ms
get_auth: 0.019 ms
get_auth: 0.025 ms
get_auth: 0.023 ms
grand total: 346.303 ms (69.260 ms per trial)
---------------------
-- NEW PLAYER JOIN --
---------------------
Trial #1
on_prejoinplayer: 776.039 ms
create_auth: 0.008 ms
get_auth: 0.05 ms
get_auth: 0.028 ms
on_joinplayer: 60.969 ms
get_auth: 0.061 ms
get_auth: 0.023 ms
get_auth: 0.02 ms
get_auth: 0.019 ms
get_auth: 0.06 ms
get_auth: 0.025 ms
get_auth: 0.023 ms
Trial #2
on_prejoinplayer: 736.077 ms
create_auth: 0.008 ms
get_auth: 0.050 ms
get_auth: 0.025 ms
on_joinplayer: 52.891 ms
get_auth: 0.060 ms
get_auth: 0.022 ms
get_auth: 0.020 ms
get_auth: 0.019 ms
get_auth: 0.018 ms
get_auth: 0.022 ms
get_auth: 0.023 ms
Trial #3
on_prejoinplayer: 729.159 ms
create_auth: 0.008 ms
get_auth: 0.614 ms
get_auth: 0.028 ms
on_joinplayer: 74.917 ms
get_auth: 0.059 ms
get_auth: 0.023 ms
get_auth: 0.021 ms
get_auth: 0.033 ms
get_auth: 0.034 ms
get_auth: 0.024 ms
get_auth: 0.023 ms
Trial #4
on_prejoinplayer: 822.92 ms
create_auth: 0.007 ms
get_auth: 0.051 ms
get_auth: 0.026 ms
on_joinplayer: 65.927 ms
get_auth: 0.06 ms
get_auth: 0.024 ms
get_auth: 0.021 ms
get_auth: 0.019 ms
get_auth: 0.019 ms
get_auth: 0.022 ms
get_auth: 0.023 ms
Trial #5
on_prejoinplayer: 588.514 ms
create_auth: 0.007 ms
get_auth: 0.049 ms
get_auth: 0.025 ms
on_joinplayer: 57.614 ms
get_auth: 0.059 ms
get_auth: 0.022 ms
get_auth: 0.021 ms
get_auth: 0.02 ms
get_auth: 0.018 ms
get_auth: 0.022 ms
get_auth: 0.039 ms
grand total: 3967.030 ms (793.406 ms per trial)
--------------------
-- SET PRIVILEGES --
--------------------
Trial #1
get_auth: 0.085 ms
get_auth: 0.030 ms
get_auth: 0.039 ms
get_auth: 0.021 ms
set_privileges: 62.812 ms
get_auth: 0.056 ms
Trial #2
get_auth: 0.086 ms
get_auth: 0.032 ms
get_auth: 0.038 ms
get_auth: 0.023 ms
set_privileges: 63.765 ms
get_auth: 0.057 ms
Trial #3
get_auth: 0.084 ms
get_auth: 0.031 ms
get_auth: 0.034 ms
get_auth: 0.021 ms
set_privileges: 68.226 ms
get_auth: 0.057 ms
Trial #4
get_auth: 0.083 ms
get_auth: 0.031 ms
get_auth: 0.035 ms
get_auth: 0.021 ms
set_privileges: 56.744 ms
get_auth: 0.056 ms
Trial #5
get_auth: 0.084 ms
get_auth: 0.031 ms
get_auth: 0.033 ms
get_auth: 0.021 ms
set_privileges: 64.044 ms
get_auth: 0.055 ms
grand total: 316.735 ms (63.347 ms per trial)

112
mods/auth_rx/changelog Normal file
View File

@ -0,0 +1,112 @@
Revision History
----------------------
Version 2.1b (30-Jun-2018)
- initial beta version
- included code samples for basic login filtering
- included a command-line database import script
Version 2.2b (04-Jul-2018)
- added install option to database import script
- improved exception handling by AuthFilter class
- fixed parsing of number literals in rulesets
- fixed type-checking of try statements in rulesets
- included mod.conf and description.txt files
Version 2.3b (08-Jul-2018)
- general code cleanup of AuthFilter class
- moved datasets into separate directory of world
- added two more comparison operators for rulesets
- tweaked pattern matching behavior in rulesets
- changed database search method to use Lua regexes
- removed hard-coded file names from database methods
Version 2.4b (13-Jul-2018)
- moved Journal and AuthDatabase classes into library
- added rollback function to AuthDatabase class
- reworked journal audit to support rollback option
- better encapsulated database commit function
- allowed for STOPPED opcode during database update
- various changes to error and action messages
- moved command-line scripts to separate directory
- included script to rollback database via journal
- included script to extract debug log into journal
Version 2.5b (17-Jul-2018)
- implemented function parsing algorithm for rulesets
- simplified operand matching logic in rulesets
- improved transcoding of literals in rulesets
- added some basic functions for use by rulesets
- fixed validation of dataset names in rulesets
Version 2.6b (19-Jul-2018)
- introduced support for array literals in rulesets
- added array-related functions for use by rulesets
- localized references to transcoding functions
- registered chat command to control login filtering
- included support for disabling login filtering
- added reload function to AuthFilter class
- tweaked lexer to skip comments on ruleset loading
- added search function to AuthDatabase class
Version 2.7b (22-Jul-2018)
- implemented time and date datatypes for rulesets
- updated code samples with latest feature-set
- added time-related functions for use by rulesets
- added time-related variables for use by rulesets
- minor formatting fixes to source code
- optimized comparison algorithm in ruleset parser
Version 2.8b (24-Jul-2018)
- introduced support for numeric patterns in rulesets
- created polymorphic pattern-matching classes
- excluded time-zone offsets in time/date comparisons
- standardized timestamps for use in filter functions
- removed daylight saving time from preset variables
- updated comparison algorithm in ruleset parser
- passed preset variables array to filter functions
Version 2.9b (26-Jul-2018)
- implemented address datatype for rulesets
- added more helper functions for use by rulesets
- fixed missing syntax checks in ruleset parser
- developed and integrated AuthWatchdog class
- added meta-variables for stateful login filtering
Version 2.10b (29-Jul-2018)
- major code reorganization via multiple libraries
- removed extra variables from AuthFilter class
- developed interactive debugger for testing rulesets
- added optional debugger hooks in AuthFilter class
- allowed for overriding preset variables by debugger
- included line-number in results of login filter
- added missing preset variable needed by rulesets
Version 2.11 (04-Aug-2018)
- developed a command-line player analytics script
Version 2.12 (10-Aug-2018)
- better code consolidation of AuthFilter class
- reworked ruleset parser to support syntax changes
Version 2.13 (20-Aug-2018)
- developed in-game database management console
- combined generic filter functions into superclass
- updated debugger to use new GenericFilter class
- added flag for constant-value operands in rulesets
- simplified operand matching logic in rulesets
- optimized comparison algorithm in ruleset parser
- consolidated lookup tables of lexical analyzer
- fixed erroneous status message shown in debugger
- added support for per-player debugging sessions
- redesigned login filter APIs for new architecture
- switched order of return values in login filter
- various code refactoring and better comments
Version 2.13.0 (20-Jul-2023)
- nil player object check due problematic joins on incomplete auth process
- added missing depends formspecs (it work without in basics but, some commands needs)
- we will later aded formspecs checks to made optional
- init the files when are fresh install, still do not convert from auth.txt if previous
- improve the auth handler cos fails for recent versions of mineshit engine
- fix deprecation warnings for fails handler of authentication player on recent engine

View File

@ -8,8 +8,15 @@
-----------------------------------------------------
-- Global Helper Functions
-----------------------------------------------------
local is_46 = minetest.has_feature("add_entity_with_staticdata")
get_minetest_config = core.setting_get -- backwards compatibility
if is_46 then
get_minetest_config = function( key )
minetest.settings:get( key )
end
else
get_minetest_config = core.setting_get -- backwards compatibility
end
function convert_ipv4( str )
local ref = string.split( str, ".", false )

View File

@ -23,12 +23,28 @@ AuthInitFile( world_path, "auth.db" )
local auth_filter = AuthFilter( world_path, "greenlist.mt" )
local auth_db = AuthDatabase( world_path, "auth.db" )
local auth_watchdog = AuthWatchdog( )
local is_50 = minetest.has_feature("object_use_texture_alpha")
local is_54 = minetest.has_feature("object_use_texture_alpha")
if minetest.register_on_auth_fail then
minetest.register_on_auth_fail( function ( player_name, player_ip )
auth_db.on_login_failure( player_name, player_ip )
auth_watchdog.on_failure( convert_ipv4( player_ip ) )
end )
if is_50 then
if minetest.register_on_auth_fail then
minetest.register_on_auth_fail( function ( player_name, player_ip )
auth_db.on_login_failure( player_name, player_ip )
auth_watchdog.on_failure( convert_ipv4( player_ip ) )
end )
end
end
if is_54 then
if minetest.register_on_authplayer then
minetest.register_on_authplayer( function ( player_name, player_ip, is_success )
if is_success then
return
end
auth_db.on_login_failure( player_name, player_ip )
auth_watchdog.on_failure( convert_ipv4( player_ip ) )
end )
end
end
minetest.register_on_prejoinplayer( function ( player_name, player_ip )

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
mods/auth_rx/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB