Author Topic: Synchronizing Bans  (Read 2701 times)

0 Members and 1 Guest are viewing this topic.

Offline Chabber

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Synchronizing Bans
« on: February 10, 2016, 02:45:39 AM »
Hey guys,

I need your swarm intelligence.

I have got following problem:
On my server i have got one directory of the SteamCMD with GMod.
Out of this directory I run 3 servers.

When the moderators of my server are banning people with the XGUI on server #1, the bans are not synchronozing with #2 and #3.
My problem is, that i need this synchronization, because the hackers or kiddies are able to join the other servers right after they got banned from one server.
I know, that the banlist is configured correctly after a server restart, but when the server is running the list is not synchronized.

I tried to do it like this way:

Code: [Select]
local function banSync()
ULib.refreshBans
--ULib.queueFunctionCall(ULib.refreshBans)
--ULib.pcallError(ULib.refreshBans)
end

timer.Create("timerBanSync", 10, 0, banSync)

It works partly. All the servers are checking the ban-file continually after 10seconds and get the Steam-ID from the file.
But (now the different parts comes) the ban parameters like reason for banning/name of player/admin who banned the user are deleted bizarelly.
When I check the banlist on another server right after banning a player on one server, the ban is shown there with no more parameters. Also the bans.txt is modified to a ban just with Steam-ID and ban-end-date.

My question here is: Is there a possibility to get the bans synchronized easily just by creating a timer with a call of an existing function or do I need more stuff?
(By the way: I do not want to use databases or other thinngs like that - just using existing functions would be great.)

I hope someone can help me.

Kind regards  :)
Chabber
« Last Edit: February 10, 2016, 02:53:47 AM by Chabber »

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Synchronizing Bans
« Reply #1 on: February 10, 2016, 08:55:32 AM »
I don't understand exactly what you mean by "out of this directory I run 3 servers". If I'm correct in assuming you're running three server instances from the same garrysmod folder: please don't. I'm surprised you haven't had a catastrophic failure yet. Garry's Mod is not meant to do this. There is no read/write protection. You're running the risk of corrupting your server at any moment.

The likely reason for your bans.txt acting bizarrely is that you have three servers accessing it. If two servers try to read from the file at roughly the same time, for example, then one of them is going to save their changes a bit after the other. The server that saved their changes first is going to have their changes overwritten.

There are many global ban addons out there. I've never used any before, but a quick google search for "garry's mod global ban" returns a few results (although they are a bit outdated). I think SourceBans is a popular option, and I'm sure there is an addon for ULib compatibility if it isn't compatible by default.

The problem (for you) is that most global bans addons use MySQL databases because usually multiple servers aren't run on one box. There might be a solution for you that doesn't utilize a database, but it's unlikely. I suggest you just use MySQL. I'm pretty sure you can set up your own MySQL server with relative ease, and renting one isn't too expensive either.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Synchronizing Bans
« Reply #2 on: February 10, 2016, 05:10:20 PM »
Besides mysql, you'll need 3 different steamcmd gmod folders (if all 3 are gmod based)
(That's simplifying what roastchicken said - don't run 3 servers from same folder)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Chabber

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Synchronizing Bans
« Reply #3 on: February 10, 2016, 09:52:35 PM »
Thanks for the suggestions.
I never had problems before with the "out of this directory I run 3 servers". And I think besides the ban synchronizing problem I have, I will not "touch the running system".
The server does not store data, the only things are the usergroups - so thank again for your tips, but I will work on the solution further :D

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Synchronizing Bans
« Reply #4 on: February 11, 2016, 03:03:30 PM »
"The server does not store data"

Yes, it most definitely does. Check your garrysmod/data folder and you will see all the data stored by your server in flatfiles. If you want you can go ahead and open up garrysmod/sv.db with a SQLite Editor like DB Browser for SQLite (only do this when the server is stopped or you risk corrupting the database) and you will see even more data stored by your server.

Sorry for being a bit rude about it, but I feel like you don't understand the true gravity of what you are doing. It is very risky.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Synchronizing Bans
« Reply #5 on: February 11, 2016, 06:57:25 PM »
Yes, indeed.
You're more than welcome to run your server the way you want.
But as your method is far beyond what Ulysses and Facepunch intended, you're likely not going to get much straight on developer support.
I know we can't offer support when something goes awry in your method, which, apparently, we've explained the issues but you're continuing in your method anyway.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming