Raised This Month: $12 Target: $400
 3% 

[Any] Server Whitelist Advanced (1.5.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Plugin ID:
3340
Plugin Version:
1.5.0
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    40 
    Plugin Description:
    Restricts server to SteamIDs, IPs and SteamGroups' members/officers listed in the whitelist
    Old 11-01-2012 , 19:56   [Any] Server Whitelist Advanced (1.5.0)
    Reply With Quote #1

    Server Whitelist Advanced

    v. 1.5.0
    Based on Server Whitelist

    Features (Admin Commands) :
    • <sm_whitelist_exist | say !whitelist_exist> : Tell if the SteamID, IP or SteamGroupId is present in the currently loaded whitelist.
    • <sm_whitelist_add | say !whitelist_add> : Add a SteamID, IP or SteamGroupId to the whitelist file. If adding a SteamID, you should use double-quotes ("").
    • <sm_whitelist_remove | say !whitelist_remove> : Remove a SteamID, IP or SteamGroupId from the whitelist file. The change is made on map/plugin end (unless whitelist_removeinstant=1), but the loaded whitelist instance is updated instantly. If removing a SteamID, you should use double-quotes ("").
    • -----------
    • <sm_whitelist_reload | say !whitelist_reload> : Reloads the whitelist file and invalidate the SteamGroups blacklist cache.
    • <sm_whitelist_rewrite | say !whitelist_rewrite> : Rewrites the whitelist file to remove SteamId/IPs waiting for map end to be removed. No need if whitelist_removeinstant = 1.
    • <sm_whitelist_list | say !whitelist_list> : List all SteamIDs, IPs and SteamGroupIds in the whitelist file.
    • -----------
    • <sm_whitelist_resettodefault | say !whitelist_resettodefault> : Delete the current whitelist and recreate the default one.

    What's different from Server Whitelist ? :
    • Steam Groups handling via SteamWorks[DL] (or SteamTools for NMRiH)
    • IPs handling.
    • Custom kick message.
    • Possibility to remove from the text file a SteamID/IP.
    • Uses a trie rather than an array :
      • Dynamic size (not fixed at 256).
      • Tries have faster lookup time; meaning faster joining (should be a notable change with thousands of IPs / SteamIDs thought). See this if you don't know anything.
      • Since I'm using a trie, using sm_whitelist_list reads from the file rather than the loaded whitelist, since trie cannot be iterated... .
    • Possibility to have different whitelist files and load the one you want. Just change the appropriate ConVar.
    • When adding a client, the information regarding the admin that logged the client is in the whitelist file (name, steamId, IP).

    How to install :
    • Place serverwhitelistadvanced.smx in the plugin folder.
    • Install SteamWorks[DL] if you want Steam Groups support. (Or SteamTools for NMRiH)
    • [Optional] Place whitelist.txt in addons\sourcemod\configs\whitelist\ (will be created if you don't have it)
      • If you placed whitelist.txt : Edit whitelist.txt to your liking by adding Steam-Ids/Ips/small-Steam-Group-Ids
      • If you didn't place whitelist.txt : Either launch your server and do many sm_add "[STEAM_ID]/[IP]/[STEAM_GROUP_ID]", or launch your server, modify whitelist.txt and do sm_whitelist_reload .

    CVars :
    Code:
    // Enable server whitelist
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    whitelist "1"
    
    // Allows people to join if they are not whitelisted under a certain condition. 0=Nop, 1=Someone is whitelisted, 2=An admin is present (_immunity needed), 3=Someone is present.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "3.000000"
    whitelist_autovouch "0"
    
    // Minimum time in seconds before a non-whitelisted first-time-in-map-user is kicked if no voucher (defined by _autovouch value) are present; to give time to voucher to join on mapchange. It is a minimum if Steam groups are used; if not it is a normal timeout
    // -
    // Default: "2.0"
    // Minimum: "0.100000"
    whitelist_autovouch_mintimeout "2.0"
    
    // File name to use for the whitelist, in the sourcemod/configs/whitelist/ folder. Can't use '/' or '\'. With extension.
    // -
    // Default: "whitelist.txt"
    whitelist_filename "whitelist.txt"
    
    // Automatically grant admins access. Required for _autovouch = 2.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    whitelist_immunity "1"
    
    // Message to show to kicked clients.
    // -
    // Default: "You are not in the server's whitelist"
    whitelist_kickmessage "You are not in the server's whitelist"
    
    // Log failed-attempts to join server. 0=No, 1=Yes (always), 2=Yes (not after first time)
    // -
    // Default: "1.0"
    whitelist_log "1.0"
    
    // When removing someone from whitelist, update the .txt right away (expensive operation if big whitelist) ? 0= On map end. Def. 1=Yes.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    whitelist_removeinstant "1"
    
    // Also read SteamGroupIds from whitelist file ? 0=No. 1=Yes (Default; need SteamTools).
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    whitelist_steamgroup "1"
    
    // Maximum number of retry to do before saying someone is blacklisted. 'whitelist_steamgroup_timeout' seconds between each retry. ; Put '-1' for unlimited retry. Doing so should make people not be kicked in case Valve never respond (i.e. they have technical problems)
    // -
    // Default: "-1"
    // Minimum: "-1.000000"
    whitelist_steamgroup_retry "-1"
    
    // Time (in seconds) before re-requesting SteamGroups status from Valve's server (sometimes Valve doesn't answer).
    // -
    // Default: "0.34"
    // Minimum: "0.010000"
    whitelist_steamgroup_timeout "0.34"
    
    // Use whitelist_kickmessage through tidykick ? 0=No (Default; need TidyKick). 1=Yes.
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    whitelist_tidykick "0"
    Notes :
    • SteamGroups needs SteamTools with NMRIH at the moment. Other mods should use SteamWorks.
    • SourceBans is making this plugin not work ?
    • To use Steam Groups, you will need SteamWorks[DL] (or SteamTools (DL link in the post)).
    • To get a group small-Steam-group-id :
      • Go to "http://steamcommunity.com/groups/{YOUR GROUP NAME}/memberslistxml/?xml=1"
      • Copy the value between the "groupID64" html tag.
      • Substract 103582791429521408 from that value. The result is the small-Steam-group-id value.
    • If you're under linux, you may need to have writing privilege so you can create another file in addons\sourcemod\configs\ and addons\sourcemod\configs\whitelist\ folder.
    • When executing the plugin, if you don't have the file, it will be automaticly created in addons\sourcemod\configs\whitelist\ folder.
    • Whitelisted-by-steam-group people, as well as blacklisted-by-steam-group people's SteamIds are cached, to prevent making too much request to Valve' servers. Also, I did limit the number of Steam Groups to 8. Modify line 21 to your own discretion. I did not test with a big number of groups (as this would spam Valve's server).
    • If you're looking to compile locally, you'll need all three SteamWorks, SteamTools and TidyKick .inc
    • Aside from compiling, Tidy Kick is NOT needed.
    • Aside from compiling AND using SteamGroups, SteamWorks/SteamTools aren't needed.

    --------------

    Any suggestions/comments on the code or the plugin are welcomed and appreciated.

    Credits to :
    • StevoTVR : Initial idea.
    • Franc1sco : Lot of suggestions regarding this plugin.
    • asherkin : His fox's SteamTools.
    • asherkin (again) : (previously) for his Steam Group URL to Steam GroupId.
    • midnight9 : Suggesting autovouchers (indirectly).
    • Dr. Greg House : Helping with tests.
    • KyleS : For his SteamWorks.
    • Bl4nk : For his post regarding how to calculate small-Steam-group-id.

    Changelog :
    • 1.0.0 Initial release. (01-11-2012)
    • 1.0.1 (02-11-2012)
      • Client is kicked sooner. He won't be able to download files.
      • (OnClientPostAdminCheck-->OnClientAuthorized)
      • Thanks to Franc1sco for the info/tip.
    • 1.1.0 (15-11-2012)
      • Added Steam Groups support. See convars whitelist_steamgroup, whitelist_steamgroup_timeout, whitelist_steamgroup_retry.
      • Doing additional checks for the validity of an IP.
      • Added custom kicking message. See convar whitelist_kickmessage.
      • Added logging for when someone is kicked. See convar whitelist_log.
      • Changed directory of whitelist file, so a malicious (or dumb) admin doesn't rewrite over important files. New default whitelist file will be in sourcemod/configs/whitelist/ rather than sourcemod/configs. Folder will be automaticly created if you do not have it.
    • 1.1.1 Fixed logging the wrong thing when changing kick message. (29-11-2012)
    • 1.2.0 (19-12-2012)
      • Fixed bug when using a mod not supported by Steam Tools (plugin wouldn't load :$, sorry for that). Natives weren't marked as optional.
      • Added Forward OnClientKickedPre_ServerWhitelistAdvanced. This can be used to deny someone from being kicked.
      • Added natives IsClientWhitelistStatusPending, IsSteamIdWhitelisted, IsIPWhitelisted, IsSteamGroupWhitelisted, IsSteamIdWhitelistCached, IsSteamIdBlacklistCached.
      • See serverwhitelistadvanced.inc for more information concerning that development stuff.
      • Added support for TidyKick (if you don't want "Disconnect:" in front of your kick message). See ConVar "whitelist_tidykick".
      • If you want to compile locally at this time, you'll need the tidykick.inc attached to this post, as the one given by Dr. MacKay doesn't Mark natives as optional correctlyDr. MacKay fixed his. You'll also need serverwhitelistadvanced.inc. Both goes in the /include/ folder.
    • 1.2.1 (13-11-2013)
      • MarkNativeAsOptional now in AskPluginLoad2
      • Using USE_CUSTOM_STEAMID rather than -1
      • Using strncmp in strStartsWith
      • Checking return value of all GetClientAuthString and GetClientIP
      • Added quotes for the logged message when changing kick message.
    • 1.3.0 (07-03-2015)
      • Added autovouch (see whitelist_autovouch and whitelist_autovouch_mintimeout). It is now possible to let non-whitelisted player join if a whitelist player or an admin is present. Disabled by default.
      • Added support for AuthId_Steam3 ([U:1:234567] steamId format)
      • Fixed a possible bug in sm_whitelist_exist when checking a Steam Group Id (bug present from 1.1.0 to 1.2.1)
      • Fixed a bug in sm_whitelist_remove when removing a Steam Group Id and the players were already in the whitelist cache (Steam Group status validation wouldn't be redone; now that's the case).
      • Updated to compile with 1.7 compiler (sm_whitelist_exist bug and replaced GetClientAuthString by GetClientAuthId)
      • Changed default whitelist.txt to add a exemple of Steam3 Id (both in code and in attachment.
    • 1.3.1 (07-03-2015)
      • Added "invasive" autovoucher (whitelist_autovouch = 3).
      • This makes people temporarily whitelisted as long as there is someone whitelisted (even temporarily).
    • 1.4.0 (10-03-2015)
      • Added SteamWorks[DL] support. This allows Steam groups usage in the newly SteamWorks-supported mods CSGO & L4D(2) (previously only TF2/CSS/DODS). Need to use 'whitelist_steamgroup 2' for SteamWorks, which is also the new default for whitelist_steamgroup.
      • SteamWorks fallback on SteamTools if possible. Note however that it is NOT recommended to run both (even though it works ^^).
      • Changed default whitelist.txt so it doesn't have a groupId too big (last one did)
      • Fixed reading too-big small SteamGroup id, as they were causing problem (this caused spam to Valve server)
      • Slightly optimized/improved reading whitelist.txt (whitespace, logging big int)
      • Changed the way Steam groups are added to avoid too big groupId
      • Fixed an improbable bug/exploit with autovouchers == 3
        Spoiler
      • Slightly optimized autovouchers == 3
    • 1.4.0b Changed sm_whitelist_reload command description to bring awareness to the fact that it can invalidate SteamGroups cache (might be needed if someone is recently added). Cache is automatically invalidated when map changes. (10-03-2015)
    • 1.4.1 Fixed an improbable bug with hibernation where a reconnecting client (after waking up the server) would trigger KillTimer on an invalid timer at L255. Discovered in NMRIH (Steam Groups do NOT work in NMRIH), but I expect the problem to be possible in CSGO. (14-03-2015)
    • Renamed sampleDenyKick.sp to dev_sampleDenyKick.sp .(28-06-2015)
    • 1.5.0 Added sm_whitelist_resettodefault : Delete the current whitelist and recreate the default one, and reworked a ReplyToCommand. (12-11-2015)

    Todo list :
    • Add cURL (for NMRIH notably) ? That way you can choose if you want to load a possibly huge file and update it whenever a steam group is updated or get it automatically. The disadvantages of this method would be to have to reload all users in the Steam group, since someone could have just joined a group.
    • -----
    • Change whitelist representation (KV ?); kind of comes with next point :
    • Add supports for STEAMID64 for users (I'm sure some game will come up with it); I might wait for SM 2.0, as uint64 type will make it really easy
    • -----
    • MySQL ? (considered; but not even requested yet... and SteamGroups can easily replace that as it can whitelist tons of people)
    • -----
    • I won't add a group blacklist, since player invited to a group are considered in the group.
    • ^As of 14-09-2013, it is still the same behaviour (thanks Asherkin).
    • -----
    • By pass SteamId check wait ?
    • -----
    • multiple steamids addition through comma separated or other means
    Attached Files
    File Type: inc serverwhitelistadvanced.inc (2.1 KB, 2364 views)
    File Type: txt whitelist.txt (453 Bytes, 2835 views)
    File Type: sp Get Plugin or Get Source (dev_sampleDenyKick.sp - 2976 views - 279 Bytes)
    File Type: sp Get Plugin or Get Source (serverwhitelistadvanced.sp - 2103 views - 48.6 KB)
    File Type: smx serverwhitelistadvanced.smx (22.0 KB, 3404 views)
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 06-16-2017 at 19:59. Reason: 368dev/336sp/477smx/324txt ; [email protected]
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 11-01-2012 , 21:06   Re: [Any] Server Whitelist Advanced
    Reply With Quote #2

    Suggestion:

    change "public OnClientPostAdminCheck(client)" for "public OnClientAuthorized(client, const String:auth[])"

    This prevent that the client can download files and the kick is more instant (and include auth)
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-01-2012 , 21:26   Re: [Any] Server Whitelist Advanced
    Reply With Quote #3

    Quote:
    Originally Posted by Franc1sco View Post
    Suggestion:

    change "public OnClientPostAdminCheck(client)" for "public OnClientAuthorized(client, const String:auth[])"

    This prevent that the client can download files and the kick is more instant (and include auth)
    http://docs.sourcemod.net/api/index....d=show&id=394&

    Quote:
    Called when a client receives a Steam ID. The state of a client's authorization as an admin is not guaranteed here. Use OnClientPostAdminCheck() if you need a client's admin status. This is called by bots, but the ID will be "BOT".
    I need admin status. Thanks thought.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 11-01-2012 , 21:58   Re: [Any] Server Whitelist Advanced
    Reply With Quote #4

    Quote:
    Originally Posted by RedSword View Post
    http://docs.sourcemod.net/api/index....d=show&id=394&



    I need admin status. Thanks thought.
    LOL I used it in a plugin like this.

    Ok, You could always use it if you do not use Immunity.

    Or you could make that the plugin added to the whitelist before to all administrators, no?
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-01-2012 , 22:03   Re: [Any] Server Whitelist Advanced
    Reply With Quote #5

    Quote:
    Originally Posted by Franc1sco View Post
    LOL I used it in a plugin like this.

    Ok, You could always use it if you do not use Immunity.

    Or you could make that the plugin added to the whitelist before to all administrators, no?
    Mmmm... I don't know how to get admins list (MySQL + .txt + SQLite altogether) maybe...

    I just saw that "DumpAdminCache" exist. I wonder where it does dump...

    I'll have some test to do. I could always do SQL queries with MySQL and SQLite, but the point of this was to avoid that lol =3.

    Thanks for the idea.

    EDIT : FindAdminByIdentity
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 11-01-2012 at 22:07.
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 11-01-2012 , 23:06   Re: [Any] Server Whitelist Advanced
    Reply With Quote #6

    A large number of suggestions:

    -Possibility of convert whitelist to blacklist (I did this for a plugin, something like a ban with custom message )
    -Add a cvar for change msg of kick, For example: "only people of X clan"
    -Add steamtools support for allow people of X steam group, or maybe allow people with X clan tag (allow o disallow, remember first suggestion)
    -Add natives for developers, for example (OnClientKickForWhitelist) or (IsClientInList)
    -Add option of ban 1 minute to people kicked to prevent that they reconnect several times (spam)
    -Add option for log kick in a file


    If you add all that, this plugin would go from being used by a few people ,to being used for several people (perhaps myself included)
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.


    Last edited by Franc1sco; 11-01-2012 at 23:08.
    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-01-2012 , 23:22   Re: [Any] Server Whitelist Advanced
    Reply With Quote #7

    Quote:
    Originally Posted by Franc1sco View Post
    A large number of suggestions:

    -Possibility of convert whitelist to blacklist (I did this for a plugin, something like a ban with custom message )
    -Add a cvar for change msg of kick, For example: "only people of X clan"
    -Add steamtools support for allow people of X steam group, or maybe allow people with X clan tag (allow o disallow, remember first suggestion)
    -Add natives for developers, for example (OnClientKickForWhitelist) or (IsClientInList)
    -Add option of ban 1 minute to people kicked to prevent that they reconnect several times (spam)
    -Add option for log kick in a file


    If you add all that, this plugin would go from being used by a few people ,to being used for several people (perhaps myself included)
    I won't take the first one, but the rest is pretty good. Thanks for the suggestion.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 11-01-2012 at 23:25.
    RedSword is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 11-01-2012 , 23:33   Re: [Any] Server Whitelist Advanced
    Reply With Quote #8

    Quote:
    Originally Posted by RedSword View Post
    I won't take the first one, but the rest is pretty good. Thanks for the suggestion.
    The first suggestion would be very useful as it would give a different plugin utility. Some reason for not add?
    __________________
    Veteran Coder -> Activity channel
    Coding on CS2 and taking paid and free jobs.

    Contact: Steam, Telegram or discord ( franug ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-02-2012 , 00:00   Re: [Any] Server Whitelist Advanced
    Reply With Quote #9

    It's supposed to be a whitelist...

    You can always Ban people, which is in itself a kind-of blacklist. I don't see why restrict server access to non-admin, and blocking people from a SteamGroup would be dumb since they can simply leave it. (why a blacklist ?)

    But yeah since the code could be almost the same that could be doable, but I don't see the point...

    EDIT : Changed OnClientPostAdminCheck to OnClientAuthorized. Released 1.0.1. Thanks Franc1sco.

    RE-EDIT : I also realized using SteamGroups would be a breach (people could still download; since the check isn't instant (you need to query Valve servers) ). But I do plan on adding them.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 11-02-2012 at 01:46.
    RedSword is offline
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-05-2012 , 02:28   Re: [Any] Server Whitelist Advanced (1.0.1)
    Reply With Quote #10

    Hi guys,

    just wanting to know for people interested in a Steam Groups whitelist, would you use only one steam group or many for the white list ? (i.e. whitelist all people in groups "Sourcemod", "MyCommunity" and "RandomGroup") ? Also do you think you could get an extremely high number of groups ?

    I plan on making something like a static limit of 16/32 groups. The thing is, it needs to query Valve server, and I don't plan on making over9000 requests per users...
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work
    RedSword is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 09:42.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode