Source2ZE / CS2Fixes

A Metamod plugin with fixes and features aimed but not limited to zombie escape
GNU General Public License v3.0
249 stars 122 forks source link

Steamid64 auth issues #294

Closed Gawnz1 closed 1 month ago

Gawnz1 commented 2 months ago

Hi,

I am having some auth issues with pTargetPlayer->GetSteamId64())

I am relying on it to allow certain steamids to connect to server and to automatically join a team. And some more logic maybe..

When I start the server it works fine (with old versions of CS2Fixes sometimes it was not even working the first time). After the map change for example with !map command, the users can't be authenticated, even admin commands return no access.

Is there any solution or other methods for the steamids?

I am using Linux (Debian 12), latest release of CS2Fixes.

xen-000 commented 2 months ago

If the authentication failed it's likely because the player(s) crashed and they have to restart steam. The only alternative is to use the unauthenticated steamid.

Gawnz1 commented 2 months ago

Thanks for the comment @xen-000

If the authentication failed it's likely because the player(s) crashed and they have to restart steam.

I am testing it myself, no crash or whatsoever. When I Spawn/Start the server, the first time it works okay, when I do change the map (no crash or errors), the auth is not okay.

The only alternative is to use the unauthenticated steamid.

By any chance I should use something like This ?

Edit: I used GetUnauthenticatedSteamId64 and it worked fine. The admin commands are still returning You don't have access to this command. after a map change tho. I can provide more information if it is needed, just tell me what should I provide.

Zeisenx commented 2 months ago

Are you running server with MultiAddonManager? I guess you are not.

Gawnz1 commented 2 months ago

@Zeisenx Nope, just the CS2Fixes and nothing else is loaded by metamod.

Zeisenx commented 1 month ago

@Zeisenx Nope, just the CS2Fixes and nothing else is loaded by metamod.

Yeah, I had same issue on my Windows server, If i join to server, works fine. But doesn't authenticated after map change. And If I reconnect to server, it works again. (I asked this issue on Source2 ZE Discord before)

I solved this using MultiAddonManager plugin, it makes reconnect client because addon download tricks, and my client is authenticated.

I don't think this is actual solution and need to be fix, but I don't know which one is actual problem is.

Gawnz1 commented 1 month ago

I don't think this is actual solution and need to be fix, but I don't know which one is actual problem is.

There was a task/CTimer to try the authentication before (which I also think that is not a good fix and a "silly timer" by commit comment).

// Steam authentication
new CTimer(1.0f, true, []()
{
    g_playerManager->TryAuthenticate();
    return 1.0f;
});

Even with the timer, there were same issues but if I remember correctly it was starting to work after some time in same situation.

I don't find the logic when I start the server and it works without problems, admin is authenticated and etc.. But after a map change everything doesn't work. Maybe on a map change or something likely we need to TryAuthenticate (not with task/CTimer)? - I may be talking dumb things here, I don't know.

Not fully sure since I am a newbie and I am just not familiar with Source2 at all.

Vauff commented 1 month ago

Can you confirm that you're seeing OnValidateAuthTicket print before Hook_ClientConnect for affected players in this instance?

e.g.:

[CS2Fixes] Hook_OnClientConnected(42, "Thenyi", 76561199291920538, "[U:1:1331654810]", "123.45.678.90:55054", 0)
[CS2Fixes] OnValidateAuthTicket: SteamID=76561199291920538 Response=0
[CS2Fixes] Hook_ClientConnect(42, "Thenyi", 76561199291920538, "123.45.678.90:55054", 0, "Connection rejected by game")
[CS2Fixes] 42 connected

This is a known issue, but has been very rare in my experience. Have not observed any mass auth breakage after map changes.

Gawnz1 commented 1 month ago

@Vauff Sorry for the delay.

I can confirm that OnValidateAuthTicket exists only when server is started for the first time. After a map change with !map e.g !map de_inferno, there is no OnValidateAuthTicket The other two Hook_OnClientConnected and Hook_ClientConnect are there and message is being displayed.

At the moment I am using g_playerManager->TryAuthenticate(); with a chat command as a workaround, so I can trigger auth process, it works from the first time.

Vauff commented 1 month ago

@Vauff Sorry for the delay.

I can confirm that OnValidateAuthTicket exists only when server is started for the first time. After a map change with !map e.g !map de_inferno, there is no OnValidateAuthTicket The other two Hook_OnClientConnected and Hook_ClientConnect are there and message is being displayed.

At the moment I am using g_playerManager->TryAuthenticate(); with a chat command as a workaround, so I can trigger auth process, it works from the first time.

Well, if you're not seeing OnValidateAuthTicket at all, then it's a different issue, though xen did just fix the issue I mentioned in https://github.com/Source2ZE/CS2Fixes/commit/0cd04be7486cae55455b84d27ca61c1af1dee0c8.

Gawnz1 commented 1 month ago

https://github.com/Source2ZE/CS2Fixes/commit/0cd04be7486cae55455b84d27ca61c1af1dee0c8 Solved it for me. Tested with 5 map changes, everything has worked as it should. :+1:

Vauff commented 1 month ago

Strange.

xyzelt commented 2 weeks ago

If server is started with valve map, there no addons. If nextmap is not from workshop, same there, no addons, but if map is from workshop there are addons. If third map is valve but there are addons, it remain, even furture maps is not from workshop. OnValidateAuthTicket occurs on conecting or if server has addons at changemap.

SV: Level loading started for 'de_dust2' CL: CLoopModeLevelLoad::MaybeSwitchToGameLoop switching to "game" loopmode with addons () SwitchToLoop game requested: id [3] addons [] <-- no addons ..... [CS2Fixes] OnValidateAuthTicket: ???? missing .... SV: Level loading started for 'fy_snow' CL: CLoopModeLevelLoad::MaybeSwitchToGameLoop switching to "game" loopmode with addons (3158166079) SwitchToLoop game requested: id [4] addons [3158166079] .... [CS2Fixes] OnValidateAuthTicket: SteamID=76561197989732586 Response=6 .... SV: Level loading started for 'de_dust2' CL: CLoopModeLevelLoad::MaybeSwitchToGameLoop switching to "game" loopmode with addons (3158166079) SwitchToLoop game requested: id [5] addons [3158166079] <-- addons remain ... [CS2Fixes] OnValidateAuthTicket: SteamID=76561197989732586 Response=6 <-- even if is valve map