azalty / sm-no-dupe-account

No Dupe Account is a plugin that prevents players from joining the server if they have a duplicate or recent account
https://forums.alliedmods.net/showthread.php?t=330779
GNU General Public License v3.0
7 stars 2 forks source link

Implement immunity for privileged players #4

Closed crashzk closed 2 years ago

crashzk commented 3 years ago

Privileged players would not go through the following checks:

I believe that a cvar, something like sm_no_dupe_account_immunity with standard immunity for players with reserved slot would be perfect.

If the administrator wants to change, just edit the cvar in the SourceMod overrides.

Checks such as VAC Bans, Games Bans, Bans Community continues, even with privileges the players who have these bans do not connect to the server.

crashzk commented 3 years ago

@azalty news about this feature?

I would like to use it in the case for players who do not have prime or the necessary hours played in the game to make them immune in the case, thus entering the server.

azalty commented 3 years ago

@azalty news about this feature?

I would like to use it in the case for players who do not have prime or the necessary hours played in the game to make them immune in the case, thus entering the server.

I've been busy lately. I often add features when I want to do so.

Considering I know I have lots of other things to do, I don't know if I'll have both the motivation and time to do it.

I prefer not making false promises, so no ETA.

It'll be done though, don't worry. Soon™️

azalty commented 3 years ago

Checks such as VAC Bans, Games Bans, Bans Community continues, even with privileges the players who have these bans do not connect to the server.

That's where other people could argue. I don't see the point in giving immunity if it isn't full immunity. I wanted to do a full immunity thing, but if you really want something like that, better do it fully customizable, but it'll take a really long time for something not that important.

Doing a system like so would require keyvalues&shit and it's kinda annoying, but if you really want it, then I can do it. Else I can just do a simple cvar like nda_immunity "a" -> everyone with the 'a' flag will not be verified by the plugin

(yes, I'm alive)

azalty commented 3 years ago

Alternatively, as you said, I can just create an override, though the documentation says weird things (I'll have to check that further), but it will still be full immunity

I can also implement a thing like nda_immunity "a,z,co,bd" to add multiple flag things

So many possibilities!

crashzk commented 3 years ago

I particularly prefer that players with VAC Bans, Game Bans & Community Bans still cannot join, even if they have immunity/privileges and such, since if the server has VAC active the player no longer joins, would have to remove the VAC from the server for them to enter. (As far as I know, correct me if I'm wrong)

But I understand your point, it would be more work and such, this suggestion would need to be discussed further.

azalty commented 3 years ago

since if the server has VAC active the player no longer joins, would have to remove the VAC from the server for them to enter. (As far as I know, correct me if I'm wrong)

Didn't understand that 🤔

A player with an active VAC ban on source games (CS:GO, CS:S, TF2...) won't be able to join your server if VAC is enabled on it, and having nda_bans_vac, nda_bans_total, nda_bans_recent disabled won't change anything. This will be the same if a player is game banned from CS:GO.

nda_bans_vac: meant for people that are pretty likely to cheat, but aren't VAC Banned from Source games (yet?) nda_bans_game: same as the upper one, but for game bans. Game bans are in most cases because of cheating, but players have been caught by another anticheat than VAC nda_bans_community: people that have a Steam Community ban will have private profiles and are unable to add friends or comment. I think they happen if: really toxic behaviour, phishing, scam (note that these two can also give a trade ban), harassing, NSFW content not tagged as NSFW, spam in forums, though I didn't see any community banned player yet. nda_bans_total: nda_bans_vac and nda_bans_game combined nda_bans_recent: a recently banned player is pretty likely to be a cheater, especially if he's new to the game or his account is new

You shouldn't disable VAC from your server unless you have really good reasons to. These things are not that important, and only a personal preference. Please note that a lot of people were VAC banned from Call of duty games due to them using DLCs unlockers or Weapon skins shit, so a VAC ban doesn't always mean a cheater in every game that is spinbotting

azalty commented 3 years ago

I'm planning on adding a whitelist for VPN checks for SteamID/IPs as well as the same thing for the entire plugin. Basically a complete and customizable whitelist system.

What can be entered:

What I would like to do: A selective whitelist, where you can whitelist whatever you want:

Syntax: steamid|ip|flag;method1|all;method2;method3 ...

What whitelisting a check does:

Whitelisting a check disables it for the player, and thus, disable a way for players to verify themselves. It isn't very useful.

SPECIAL CASE: Writing all or manually entering every check name will remove every check and thus, let them enter without any verification. This is useful is you want to let your staff bypass this system or if a new account you trust cannot join.

What whitelisting a notification only check does:

It will not check the player and thus, not send a notification. Whitelisting vpn if you set it as a notification only check is useful if you know the player who is using the VPN isn't shady/isn't a duplicate account.

What whitelisting a kick method [or needed check] does:

The player won't get checked by this method and thus, won't get banned if they don't pass it.


Whitelisting some methods can cause small anomalies like for example a player being marked as non-prime while this player is actually prime (because they didn't get verified)


If I actually decide to start making this system, it might take me some time, but don't worry, I plan on testing it a lot first to avoid the database fiasco (every player getting accepted). I can't promise anything though.

Don't worry, everything about that system will be explained when it is released. I'll probably make a wiki page too.


Q: But @azalty, you took ages to answer and you still not started working on that! A: Yes. I'm lazy, sorry :(

crashzk commented 3 years ago

@azalty what's new about this feature?

Sorry to be annoying about this, I would really be happy with this feature. 😁

azalty commented 3 years ago

@azalty what's new about this feature?

Sorry to be annoying about this, I would really be happy with this feature. 😁

I've been pretty busy working for my server (did several big private plugins, and fixed CT Bans, you know, this thing <3 😃

I'm currently working on a big plugin for my server. Since i'm the only owner, developper, configurator, map adder...

Since this feature would be very helpful for my server as well, I think I'll start working on it after that big plugin is made.

Developing takes time, and vacations are nearly over in my country (in a few days), so I'll probably be a lot more slower. I'll reach you out as soon as I start working on NDA. I know I've been slow with this plugin, and I really apologize about it, but there's just so much projects I want to do, and motivation and time isn't unlimited 😦

Would you like to test beta versions once I have finished, in my opinion, this system? I'd like to test it for multiple days to make sure it is working right before releasing it.

crashzk commented 3 years ago

I see, I also saw about CT Bans. In any case I'm waiting, and yes, if you need someone to test the system before officially launching it just a tap, I can test it.

About CT Bans really nice, currently I don't use it anymore, in case I don't have the JB server anymore in any case when I get it I'll test these changes and corrections made in your version.

azalty commented 3 years ago

I'm working on that right now. I've made the big config file design. It'll also feature #18

azalty commented 3 years ago

Here is a preview of the config file. Experimental, can change.

// This is a NDA (No Dupe Account) config file.
// Don't forget about the cvars config file located here: /csgo/cfg/sourcemod/no_dupe_account.cfg

"no_dupe_account"
{
    "Players" // Players whitelist
    {
        // Format:
        // "SteamID2 (starting with STEAM_1)"   "methods to disable, separated by ';'"
        // "IP"     "methods to disable, separated by ';'"
        // "flag"   "methods to disable, separated by ';'"
        // "country code"   "methods to disable, separated by ';'"
        //
        // List of methods: (you can select them all with 'all')
        // Other: vpn, country (check below)
        // CSGO: csgo_level, csgo_playtime, prime, csgo_playtime, csgo_coin
        // Steam: steam_level, steam_age, bans_vac, bans_game, bans_total, bans_recent
        // 
        // Examples:
        // "STEAM_1:0:11101"    "vpn;csgo_playtime;bans_vac;bans_game;bans_total" // prevents this user from being checked/verified by these methods
        // "STEAM_1:0:11101"    "all" // removes all verifications for this user
        // "1.1.1.1"    "vpn" // removes vpn method for this IP
        // "a"  "csgo_playtime" // removes the playtime check/requirement for every user that has the 'a' flag
        // "cd" "vpn" // removes the vpn method for every user that has both 'c' and 'd' flags
        // "z"  "all" // removes all verifications for root users

        "STEAM_1:0:11101"   "all" // Example: don't do any verification on GabeN
    }
    "Countries" // Countries blacklist
    {
        // This config part uses GeoIP, bundled with SourceMod by default.
        // To update GeoIP and have correct results, you can update SourceMod every month.
        // Watch out: IP localization can be imprecise. I would not advise banning people.
        // If your server only allows a specific language, it might be a good idea to block other countries.
        // It's also a good idea to block countries that are only used by people with VPNs to circumvent bans.
        // 
        // False-positive? You can whitelist some players/IPs using the 'Players' config part at the top of the file! Method name: 'country'.
        // 
        // Format:
        // "Country 2 letter code" (can be found here: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
        // {
        //      "effect"    "0" // -1 = kick  |  any positive integer = ban this amount of minutes  |  0 = ban permanently
        //      "reason"    "This country is blacklisted!" // the reason that will be used. Will be displayed to the user!
        //
        //      "ban_command"   "sm_ban {userid} {effect} {reason}" // OPTIONAL! Allows you to use different ban commands, this way we support pretty much any banning system.
        //      // supported variables (optional, you can manually write your command yourself):
        //      // {userid} = client userid with # before (ex: #103)
        //      // {steamid} = client SteamID2, starting with STEAM_1 (ex: "STEAM_1:1:57298004")
        //      // {effect} = what you entered in 'effect'.
        //      // {reason} = what you entered in 'reason'. Avoids any problem with the double quotes character. (Ex: "This country is blacklisted!")
        //      
        //      // So "ban_command" "sm_ban {userid} 1440 This country is blacklisted!" will also work! (in case your plugin allows reasons that aren't entered within double quotes)
        //      // -> "ban_command" "sm_ban {steamid} {effect} {reason}" will send: sm_ban "STEAM_1:1:57298004" 0 "This country is blacklisted!"
        //      
        //      // "kick_command" is also supported, and works the exact same way, except {effect} variable doesn't work.
        // }
        // 
        // Examples:
        // "FR" // block French people
        // {
        //      "effect"    "1440" // ban them for a day
        //      "reason"    "French people are not allowed on this server"
        // }
        // "DE" // block German people
        // {
        //      "effect"    "30" // ban them for 30 mins
        //      "reason"    "Sorry, but your country is not allowed on this server"
        //      "ban_command"   "sm_tempban {effect} {steamid} {reason}" // invented command for the example
        // }

        // If whitelist is enabled: effect, reason, ban_command and kick_command will have to be entered on this level, not inside a contry 2 letter code.
        "whitelist" "0" // If set to 1, this becomes a whitelist instead of a blacklist (meaning only the countries that are specified here can connect).

        // START ADDING YOUR COUNTRIES HERE

    }
}
azalty commented 3 years ago

The very experimental code is done. There's probably a huge amount of bugs.

I'll test it on my own later (it's the night for me currently). If it works, or once I fix all the bugs I can find, I'll publish the version into the main branch so you can test it if you want.

crashzk commented 3 years ago

Good, thank you very much, I will try it.

I liked the model you mentioned, being all right just publish that I can use and report if there is any BUG.

Thank you again.

azalty commented 3 years ago

@crashzk 1.5.0 Beta 1 is released on the main branch.

Small improvements have been made to the config file. I know there are a lot of comments everywhere and it's messy, but hey, I suck at explaining things :(

It worked fine on my testings, but I didn't test everything (I didn't test the "whitelist" "1" option at all for countries)

crashzk commented 3 years ago

@azalty thanks, i will test here on my servers, return here as soon as possible with feedback.

crashzk commented 3 years ago

@azalty I'm doing a test here, many players can't connect and they get this message:

Your account is too suspicious and recent, try playing more on official game modes!

Dropped mira gulosa from server: Sua conta é muito recente e suspeita, jogue mais os modos de jogo oficiais da Valve
Dropped joaohenriqueiser from server: Sua conta é muito recente e suspeita, jogue mais os modos de jogo oficiais da Valve
Dropped wantxdxl99 from server: Sua conta é muito recente e suspeita, jogue mais os modos de jogo oficiais da Valve

Logs server:

L 10/05/2021 - 16:37:10: [no_dupe_account.smx] Refused Zedendagua<57><STEAM_1:0:544951982><> (no check passed)
L 10/05/2021 - 16:38:03: [no_dupe_account.smx] Refused wantxdxl99<58><STEAM_1:0:531248783><> (no check passed)
L 10/05/2021 - 16:39:18: [no_dupe_account.smx] Approved brn the boneless<59><STEAM_1:1:454187376><> (Is Prime)
L 10/05/2021 - 16:39:19: [vip/VIP_Admin.smx] ReadGroups: brn the boneless (3) -> -1
L 10/05/2021 - 16:40:27: [no_dupe_account.smx] Refused mira gulosa<61><STEAM_1:1:450165413><> (no check passed)
L 10/05/2021 - 16:40:40: [vip/VIP_Admin.smx] ReadGroups: mira gulosa (6) -> -1
L 10/05/2021 - 16:40:45: [no_dupe_account.smx] Refused mira gulosa<62><STEAM_1:1:450165413><> (no check passed)
L 10/05/2021 - 16:40:58: [vip/VIP_Admin.smx] ReadGroups: mira gulosa (6) -> -1
L 10/05/2021 - 16:41:05: [no_dupe_account.smx] Refused mira gulosa<63><STEAM_1:1:450165413><> (no check passed)
L 10/05/2021 - 16:41:09: [vip/VIP_Admin.smx] ReadGroups: joaohenriqueiser (4) -> -1
L 10/05/2021 - 16:41:10: [no_dupe_account.smx] Refused joaohenriqueiser<60><STEAM_1:0:564947059><> (no check passed)
L 10/05/2021 - 16:41:18: [vip/VIP_Admin.smx] ReadGroups: mira gulosa (4) -> -1
L 10/05/2021 - 16:41:24: [no_dupe_account.smx] Refused mira gulosa<64><STEAM_1:1:450165413><> (no check passed)
L 10/05/2021 - 16:41:38: [vip/VIP_Admin.smx] ReadGroups: mira gulosa (4) -> -1
L 10/05/2021 - 16:41:44: [no_dupe_account.smx] Refused mira gulosa<65><STEAM_1:1:450165413><> (no check passed)
L 10/05/2021 - 16:43:44: [no_dupe_account.smx] Refused wantxdxl99<66><STEAM_1:0:531248783><> (no check passed)
L 10/05/2021 - 16:44:21: [vip/VIP_Admin.smx] ReadGroups: wantxdxl99 (6) -> -1

One of the players sent their steam profile link for me to check: Um dos players enviou seu link do perfil steam para que eu verificasse: https://steamcommunity.com/profiles/76561199022763294/

image

Setting I use in no_dupe_account.cfg located in csgo/addons/sourcemod/configs folder:

"no_dupe_account"
{   
    "Players"
    {
        "a" "prime;csgo_playtime"
    }   
}

Setting I use in no_dupe_account.cfg located in csgo/cfg/sourcemod folder:

// (Requires SteamWorks)
// A SteamAPI key that will be used to check playtime
// Get your own at: https://steamcommunity.com/dev/apikey
// This is a sensitive key, don't share it!
// Needed to get the playtime or prime status
// -
// Default: ""
nda_steamapi_key "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

// (Requires Discord API and SteamWorks)
// Discord integration with a webhook
// empty = disabled
// webhook url = enable
// -
// Default: ""
nda_discord "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

// Enable saving player values in a database.
// Will act as a cache, if a player doesn't want to keep is profile public, he can join once while it's public and it won't deny him in the future.
// 1 = enabled
// 0 = disabled
// Database config name: 'no_dupe_account'
// -
// Default: "1"
nda_database "1"

// (Requires Database)
// any integer = refresh players values if older than X minutes
// 0 = never refresh (recommended if you don't plan on using the DB for other reasons)
// NOTE: Player values will ALWAYS refresh if they are denied, but this will NOT count as a true full refresh
// -
// Default: "1440"
nda_database_refresh "1440"

// (Requires Database)
// any integer = players values are deleted if older than X days (using refresh as well is recommended)
// 0 = keep player values forever
// NOTE: Deleting really old values of players that don't play anymore is recommended
// -
// Default: "365"
nda_database_expire "365"

// (Requires SteamWorks)
// 0 = disabled
// 1 = check for VPNs or proxies, and send an in-game alert to admins if someone is potentially using one (and a discord message if setup)
// 2 = is a user check that fails is user has a VPN
// 3 = kick user
// -
// Default: "1"
nda_vpn "0"

// 0 = disabled
// any integer = is a user check that fails if his level is under this value. Keep in mind if someone gets his service medal he will go back to level 1
// -
// Default: "2"
nda_level "0"

// (Requires SteamWorks)
// 0 = disabled
// 1 = is a user check that fails if user is not prime (will only work if user paid the game) + nda menu
// 2 = only add an !nda menu displaying non-prime players
// -
// Default: "1"
nda_prime "1"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = is a user check that fails if he has less mins in playtime than asked or has private hours
// any negative integer = same as positive, but is not a check and will kick user
// -
// Default: "120"
nda_playtime "-2700"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = is a user check that fails if his steam level is under this value or his profile is private
// any negative integer = same as positive, but is not a check and will kick user
// -
// Default: "5"
nda_steam_level "0"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = is a user check that fails if his steam account age is newer than this value in minutes or his profile is private
// any negative integer = same as positive, but is not a check and will kick user
// ~integer (ex: ~60) = same as negative, but will not kick user if his profile is private
// -
// Default: "1576800"
nda_steam_age "0"

// 0 = disabled
// 1 = is a user check that fails if he doesn't have any CS:GO coin/badge equipped
// 2 = kick user if he doesn't have any CS:GO coin/badge equipped (this is not recommended as a lot of players don't have a coin)
// -
// Default: "1"
nda_coin "0"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = kick player if he has been VAC banned at least X times
// -
// Default: "0"
nda_bans_vac "1"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = kick player if he has been Game banned at least X times
// -
// Default: "0"
nda_bans_game "1"

// (Requires SteamAPI Key)
// 0 = disabled
// 1 = kick player if he is community banned (spam, phishing, nudity...)
// These people will have private profiles and are unable to add friends or comment.
// 2 = send an in-game alert to admins if player is community banned (and a discord message if setup)
// -
// Default: "2"
nda_bans_community "1"

// (Requires SteamAPI Key)
// 0 = disabled
// any integer = kick player if he has been banned at least X times (VAC+Game bans)
// -
// Default: "0"
nda_bans_total "1"

// (Requires SteamAPI Key)
// 0 = disabled
// any positive integer = send an in-game alert to admins (and a discord message if setup) if player has been VAC or Game banned X days ago or less
// any negative integer = same as positive integer, but instead of sending an alert, it will kick the player
// -
// Default: "5"
nda_bans_recent "-1"

// 0 = don't log
// 1 = log check approvals & refusals to server's console
// 2 = log check refusals to server's console
// -
// Default: "1"
nda_log "1"

Este erro seria referente ao Status Prime?

If yes, it should not show the message referring to Prime:

"IsNonPrime"
    {
        // {1} = playername
        "pt"    "{darkred}[NDA] {blue}Player {darkblue}{1}{blue} não tem {red}Status Prime"
    }

Attached are the settings I'm using.

No Dupe Account v1.5.0 Beta 1.zip

azalty commented 3 years ago

Your "Players" section in the keyvalues (config file) is doubled. There should only be one, the first one will be chosen, so here your config shouldn't work.

About the non-prime message: this message is the one that is shown when using the !nda command and selecting a player that is not prime. However, on your config, the prime status is a check, so failing every check (there's only one here) will display the "Suspicious/too recent account" message. Feel free to edit it to your liking (for example, by saying that having Prime status is needed).

This user https://steamcommunity.com/profiles/76561199022763294/ is probably non-prime.

azalty commented 3 years ago

About the other ones, a quick verification showed me they joined cs:go in 2020 or after, when the game was free to play. It's same to assume they have non-prime accounts, and that's the reason they're not able to join.

If they have the 'a' flag and they can't join, please try to remove the duplicate "Players" section, and try again :)

crashzk commented 3 years ago

@azalty perfect, I made some corrections based on what you said, testing again.

Suggestion about the log it sends, would it be possible to create a file with this information, in the logs folder?

From what I saw in the config it just registers right, it doesn't create the file.

// 0 = don't log
// 1 = log check approvals & refusals to server's console
// 2 = log check refusals to server's console
// -
// Default: "1"
nda_log "1"
azalty commented 3 years ago

It is be possible to add this feature (but it isn't into NDA), but I find it better to track directly into console.log

I might add -1 and -2 to log into a different file, create a suggestion ;) https://github.com/azalty/sm-no-dupe-account/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=

azalty commented 3 years ago

btw, it didn't specify it, but yea, disabling every check through the whitelist for a specific user will automatically approve him. (required methods will still be applied though, if you didn't whitelist them too)

However, removing checks but letting 1 or more will only lower the methods with which he can verify. So, it's kind of a 'bad' thing, but it can be useful if you know some specific profiles can't be trusted, and will pass a specific check.

I hope you can understand what I say, I suck at explaining things.

crashzk commented 3 years ago

@azalty so far so good.

I believe everything is ok and can be merged. I keep doing tests here, any problems I report.

azalty commented 3 years ago

Just added it to my server, so far, so good, same :)

crashzk commented 3 years ago

Yes, everything is fine here too. Just not being able to thoroughly test the country system.

azalty commented 2 years ago

Added in the 1.5.0 stable release.