Ban Management

Ban Management

193k Downloads

Handle duplicate names via /bminfo

c0wg0d opened this issue · 25 comments

commented

A player was automatically banned, but their record no longer exists when you go to view their ban.

[00:20:43] [Thread-1159/INFO]: Warning: ICANSMELLU2 attempted to join the server but was denied due to [Auto Language Ban] You said 'Fuck'
[00:20:43] [Thread-1159/WARN]: [BanManager] Duplicates found for ICANSMELLU2, was unable to contact Mojang for updated names
[00:20:43] [Thread-1159/INFO]: Disconnecting com.mojang.authlib.GameProfile@6f74193d[id=05685379-1bcc-4a5d-9286-fba898a0e952,name=ICANSMELLU2,properties={textures=[com.mojang.authlib.properties.Property@60059bc5]},legacy=false] (/73.96.162.69:51948): §6You have been banned from this server for §4[Auto Language Ban] You said 'Fuck'
[00:20:43] [Server thread/INFO]: com.mojang.authlib.GameProfile@6f74193d[id=05685379-1bcc-4a5d-9286-fba898a0e952,name=ICANSMELLU2,properties={textures=[com.mojang.authlib.properties.Property@60059bc5]},legacy=false] (/73.96.162.69:51948) lost connection: §6You have been banned from this server for §4[Auto Language Ban] You said 'Fuck'

>bminfo ICANSMELLU2
[04:53:47] [Craft Scheduler Thread - 84/INFO]: ICANSMELLU2 not found, are you sure they exist?

I'm not sure how this happened. Does this mean they will be able to login again? I tried to look at their records in the database, but it's outputting all kinds of weird stuff in my mysql client. I don't know if that's normal or if I have some weird SSH settings going on, but their player page on the WebUI doesn't show any ban either.

commented

I seem to be having this same problem, except it is more prevalent as an issue. Sorry to bring this thread back up, but it was the only one I could find that was similar to my issue. Essentially, I run the plugin with onlineMode set to false, while running build 110+. Very periodically, duplicates for players are created in bm_players (assigning them an online and offline uuid for two separate entries). Deleting these entries is not hard, but the fact that these duplicate entries occur so frequently is making it quite an issue. This is because when in offline mode, when trying to ban etc a player with a duplicate, nothing happens, nor can you /bminfo him, as stated previously here in this thread.

The reason these duplicates were occurring I had thought was because maybe a server had onlineMode set to true, but I do not see that to be the case, and when checking which server the player was connected to when the duplicate happens, there is no direct pattern.

I do not see anything relevant in the console other than the following:
[20:30:32] [User Authenticator #210/INFO]: [BanManager] Requesting name for 6b13865c-c138-3b4c-b3a8-d30a2f2e7dbc [20:30:32] [User Authenticator #210/WARN]: [BanManager] Duplicates found for CaviteBoy, was unable to contact Mojang for updated names

This is the offline uuid, so unsure when it grabbed the online one (this is about when the duplicate happened, and is all the console said).

I would also like to note this happened before build 110, except the error being produced was that shown in issue #569. I will keep trying myself to find the source of why this is occurring, but just updating here in case the solution is out of my control, which at this point it seems to be. I also understand this issue was changed to an enhancement, but maybe there is potentially more to this than previously realized.

commented

@Rushnett Odd. Are you using the global database setting as well?

commented

@confuser I am only using the main database option, since I had no need for separate bans on each server.
My config layout is here, with any sensitive info asterisked out.

On a side note however, I rsync the BM folder to all my servers from a root directory. This also currently syncs the console.yml as well to all the servers. Would that possibly cause any issues stated in this thread? Should I omit the console.yml to be synced?

commented

@Rushnett Nothing in your config looks out of place. Having the same console.yml won't cause any issues, other than the fact you won't be able to differentiate between servers of any punishments issued via the console.

The fact that even in offline mode, the plugin still attempts to retrieve the most up-to-date UUID of an offline mode player is certainly a bug. However, it doesn't appear to be the cause in this case. Are you using dev builds 110+ on all your servers?

commented

@confuser I am currently using build 118 on all of my servers.

commented

@Rushnett Are you able to narrow down a way to reproduce this? I can't see any obvious ways this could occur without one server being in online mode.

commented

@confuser apologies for the late reply. It will prove difficult for me to reproduce this on my server since its size makes it difficult to track down the issue, but I will try to make a smaller production for it, or hook up a new database to one server.

In the meantime though, this issue makes it a little difficult for people on my server to ban certain players since half the time it tries to use the wrong uuid. Is there any way you could make it where with onlineMode set to false, that it could always pick the generated offline uuid as maybe a temp fix? Or maybe something else. If not, that is all right, it just can make security issues at the moment a bit difficult if using the plugin.

commented

Without knowing the cause, I can't offer a temporary solution. As far as I can tell, whenever onlineMode is false, everything within BM should use a generated offline UUID.

commented

So the issue here for name lookups is that you have more than one player with the same name in the database, due to name changes. Based on the logs, an attempt to find the new name of the older UUID failed.

In this case, the default behaviour for /bminfo if the Mojang lookup failed in this scenario, is to say it couldn't find them. Not ideal behaviour, a better message of "Multiple players found" would be better.

I imagine the 'weird' stuff will just be the default character set for the UUIDs as they're stored in binary rather than hex.

Below example query to convert and see the actual UUIDs.

SELECT HEX(player_id) AS player_id, * FROM bm_player_ban_records
commented

Thank you for the clarification. And just to confirm, it is actually banning via UUID, correct? So even if they change their name they can't reconnect if they are banned? Pretty sure it was added in v5 but just for a sanity check...

commented

Correct. They'll still be banned regardless of name changes.

The main issue with it saying player not found when using a name, is BM doesn't know which one to pick.

commented

Do you have any plans to return/show multiple records, similar to how ChangeNameHistory does? Obviously typing out UUIDs in game is not ideal, and moderators really need a way to see ban history when dealing with players.

As a side note, I hate Mojang for implementing name changes. It's the worst idea they have ever had.

commented

I'm not familiar with ChangeNameHistory, but I'm certainly open to the suggestion as to how the flow should function in this scenario, i.e. would it be an extra argument, command flags etc.

commented

I'm wondering if I have a bigger issue here than I first realized. If I look in the players table, sometimes there are multiple UUIDs for a single username, however, when searching for the UUIDs on any number of name lookup sites, some of them are invalid. Even I myself have two player records, and I've never once changed my name.

mysql> select hex(id), name, lastSeen from players where name in ('Kingblakers7', 'ICANSMELLU2', 'c0wg0d');
+----------------------------------+--------------+------------+
| hex(id)                          | name         | lastSeen   |
+----------------------------------+--------------+------------+
| EB42D50EDC6F4D48B4B570C7BFA77512 | c0wg0d       | 1469405813 |
| D10E6913F54335B896B4B3FBB3ED7073 | c0wg0d       | 1468913712 |
| 056853791BCC4A5D9286FBA898A0E952 | ICANSMELLU2  | 1469545602 |
| 75914F5843493BF192F70C5DA1A1F724 | ICANSMELLU2  | 1469139148 |
| E1642A1F117C44F5B8A2262F8E66BBED | kingblakers7 | 1469465855 |
| A76E333DCF4C3DD39BED2DB8CE6AB7E8 | kingblakers7 | 1469318533 |
+----------------------------------+--------------+------------+
6 rows in set (0.00 sec)

If you look up those UUIDs, only one is valid for each player.

I have all my servers set to offline mode, but my BungeeCord is in online mode with ip_forward: true set in the config.

Any idea what is going on?

commented

Most likely you had, or have a server that isn't correctly being forwarded online UUIDs.

Correct online UUID:

EB42D50EDC6F4D48B4B570C7BFA77512 | c0wg0d

Generated offline UUID:

D10E6913F54335B896B4B3FBB3ED7073 | c0wg0d
commented

Oh man. I assume there's no easy way to clean that up and delete the invalid player records?

Would this work or am I asking for trouble running this?

delete from players where id not in (select id from player_ban_records);

commented

I wouldn't do that, otherwise you'll delete any players that have active bans, but no ban records.

First, find out how many duplicates you have

SELECT name, COUNT(*) c FROM bm_players GROUP BY name HAVING c > 1 AND name != 'Console';
commented

I have 116 duplicates.

commented

I got an error when trying to run that, but I modified it and got a solution using this:

DELETE FROM bm_players where id IN (SELECT tid FROM (SELECT t1.id as tid FROM bm_players t1 JOIN bm_players t2 ON t2.name = t1.name AND t2.lastSeen > t1.lastSeen WHERE t1.name != 'Console') as x);

My only issue now is that the web interface search sometimes returns some very odd results. I'm not sure if that's a related issue or not. If this should go into a new issue, let me know.

http://i.imgur.com/Cq2zuop.png

commented

Completely untested. Make a backup first!

Before running this, run the above query and find all IDs of duplicates and keep it safe somewhere. You can then use this to run a DELETE IN query on the other tables.

DELETE FROM bm_players
WHERE id IN
(SELECT t1.id
 FROM bm_players t1
 JOIN bm_players t2
   ON t2.name = t1.name
   AND t2.lastSeen > t1.lastSeen 
WHERE t1.name != 'Console')
commented

You'll need to remove any bans/mutes/records that don't have a player associated with them. as well.

Something like:

DELETE b FROM `bm_player_bans` b LEFT JOIN `bm_players` p ON b.player_id = p.id WHERE p.id IS NULL

Again, untested, backup first etc.

commented

I think this is just a display/search issue. I do not have any records that don't link back to a player record.

mysql> select id, reason from bm_player_bans where player_id not in (select id from bm_players);
Empty set (0.00 sec)

When I do a name search, it shows all that garbage in my screenshot above, but if I manually go to the player record for the player name I just searched, it shows all their records properly. Any other ideas?

commented

Have you got an example link?

On 1 Aug 2016 20:03, "c0wg0d" [email protected] wrote:

I think this is just a display/search issue. I do not have any records
that don't link back to a player record.

mysql> select id, reason from bm_player_bans where player_id not in (select id from bm_players);
Empty set (0.00 sec)

When I do a name search, it shows all that garbage in my screenshot above,
but if I manually go to the player record for the player name I just
searched, it shows all their records properly. Any other ideas?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#647 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABlQdSjVzTIUUrcdQSjmAl3dxHmdrFEmks5qbkMPgaJpZM4JU8IX
.

commented

Yes, what is your email?

commented

[email protected]

On 1 Aug 2016 20:10, "c0wg0d" [email protected] wrote:

Yes, what is your email?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#647 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABlQdaI8lM1s28k_nfIzt4gJkg8sMvv-ks5qbkSlgaJpZM4JU8IX
.