UPDATE #1: The script was somewhat successfully tested on Jeuxlinux. Thanks to rane and lululaglue for giving it a try and for their patience. However, it turned out the clientkick commands did not reach the server until some waiting time was added before and after them. Reason: RCON authorization takes some time and multiple commands in a short period of time are silently dropped. I've updated the script accordingly.
UPDATE #2: The script now re-initializes
command and
response as variables, e.g. after a server restart. Moreover, a command to remotely change the script's RCON password has been added. After this command successfully sets the response, it will use the new password and will not be able to connect to the server until the server's new password is in effect.
UPDATE #3: Major overhaul of the script global banlist functionality was added. The password command no longer logs the password. The RCON response to clientkick is now logged. Extensive comments were added and the sleeping time between rcon commands was refactored into the rcon() subroutine itself. Finally, native g_banIPs functionality via addIP/removeIP was added.
Since this version, the modul LWP::Simple is required.UPDATE #3.1: Found another embarrassing bug and eliminated it when trying to host this script for Rawhide.
UPDATE #4: A bad rcon password is now recognized and handled like a missed status query (triggering sleep phases). Instead of sleeping 4 seconds in every main loop iteration, the RCON socket is flushed for 4 seconds (to catch delayed/straying UDP packets).
UPDATE #5: Corrected the prefix check: dots "." are treated as any other character.
UPDATE #6: Revised error messages regarding missed status and failed global banlist updates, added (limited) GUID logging functionality (a player masks all other players of same name), fixed g_banips / IPPREFIX bug, added status_file support (an overview who is on the server and who recently connected, added optional g_banips import/delete functionality (see $manage_g_banips), slightly enhanced the logging of kicks (GUID and precise rule), whitelist functionality (entries of the form "+IPPREFIX # COMMENT")
REMARK: The current version supports also global banlists via FTP (e.g.
ftp://username:password@host.tld/path/file.name). However, you probably need to set your shell environment variable FTP_PASSIVE to 1, which seems to be the only way to tell Perl (or it's module LWP:Simple) to default to passive FTP mode. This is necessary, since the active mode does not work if the script's host is protected by a firewall.
UPDATE #7/#8: Various bug fixes, some minor, some major! The script no longer uses "ceil" (which isn't a standard perl command, so it seems). Included an optional functionality to warn or kick players without a GUID. Added a child-proof lock for "del:" to prevent people from deleting their whole local banlist. Included support for an external configuration file (that's good, for updating or running several ban scripts for several servers). Fixed also a wrong initial value of the advertisment_index variable.