gmsv_gatekeeper - Lua controlled server authentication
453 replies, posted
[QUOTE=Banana Lord.;31327251]I don't think you could really do anything there sadly[/QUOTE]
Is there no way to overwrite the default banned hook with this instead of the "Password" one?
[QUOTE=Gfoose;31333898]Is there no way to overwrite the default banned hook with this instead of the "Password" one?[/QUOTE]
I doubt it, you'd probably need your own module or something of the sort.
[QUOTE=Banana Lord.;31334961]I doubt it, you'd probably need your own module or something of the sort.[/QUOTE]
Thanks anyway, Kyle.
Before i used this files when i connected to my server i did get the error SteamID Error its now gone if i join, but if i join now the server crash can someone help me out ?
I appear to be having a problem with a quickscript I wrote using Gatekeeper. It seems whenever I connect to the server, it looks to be in the middle of crashing.
Here's the code.
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
for k1, v1 in pairs(blacklist) do
for k, v in pairs(player.GetAll()) do
if v:SteamID == v1 then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Don't worry about the table, my SteamID is actually there, complete. STEAM_0:0: and everything. It seems to lag right where gatekeeper.Drop should actually fire, but I lag out instead of getting the message.
I haven't been able to get a second tester to try the server, but I'm pretty certain it's crashing. Apologies for the necropost, but this is one of the first times I've ever worked with pairs. Any help would be greatly appreciated.
EDIT: I'm also using MySQL, and gatekeeper.Drop seems to be firing FAR before I ever connect to the server. An IP is being denied connection every time the server starts up.
[QUOTE=Killer_Steel;31948320]I appear to be having a problem with a quickscript I wrote using Gatekeeper. It seems whenever I connect to the server, it looks to be in the middle of crashing.
Here's the code.
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
for k1, v1 in pairs(blacklist) do
for k, v in pairs(player.GetAll()) do
if v:SteamID == v1 then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Don't worry about the table, my SteamID is actually there, complete. STEAM_0:0: and everything. It seems to lag right where gatekeeper.Drop should actually fire, but I lag out instead of getting the message.
I haven't been able to get a second tester to try the server, but I'm pretty certain it's crashing. Apologies for the necropost, but this is one of the first times I've ever worked with pairs. Any help would be greatly appreciated.[/QUOTE]
Can you even access player.GetAll? If not use table.HasValue.
Player.GetAll() was used in the example, but I suppose I can find another work around. Thanks for the quick post.
EDIT: New code, same result.
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
for k, v in pairs(player.GetAll()) do
if table.HasValue(blacklist, v:SteamID) then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
and
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
if table.HasValue(blacklist, user:SteamID()) then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Seems gatekeeper doesn't like me very much :V. Does the hook return any useful info on call that I can use?
EDIT: Not this either.
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
if table.HasValue(blacklist, steam) then
gatekeeper.Drop(user:UserID, "Test completed.")
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Any incorrect calls I'm making? It's forcing the server to lag out.
[QUOTE=Killer_Steel;31948362]Player.GetAll() was used in the example, but I suppose I can find another work around. Thanks for the quick post.
EDIT: New code, same result.
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
for k, v in pairs(player.GetAll()) do
if table.HasValue(blacklist, v:SteamID) then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
and
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
if table.HasValue(blacklist, user:SteamID()) then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Seems gatekeeper doesn't like me very much :V. Does the hook return any useful info on call that I can use?[/QUOTE]
Try this
[lua]require("gatekeeper")
local blacklist = {"Steel"}
local function Blacklist(user, pass, steam, ip)
for k, v in pairs(player.GetAll()) do
if table.HasValue(blacklist, steam) then
gatekeeper.Drop(v:UserID, "Test completed.")
end
end
end
hook.Add("PlayerPasswordAuth", "DropTheirAsses", Blacklist)[/lua]
Doesn't v only work with pairs calls with v set as value or key, though? I'll give it a shot though.
EDIT: Just tried your code, no go. I guess there's an operation in the module that isn't quite working?
Here's what I did along time ago. FYI I got off work less than a half hour ago best to disregard my previous 2 posts.
[lua]
AllowedPlayers = { "STEAM_0:0:39962440", "STEAM_ID_LAN" }
hook.Add("PlayerPasswordAuth", "KickDemGuys", function( n, p, s, a )
if table.HasValue(AllowedPlayers, s) then
return {false, "This server runs a whitelist"}
end
end)
[/lua]
Nope. Still can't connect. The server itself isn't crashing, it's just lagging horribly.
I can't make a connection, I get the 'Connection failed after 4 retries'. This module is doing a fuck load of work in order to manage that :l.
Hey guys,
saw that a lot of you ain't checking against Invalid SteamID's. This should be the FIRST check. For example it keeps people out after Garry's Mod updates, very useful for ban systems.
[lua]
if SteamID == "STEAM_ID_UNKNOWN" then return {false, "SteamID Error."}; end
if SteamID == "STEAM_ID_PENDING" then return {false, "SteamID Error."}; end
[/lua]
Join 'Python1320' P:XXXX - STEAM_ID_UNKNOWN - 91.152.XXX.XXX:27005
Unfortunately this happens too often (like right now after the latest engine update).
You can't rely on gatekeeper alone since the SteamID can break for whatever reason.
It's better to use gatekeeper as the first line of defense and then use the game hooks as a complement.
I'll get to fixing this ASAP.
I've got classes today so I'll try to get a fix out in about 4-5 hours.
I'm also gonna look into making gatekeeper a little more tweakable with convars so that the plugin won't have to be recompiled in the future.
Have you conquered your fear of linux or will I have to bug Chrisaster for it?
All set. You can find the latest build here: [url]http://code.google.com/p/gmodmodules/source/detail?r=158[/url]
Valve bumped up the network protocol from 17 to 18 for who knows what reason.
To solve this issue in the future, I introduced some new changes.
Features of interest are two new convars:
gk_force_protocol_enable - Enables forcing the network protocol.
gk_force_protocol - Forces handling of a specific network protocol.
The idea is that when the network protocol gets bumped up again, you simply set gk_force_protocol to 17 or 18 to handle the old method. This [i]should[/i] work, but this assumes that the authentication doesn't change between protocol changes.
Additionally you can set the convar from lua with gatekeeper.ForceProtocol( number ). This will enable forcing, and set the forced protocol. You can disable forcing by passing in nil.
[QUOTE=slayer3032;32314441]Have you conquered your fear of linux or will I have to bug Chrisaster for it?[/QUOTE]
Nope. Bug Chrisaster or ComWalk.
Updated my compiled version: [B][URL="http://g.iriz.org/~srcds/modules/"]http://g.iriz.org/~srcds/modules/[/URL][/B]
It should work but use at your own risk. Just testing it on my server and seems to work fine, but I guarantee nothing as usual.
[lua]12:33 - Python1320: !l local sid=me:SteamID() hook.Add('PlayerPasswordAuth',1,function(u,p,s,i) if s:find(sid,1,true) then return {false,"GG, banned yourself moron"} end end)
] disconnect
] connect g.iriz.org
Connecting to g.iriz.org...
GG, banned yourself moron
] retry
Commencing connection retry to g.iriz.org
Connecting to g.iriz.org...
GG, banned yourself moron[/lua]
--snip--
(Removed VoiDeD's convar stuff and it stopped crashing)
Stubbed the gatekeeper.ForceProtocol on voided's update to remain compatible with custom scripts, it just won't do anything, yet. This means the next protocol update will break it again, but I'm sure someone has managed to fix the convar problem by then.
EDIT: Official fix: [url]http://gmodmodules.googlecode.com/svn/trunk/gmsv_gatekeeper/bin/gmsv_gatekeeper_linux.dll[/url]
[QUOTE=Killer_Steel;31948320]crashing related code[/QUOTE]
I am having the same issue - if a player joins with an id that is not on my whitelist, the server crashes. PlayerPasswordAuth always gives STEAM_ID_UNKNOWN but doesn't crash so I tried the regular PlayerAuthed hook.
[lua]
require("gatekeeper")
hook.Add("PlayerAuthed", "TestKicker", function (user, stid)
if !MyTable[stid] then
gatekeeper.Drop(user:UserID(), "No access")
end
end)
[/lua]
Any ideas?
[QUOTE=_nonSENSE;32569229]I am having the same issue - if a player joins with an id that is not on my whitelist, the server crashes. PlayerPasswordAuth always gives STEAM_ID_INVALID but doesn't crash so I tried the regular PlayerAuthed hook.
[lua]
require("gatekeeper")
hook.Add("PlayerAuthed", "TestKicker", function (user, stid)
if !MyTable[stid] then
gatekeeper.Drop(user:UserID(), "No access")
end
end)
[/lua]
Any ideas?[/QUOTE]
Can you paste the code you're using for the PlayerPasswordAuth hook? If it's the same as Killer_Steel's then the issue is that you're using gatekeeper.Drop instead of returning a table.
I used the following PlayedPasswordAuth hook
[lua]
require("gatekeeper")
hook.Add("PlayerPasswordAuth", "ClosedBetaKicker", function (user, pass, steam, ip)
if !nonDB.ClosedBetaIDs[steam] then
return {false, "This is a Closed Beta. Sorry."}
end
end)
[/lua]
This didn't crash, but 'steam' was always STEAM_ID_UNKNOWN, so I couldn't use it.
Using the code from above crashes the server when somebody that isn't whitelisted joins.
[QUOTE=_nonSENSE;32586921]I used the following PlayedPasswordAuth hook
[lua]
require("gatekeeper")
hook.Add("PlayerPasswordAuth", "ClosedBetaKicker", function (user, pass, steam, ip)
if !nonDB.ClosedBetaIDs[steam] then
return {false, "This is a Closed Beta. Sorry."}
end
end)
[/lua]
This didn't crash, but 'steam' was always STEAM_ID_UNKNOWN, so I couldn't use it.
Using the code from above crashes the server when somebody that isn't whitelisted joins.[/QUOTE]
Are you running the latest version of gatekeeper?
Yes, got the build from Sep 16, 2011 (4.35).
[QUOTE=_nonSENSE;32605317]Yes, got the build from Sep 16, 2011 (4.35).[/QUOTE]
The only other reason I can think of is that your server is out-of-date.
What exactly are you referring to? The cause of the crashing or the steamids being STEAM_ID_UNKNOWN?
[QUOTE=_nonSENSE;32605794]What exactly are you referring to? The cause of the crashing or the steamids being STEAM_ID_UNKNOWN?[/QUOTE]
The STEAM_ID_UNKNOWN thing.
Are you using Linux or Windows?
Windows.
Gatekeeper crashes my dedicated server (windows) on startup since last patch whenever I 'require' it. The other server which is not updated is working fine.
[code]
Illegal termination of worker thread! Threads must negotiate an end to the thread before the CThread object is destroyed.
[/code]
[QUOTE=_nonSENSE;32891155]Gatekeeper crashes my dedicated server (windows) on startup since last patch whenever I 'require' it. The other server which is not updated is working fine.
[code]
Illegal termination of worker thread! Threads must negotiate an end to the thread before the CThread object is destroyed.
[/code][/QUOTE]
Same here.
Getting: You crashed in gmsv_gatekeeper.dll with the failure INVALID_POINTER_READ_c0000005_gmsv_gatekeeper.dll!Unknown
Only got it after I updated my server with ''OB Dedicated Server' version 135'
Sorry, you need to Log In to post a reply to this thread.