Skip to content

Commit

Permalink
Add ban and moderation info.
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmacdonald committed Jun 14, 2024
1 parent 4b2ab10 commit 2be0484
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 64 deletions.
28 changes: 0 additions & 28 deletions docs/docs/devel/STATS.md

This file was deleted.

4 changes: 1 addition & 3 deletions docs/docs/devel/BUILD.md → docs/docs/devel/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ the project into distinct sentry projects.

### Backend

After creating your backend project you can copy and paste the url shown into `gbans.yml`
under the `logging.sentry_dsn` key. No further configuration should be required.

TODO

### Frontend

Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions docs/docs/guide/DATABASE.md

This file was deleted.

54 changes: 54 additions & 0 deletions docs/docs/guide/bans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Ban functionality

This page outlines the various methods players can be banned. Currently, it's only possible to appeal
a steam ban. The rest are considered effectively permanent.

## Steam Bans

The standard ban usecase, banning by steam ID. Note the 2 special options for `Include Friends` and `IP Evading Allowed`.

If include friends is enabled, then all the ban recipients friends will also be banned. Friends do not receive a entry
in the ban table however, and are automatically allowed back once the parents ban is completed. The list of friends is only
updated periodically, so you may have to wait several hours for the changes to take effect and existing banned friends get
flushed.

IP evasion option allows users to connect from the same ip as a currently banned user. When not enabled, users
are automatically banned for `evasion` and their ban lengths are changed to permanent. If you want a banned users "brother"
to be able to play, then be sure to enable this.

This type of ban is the only one that allows `muting` players.

## CIDR bans

Similar to steam bans, except they also match against a [cidr](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) range.

For example, to ban a user and his entire network block, you could ban `50.60.70.0/24`. This would ban anyone connecting
from `50.60.70.0 - 50.60.70.255`.

## ASN Bans

[ANS](https://en.wikipedia.org/wiki/Autonomous_system_(Internet)) bans are probably the least used option. They should
be used with care as they can be too broad in what they ban if you are not careful. If a user connects with a range that
the banned ASN owns, the user will be kicked.


## Steam Group Bans

Ban all members of a particular steam group from connecting.

You can find a groups GID by opening the memberslist directly. You can achieve this by appending `/memberslistxml/?xml=1`
to the url of the steam group. You should end up with something like:

https://steamcommunity.com/groups/valve/memberslistxml/?xml=1

Inside here, at the top, you should see the group ID you can use for banning:

```xml
<groupID64>103582791429521412</groupID64>
```

Similar to the friends list bans, these are also updated periodically. Any changes may take a few hours to flush
through the system.

Valve does not like hitting the memberslist endpoint that often without getting rate limited. Currently there is no
protections for this, so its advised to not add too many entries for now.
2 changes: 1 addition & 1 deletion docs/docs/guide/DISCORD.md → docs/docs/guide/discord.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Here you will find an outline of the various available discord bot commands you can use.

This of course assumes you have discord integration enabled. See [INSTALL.md](../install/INSTALL.md) for details on
This of course assumes you have discord integration enabled. See [INSTALL.md](../install/install) for details on
how to enable it.

## Overview
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/guide/moderation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Moderation

50 changes: 50 additions & 0 deletions docs/docs/guide/sourcemod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Sourcemod Plugin

This covers functionality available through the gbans plugin as well as some recommended configuration options.

## In-Game Commands

| Command | Perms | Description |
|------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| gb_mod | | Sends a notification to discord (if its enabled) to the users belonging to the group configured in the "mod ping role id" discord setting. |
| gb_ban | ADMFLAG_BAN | Ban a user using in-game menu. |
| gb_reload | ADMFLAG_ROOT | Reinitializes some parts of the plugin such as authentication password. |
| gb_version | | Shows the current plugin version. |
| report | | Report a user. |

## Convars

| convar | default value | Description |
|----------------------|--------------------|---------------------------------------------------------|
| gb_core_host | localhost | Address gbans is listening on |
| gb_core_port | 6006 | Port gbans is listening on |
| gb_core_server_key | '' | Password generated by gbans to authenticate the server. |
| gb_disable_autoteam | 1 | Disallow the use of the autoteam command |
| gb_hide_connections | 1 | Dont show the connect/disconnect message to users |
| gb_stv_enable | 1 | Enable SourceTV |
| gb_auto_record | 1 | Enable automatic recording |
| gb_stv_minplayers | 1 | Minimum players on server to start recording |
| gb_stv_ignorebots | 1 | Ignore bots in the player count |
| gb_stv_timestart | -1 | Hour in the day to start recording (0-23, -1 disables) |
| gb_stv_timestop | -1 | Hour in the day to stop recording (0-23, -1 disables) |
| gb_stv_finishmap | 1 | If 1, continue recording until the map ends |
| gb_stv_path | stv_demos/active | Path to store currently recording demos |
| gb_stv_path_complete | stv_demos/complete | Path to store complete demos |

## Creating a sourcemod database user

It's recommended to create a secondary less-privileged user, especially when using servers remote of the
gbans instance. Below is an example of creating a restricted user that only has access to the tables, and functions, required
for operation.

```postgresql
CREATE ROLE sourcemod WITH LOGIN PASSWORD '<new-password>';
GRANT CONNECT ON DATABASE gbans TO sourcemod;
GRANT USAGE ON SCHEMA public TO sourcemod ;
GRANT SELECT ON
sm_config, sm_overrides, sm_group_overrides, sm_group_immunity, sm_groups,
sm_admins_groups, sm_admins TO sourcemod;
GRANT SELECT, INSERT, UPDATE, DELETE ON sm_cookie_cache, sm_cookies TO sourcemod;
GRANT EXECUTE ON FUNCTION check_ban TO sourcemod;
```
25 changes: 25 additions & 0 deletions docs/docs/guide/stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Stats Overview

Stats are generated for many game events. They are summarized into atomic matches and stores in the database. The
design goal is to have a cross between [logs.tf](https://logs.tf)
and [hlstatsx:ce](https://github.com/A1mDev/hlstatsx-community-edition).

## Compared with hlstatsx:ce

- Simpler deployments, single monolithic binary.
- Considerably better scaling performance
- Matches are committed to the database in a single transaction instead of immediately upon incoming events
- Long term tracking of who killed who is not available currently

## General Info

- Ignores showing stats from players in the match < 60 seconds
- Matches that dont have a minimum amount of players are discarded
- Matches are

## How stats are generated (new, WIP)

1. gbans checks for new demos.
2. If a demo exists, download it locally or stop.
3. Demo is uploaded to the [parsing service](https://github.com/leighmacdonald/tf2_demostats) (avail soon).
4. Results are inserted into the database.
9 changes: 1 addition & 8 deletions docs/docs/install/CONFIG.md → docs/docs/install/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 2
---

# Config
# Base Configuration

## Server

Expand Down Expand Up @@ -65,13 +65,6 @@ This config file should be places in `tf/addons/sourcemod/configs/gbans.cfg`.
The server gbans server is running you should now be able to see the `[GB]` message logs in the
console. With a message like below on successful authentication with the server.
```
[GB] Using config file: addons/sourcemod/configs/gbans.cfg
[GB] Request to https://gbans.example.com/v1/auth finished with status code 200 in 0.01 seconds
[GB] Successfully authenticated with gbans server

```
## Discord
To use discord you need to [create a discord application](https://discord.com/developers/applications). You will need
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/docs/INTRO.md → docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ in golang, typescript and sourcepawn and consists of 3 major components:
- Flagging and automatic action for flagged words
- Sourcemod SQL Admins compatibility

Most of these features have some level of being toggled on/off.
Most of these features have some level of being toggled on/off so you can choose what features suits your setup best.

## Installation Guide

To get started with installation, please see the [installation guide](./install)
To get started with installation, please see the [installation](./install) guide.

## Development Guide

If you want to hack on gbans, please see the [devel](./devel) section to get started.
If you want to hack on gbans, please see the [develelopment](./devel) guide to get started.
4 changes: 2 additions & 2 deletions sourcemod/scripting/gbans.sp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void OnPluginStart()
gb_core_server_key = AutoExecConfig_CreateConVar("gb_core_server_key", "", "GBans server key used to authenticate with the service", FCVAR_NONE);

// In Game Tweaks
gb_disable_autoteam = AutoExecConfig_CreateConVar("gb_hide_connections", "1", "Dont show the disconnect message to users", FCVAR_NONE, true, 0.0, true, 1.0);
gb_hide_connections = AutoExecConfig_CreateConVar("gb_disable_autoteam", "1", "Dont allow the use of autoteam command", FCVAR_NONE, true, 0.0, true, 1.0);
gb_disable_autoteam = AutoExecConfig_CreateConVar("gb_hide_connections", "1", "Dont allow the use of autoteam command", FCVAR_NONE, true, 0.0, true, 1.0);
gb_hide_connections = AutoExecConfig_CreateConVar("gb_disable_autoteam", "1", "Dont show the disconnect message to users", FCVAR_NONE, true, 0.0, true, 1.0);

// STV settings
gb_stv_enable = AutoExecConfig_CreateConVar("gb_stv_enable", "1", "Enable SourceTV", FCVAR_NONE, true, 0.0, true, 1.0);
Expand Down

0 comments on commit 2be0484

Please sign in to comment.