Skip to content

Commit

Permalink
Update clientcheckban setting to ban serial instead of IP (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Viude authored Jun 19, 2024
1 parent c733b69 commit fa5beb9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 27 deletions.
56 changes: 38 additions & 18 deletions [admin]/admin/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,46 @@
desc="Duration options for the mute window. Comma seperated list in seconds. 0 means no duration limit."
/>

<setting name="*securitylevel" value="2"
friendlyname="Security level"
group="_Advanced"
accept="0-2"
desc="Detect fake admin packets. 0-No checks 1-Some checks 2-All checks."
/>

<setting name="*clientcheckban" value="false"
friendlyname="clientcheckban"
group="_Advanced"
accept="true,false"
desc="Ban IP's that attempt to send fake admin packets."
/>

<setting name="*useip2c" value="true"
friendlyname="useip2c"
group="_Advanced"
accept="true,false"
desc="When enabled, admin will use the ip2c resource to determine players' countries by their IP."
/>

<setting name="*fakePacketsIPban" value="false"
friendlyname="IPBan"
group="_fake packets"
accept="true,false"
desc="Ban IPs that attempt to send fake admin packets."
/>

<setting name="*fakePacketsSerialban" value="false"
friendlyname="Serialban"
group="_fake packets"
accept="true,false"
desc="Ban serials that attempt to send fake admin packets."
/>

<setting name="*fakePacketsIPbanLength" value="86400"
friendlyname="IPBan length"
group="_fake packets"
desc="Set ban length for IPBan in seconds. Set to 0 for a permanent ban."
/>

<setting name="*fakePacketsSerialbanLength" value="86400"
friendlyname="Serialban length"
group="_fake packets"
desc="Set ban length for Serialban in seconds. Set to 0 for a permanent ban."
/>

<setting name="*securitylevel" value="2"
friendlyname="Security level"
group="_fake packets"
accept="0-2"
desc="Detect fake admin packets. 0-No checks 1-Some checks 2-All checks."
/>

<setting name="*maxchatmsgs" value="10"
friendlyname="Max chat log messages"
accept="1-1000"
Expand All @@ -171,10 +190,11 @@
friendlyname="Player report categories"
desc="List of report categories for reporting players."
/>
<setting name="*adminChatCommandName" value="a"
friendlyname="Admin chat command name"
desc="The command name for admin chat."
/>

<setting name="*adminChatCommandName" value="a"
friendlyname="Admin chat command name"
desc="The command name for admin chat."
/>

</settings>
</meta>
10 changes: 7 additions & 3 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1670,11 +1670,15 @@ function checkClient(checkAccess,player,...)
if client and client ~= player then
local desc = table.concat({...}," ")
local ipAddress = getPlayerIP(client)
local playerSerial = getPlayerSerial(client)
local banReason = "admin checkClient (" .. tostring(desc) .. ")"
outputDebugString( "Admin security - Client/player mismatch from " .. tostring(ipAddress) .. " (" .. tostring(desc) .. ")", 1 )
cancelEvent()
if g_Prefs.clientcheckban then
local reason = "admin checkClient (" .. tostring(desc) .. ")"
addBan ( ipAddress, nil, nil, root, reason )
if g_Prefs.fakePacketsIPban then
addBan ( ipAddress, nil, nil, root, banReason, g_Prefs.fakePacketsIPbanLength )
end
if g_Prefs.fakePacketsSerialban then
addBan ( nil, nil, playerSerial, root, banReason, g_Prefs.fakePacketsSerialbanLength )
end
return true
end
Expand Down
15 changes: 9 additions & 6 deletions [admin]/admin/server/admin_serverprefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
---------------------------------------------------------------------------
function cachePrefs()
g_Prefs = {}
g_Prefs.maxmsgs = getNumber('maxmsgs',99)
g_Prefs.bandurations = getString('bandurations','60,3600,43200,0')
g_Prefs.mutedurations = getString('mutedurations','60,120,300,600,0')
g_Prefs.maxmsgs = getNumber('maxmsgs',99)
g_Prefs.bandurations = getString('bandurations','60,3600,43200,0')
g_Prefs.mutedurations = getString('mutedurations','60,120,300,600,0')
g_Prefs.reportCategories = getString('reportCategories','Question,Suggestion,Other')
g_Prefs.playerReportCategories = getString('playerReportCategories','Cheater/Modder,Spammer')
g_Prefs.clientcheckban = getBool('clientcheckban',false)
g_Prefs.securitylevel = getNumber('securitylevel',2)
g_Prefs.maxchatmsgs = getNumber('maxchatmsgs',10)
g_Prefs.fakePacketsIPban = getBool('fakePacketsIPban',false)
g_Prefs.fakePacketsSerialban = getBool('fakePacketsSerialban',false)
g_Prefs.fakePacketsIPbanLength = getNumber('fakePacketsIPbanLength',86400)
g_Prefs.fakePacketsSerialbanLength = getNumber('fakePacketsSerialbanLength',86400)
g_Prefs.securitylevel = getNumber('securitylevel',2)
g_Prefs.maxchatmsgs = getNumber('maxchatmsgs',10)
triggerClientEvent( root, "onClientUpdatePrefs", resourceRoot, g_Prefs )
end

Expand Down

0 comments on commit fa5beb9

Please sign in to comment.