SRCDS Steam group


Player rate tracking system using Linux's firewall (iptables)
#91
(02-18-2010, 05:01 PM)css Wrote:  It kicks based on median.

Why not kick it then? I check the stats, and rate_median is well below 18.
This is due to code?

Code:
    if ($player->{rate_median} > 17 &&
        $player->{rate_median} < 18.5) {
        _msg(sprintf('Alt-tab Windows immunity on low rate player ' .
                 '"%s" (address: %s) (rate median: %.1f) on "%s"',
                 $player->{uniqueid},
                 $player->{address},
                 $player->{rate_median},
                 $server->{name}));
        next;
        }
Reply
#92
(02-18-2010, 05:12 PM)fugitif Wrote:  
(02-18-2010, 05:01 PM)css Wrote:  It kicks based on median.

Why not kick it then? I check the stats, and rate_median is well below 18.
This is due to code?

Code:
    if ($player->{rate_median} > 17 &&
        $player->{rate_median} < 18.5) {
        _msg(sprintf('Alt-tab Windows immunity on low rate player ' .
                 '"%s" (address: %s) (rate median: %.1f) on "%s"',
                 $player->{uniqueid},
                 $player->{address},
                 $player->{rate_median},
                 $server->{name}));
        next;
        }

It might be. Do you see messages like "Alt-tab Windows immunity ..." in the console?

The logic in the "alt-tab immunity" is that the rate drops between 17 - 18.5 / s while in Windows. The mean rate thus drops falls to 17 - 18.5 at some point and then the player is correctly recognized as being in Windows. If the rate fluctuates in fact around 17 - 19 / s, then the chances are that the player sometimes gets median rate outside the 17 - 18.5 /s margin.

If the rate is less than 17, then the player should get kicked.
Reply
#93
Hello,
I did another test and it really kick anyone.
I put the samples at 10 and ratelimit to 18 and now 2 players who should be kicker when he does not.
84 samples should not be enough to kick?

Code:
Name          Min      Avg      Median   Max    Last  Quality  Ping  Sample  Connected
[GB]Cyberzane 12.8     14.2     14.2     15.5     14.2     LOW     94      84     2481 sec
[GB]Lilith     21.8     26.3     27.3     29.7     26.6     OK     97     84      1331 sec
[GB]๖þHºßا     9.1     10.6     10.7     12.7     10.8     LOW     110     84     1933 sec
Reply
#94
Does it say in the console that "Kick&banned PLAYER ....."?

Make sure you don't have $CONF = { ... monitoring => 1 ... }. Then also check the new variable %servers = { playerlimit => 1 }. The playerlimit means that the system doesn't kick anyone unless there are at least that number of players. That way your server stays populated even if someone has low rate.
Reply
#95
(02-20-2010, 12:15 AM)css Wrote:  Does it say in the console that "Kick&banned PLAYER ....."?

Make sure you don't have $CONF = { ... monitoring => 1 ... }. Then also check the new variable %servers = { playerlimit => 1 }. The playerlimit means that the system doesn't kick anyone unless there are at least that number of players. That way your server stays populated even if someone has low rate.

No, there is no Kick&banned in the console.
Here is my config

Code:
my %CONF = (
        logpath => "/root/ratetables/",
        sampleinterval => 10,
        bantime => 10,
        monitoring => 0,
        immunity => [
#             { steamid => 'STEAM' },
#             { steamid => 'STEAM' },
#             { uniqueid => 'Ghost' },
#             { uniqueid => 'Admin' },
#             { ip => '1.2.3.4' },
#             { ip => '^192.168.' }, # IPs 192.168.x.x
#             { ip => '^11.124.' }, # IPs 11.124.x.x
             ]
        );

Code:
my %servers = (
        1 =>
    {
        name => "L4D2 server2",
        ip => "88.191.***.**",
        port => 27016,
        rconpass => "my_p@ssword",
        fwchain => "l4dtracking2",
        htmlfile => "/var/www/l4d2/2rates.html",
        ratelimit => 17,
        playerlimit => 1,
        onlinetimelimit => 30,
        samples => 10,
        loginterval => 1,
        players => {}
    },
        2 =>
        {
        name => "L4D2 server4",
        ip => "88.191.***.**",
        port => 27018,
        rconpass => "my_p@ssword",
        fwchain => "l4dtracking4",
        htmlfile => "/var/www/l4d2/4rates.html",
        ratelimit => 17,
        playerlimit => 1,
        onlinetimelimit => 30,
        samples => 10,
        loginterval => 1,
        players => {}
    },
        3 =>
        {
        name => "L4D2 server3",
        ip => "88.191.***.**",
        port => 27017,
        rconpass => "my_p@ssword",
        fwchain => "l4dtracking3",
        htmlfile => "/var/www/l4d2/3rates.html",
        ratelimit => 17,
        playerlimit => 1,
        onlinetimelimit => 30,
        samples => 10,
        loginterval => 1,
        players => {}
    },
        4 =>
        {
        name => "L4D2 server1",
        ip => "88.191.***.**",
        port => 27015,
        rconpass => "my_p@ssword",
        fwchain => "l4dtracking1",
        htmlfile => "/var/www/l4d2/1rates.html",
        ratelimit => 17,
        playerlimit => 1,
        onlinetimelimit => 30,
        samples => 10,
        loginterval => 1,
        players => {}
    },
        5 =>
        {
        name => "L4D2 server5",
        ip => "88.191.***.**",
        port => 27019,
        rconpass => "my_p@ssword",
        fwchain => "l4dtracking5",
        htmlfile => "/var/www/l4d2/5rates.html",
        ratelimit => 17,
        playerlimit => 1,
        onlinetimelimit => 30,
        samples => 10,
        loginterval => 1,
        players => {}
        }
    );

I also change this code for rate_ok html stats :

Code:
#        $player{rate_ok} = $player{rate_median} > 60;
         $player{rate_ok} = $player{rate_median} > 17;

And here is a log of a player whom shall be the kick

Code:
Name          Min      Avg      Median   Max    Last  Quality  Ping  Sample  Connected
[GB]Lilith     21.8     26.3     27.3     29.7     26.6     OK     97     84      1331 sec
[GB]๖þHºßا     9.1     10.6     10.7     12.7     10.8     LOW     110     84     1933 sec

ratetables.log =>

Quote:[Fri Feb 19 00:21:26 2010] Map specific stats for "[GB]๖þHºßا" (map: c1m4_atrium) (userid: 69) (steamid: STEAM_1:1:********) (rate min/avg/max: 0.0 / 11.2 / 24.0) (size min/avg/max: 0 / 1114 / 2166 bytes/pkt) (ping: 93) (loss: 0) (state: active) (onlinetime: 2301) (samples: 43)
[Fri Feb 19 00:42:21 2010] Map specific stats for "[GB]๖þHºßا" (map: c1m1_hotel) (userid: 69) (steamid: STEAM_1:1:********) (rate min/avg/max: 6.9 / 7.1 / 11.3) (size min/avg/max: 715 / 660 / 1058 bytes/pkt) (ping: 75) (loss: 0) (state: active) (onlinetime: 3556) (samples: 13)
[Fri Feb 19 00:59:04 2010] Map specific stats for "[GB]๖þHºßا" (map: c1m2_streets) (userid: 69) (steamid: STEAM_1:1:********) (rate min/avg/max: 7.2 / 10.0 / 19.8) (size min/avg/max: 821 / 1008 / 2090 bytes/pkt) (ping: 84) (loss: 0) (state: active) (onlinetime: 75) (samples: 36)
[Fri Feb 19 01:24:00 2010] Map specific stats for "[GB]๖þHºßا" (map: c1m3_mall) (userid: 69) (steamid: STEAM_1:1:********) (rate min/avg/max: 7.9 / 12.5 / 18.8) (size min/avg/max: 958 / 1210 / 1854 bytes/pkt) (ping: 86) (loss: 0) (state: active) (onlinetime: 100) (samples: 84)

Here is a player with a "normal" rate :

Quote:[Fri Feb 19 00:19:30 2010] Map specific stats for "[GB]...$!ZzL@..." (map: c1m4_atrium) (userid: 48) (steamid: STEAM_1:1:********) (rate min/avg/max: 29.9 / 27.1 / 30.1) (size min/avg/max: 2466 / 2279 / 2843 bytes/pkt) (ping: 117) (loss: 0) (state: active) (onlinetime: 402) (samples: 29)
Reply
#96
Hmm.. That is weird.

I read through the code lines again and it seems the players were actually kicked based on rate_max. I changed it on the 'net version and on my own local version to the rate_median. However, it doesn't explain why the player wasn't kicked.

Enable debugging in the script by chaning the line "my $DEBUG = 0" to "my $DEBUG = 1". Then the system will print lots of stuff about what it is doing. You should see lines like: "Kicking player (address: 1.2.3.4:1234) from MyServer" and "Finished kicking ...". There will be also lots of other "useless" information about when the system opens rcon connection and stuff like that.

As a bright side I'm glad to see that the script is easy enough to make some small modifications to suit your own requirements. I'd be happy to hear some feedback about how easy it's been to find and reconfigure the required values to set eg. "LOW" or "OK" ratelimits. I haven't put too much stuff in the %CONF and %servers to keep the system easy to install, but now it seems maybe a normal ratetables.conf in addition to the script itself would be good idea. It could hold more configuration options. What do you think?
Reply
#97
Have an issue with starting a empty screen.

uses:
Code:
screen -S rates

Trying to resume the screen
Code:
screen -r rates

Get this error:
Code:
sg1:~# screen -r rates
There is a screen on:
        10782.rates     (2010-02-19 23.53.29)   (Attached)
There is no screen to be resumed matching rates.
Reply
#98
The "error" is that the screen is already attached from another console. Usually it happens if you have two SSH connections to the server and you've already opened the same screen. Then if the connection breaks the screen is left in "attached" state although the SSH connection is lost.

You can fix the problem by forcing the screen to be detached and reattached:

Code:
screen -r -DD rates

Also one of the most usable screen usage scenarios is to use "shared" screen. You can open the same screen with "screen -x rates" from two or more SSH connections. The "-x" option tells screen to allow the screen session to be shared.
Reply
#99
Can we use this script on HLDS servers? Or it's strictly for SRCDS ...
Reply
I'm not sure about HLDS. I think you could try. There shouldn't be too many differences.

It would be great if you could test it on HLDS.
Reply
(02-20-2010, 04:36 AM)css Wrote:  Hmm.. That is weird.

I read through the code lines again and it seems the players were actually kicked based on rate_max. I changed it on the 'net version and on my own local version to the rate_median. However, it doesn't explain why the player wasn't kicked.

Enable debugging in the script by chaning the line "my $DEBUG = 0" to "my $DEBUG = 1". Then the system will print lots of stuff about what it is doing. You should see lines like: "Kicking player (address: 1.2.3.4:1234) from MyServer" and "Finished kicking ...". There will be also lots of other "useless" information about when the system opens rcon connection and stuff like that.

As a bright side I'm glad to see that the script is easy enough to make some small modifications to suit your own requirements. I'd be happy to hear some feedback about how easy it's been to find and reconfigure the required values to set eg. "LOW" or "OK" ratelimits. I haven't put too much stuff in the %CONF and %servers to keep the system easy to install, but now it seems maybe a normal ratetables.conf in addition to the script itself would be good idea. It could hold more configuration options. What do you think?

I'll try the debug mode and see if I find the problem.

A bug that I found on ip immunity.
This conflicts with the rcon connection. When I put an ip in immunity, the script trying to connect it with rcon on this IP.
I have a firewall log full of test connections every 10 seconds on the ip immunized

Should rename this

Code:
my %CONF = (
        logpath => "/home/user/ratetables/",
        sampleinterval => 10,
        bantime => 1,
        monitoring => 0,
        immunity => [
             { steamid => 'STEAM_X:Y:Z' },
             { steamid => 'STEAM_1:2:3', uniqueid => "Admin" },
             { uniqueid => 'Ghost' },
             { uniqueid => 'Admin' },
             { ip => '1.2.3.4' },
             { ip => '^192.168.' }, # IPs 192.168.x.x
             { ip => '^11.124.' }, # IPs 11.124.x.x
             ]
        );

in this example

Code:
my %CONF = (
        logpath => "/home/user/ratetables/",
        sampleinterval => 10,
        bantime => 1,
        monitoring => 0,
        immunity => [
             { steamid => 'STEAM_X:Y:Z' },
             { steamid => 'STEAM_1:2:3', uniqueid => "Admin" },
             { uniqueid => 'Ghost' },
             { uniqueid => 'Admin' },
             { ip_immunity => '1.2.3.4' },
             { ip_immunity => '^192.168.' }, # IPs 192.168.x.x
             { ip_immunity => '^11.124.' }, # IPs 11.124.x.x
             ]
        );

Suggestion for improvement:

Make a help file readme
Add more stats in html file to help to find the correct rate limit.
Rate min, avg, median, max
Save the stats of players in a directory /ip/$adress.dat instead of /player_$address.dat
Here is my directory ip
Quote:~/ratetables/ip root@host:~$ ls -1 | wc -l
31363

Make a tar.gz for not having a copy / paste the script
Rename your script for each version.

Example:
ratetables_0.1.pl
ratetables_0.2.pl
...

Here are my suggestions Toungue
(02-22-2010, 03:53 AM)saintjimmygd Wrote:  Can we use this script on HLDS servers? Or it's strictly for SRCDS ...

It depends on the output of "status"
On L4D2 is like this

Quote:# userid name uniqueid connected ping loss state rate adr
# 16 1 "playername" STEAM_1:0:864**** 57:27 119 0 active 30000 86.201.***.***:27005
#end

In css is different

Quote:# userid name uniqueid connected ping loss state adr
# 16 "playername" STEAM_1:0:864**** 57:27 119 0 active 86.201.***.***:27005

No server id and client rate.
Reply
Well after many test the new version does not work for me
A player who should be kick

Code:
Name                   Avg    Median     Max     Last     Quality   Ping   Loss   Sample
[BE]jamalhansen930     14.8     14.7     16.2     14.7     LOW     95     0     57

I'll keep the old version
Reply
OK.

I'm working on the new version which will have separate files for everything. I'll probably notice if there are errors in the rate kicking limit.

I couldn't find the problem with the system trying to open RCON connection to the immunity IPs. I can't see how it's possible.
Reply
Hello,
Did you find out why the script does not kick on my server l4d2?
Reply
No. Not yet.

I've got the new version under development. It'll take some time to finish. Probably weeks instead of days.

Meanwhile it'd be nice to hear if others have similar problems as fugitif with the system not kicking.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)