Server:PublicPort=22023
Server:ListenIp=0.0.0.0
Server:listenPort=22023
+AntiCheat:BanIpFromGame=true
ServerRedirector:Enabled=false
ServerRedirector:Master=true
ServerRedirector:Locator:Redis=127.0.0.1.6379
IMPOSTOR_Server__PublicPort=22023
IMPOSTOR_Server__ListenIp=0.0.0.0
IMPOSTOR_Server__listenPort=22023
+IMPOSTOR_AntiCheat__BanIpFromGame=true
IMPOSTOR_ServerRedirector__Enabled=false
IMPOSTOR_ServerRedirector__Master=true
IMPOSTOR_ServerRedirector__Locator__Redis=127.0.0.1.6379
--- /dev/null
+namespace Impostor.Server.Config
+{
+ public class AntiCheatConfig
+ {
+ public const string Section = "AntiCheat";
+
+ public bool BanIpFromGame { get; set; } = true;
+ }
+}
\ No newline at end of file
public const string Section = "Debug";
public bool GameRecorderEnabled { get; set; }
+
public string GameRecorderPath { get; set; }
}
}
\ No newline at end of file
using Impostor.Api.Net.Messages.S2C;
using Impostor.Hazel;
using Impostor.Server.Config;
+using Impostor.Server.Net.Hazel;
using Impostor.Server.Net.Manager;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
namespace Impostor.Server.Net
{
internal class Client : ClientBase
{
private readonly ILogger<Client> _logger;
+ private readonly AntiCheatConfig _antiCheatConfig;
private readonly ClientManager _clientManager;
private readonly GameManager _gameManager;
- public Client(ILogger<Client> logger, ClientManager clientManager, GameManager gameManager, string name, IHazelConnection connection)
+ public Client(ILogger<Client> logger, IOptions<AntiCheatConfig> antiCheatOptions, ClientManager clientManager, GameManager gameManager, string name, IHazelConnection connection)
: base(name, connection)
{
_logger = logger;
+ _antiCheatConfig = antiCheatOptions.Value;
_clientManager = clientManager;
_gameManager = gameManager;
}
}
catch (ImpostorCheatException e)
{
- Player.Game.BanIp(Connection.EndPoint.Address);
+ if (_antiCheatConfig.BanIpFromGame)
+ {
+ Player.Game.BanIp(Connection.EndPoint.Address);
+ }
await DisconnectAsync(DisconnectReason.Hacking, e.Message);
}
.Get<ServerRedirectorConfig>() ?? new ServerRedirectorConfig();
services.Configure<DebugConfig>(host.Configuration.GetSection(DebugConfig.Section));
+ services.Configure<AntiCheatConfig>(host.Configuration.GetSection(AntiCheatConfig.Section));
services.Configure<ServerConfig>(host.Configuration.GetSection(ServerConfig.Section));
services.Configure<ServerRedirectorConfig>(host.Configuration.GetSection(ServerRedirectorConfig.Section));
using System.Threading.Tasks;
using Impostor.Api.Net.Messages;
+using Impostor.Server.Config;
using Impostor.Server.Net;
using Impostor.Server.Net.Hazel;
using Impostor.Server.Net.Manager;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
namespace Impostor.Server.Recorder
{
private bool _createdGame;
private bool _recordAfter;
- public ClientRecorder(ILogger<Client> logger, ClientManager clientManager, GameManager gameManager, string name, HazelConnection connection, PacketRecorder recorder)
- : base(logger, clientManager, gameManager, name, connection)
+ public ClientRecorder(ILogger<Client> logger, IOptions<AntiCheatConfig> antiCheatOptions, ClientManager clientManager, GameManager gameManager, string name, HazelConnection connection, PacketRecorder recorder)
+ : base(logger, antiCheatOptions, clientManager, gameManager, name, connection)
{
_recorder = recorder;
_isFirst = true;
"ListenIp": "0.0.0.0",
"ListenPort": 22023
},
+ "AntiCheat": {
+ "BanIpFromGame": true
+ },
"ServerRedirector": {
"Enabled": false,
"Master": true,
"ListenIp": "0.0.0.0",
"ListenPort": 22023
},
- "Debug": {
- "GameRecorderEnabled": false,
- "GameRecorderPath": ""
+ "AntiCheat": {
+ "BanIpFromGame": true
}
}
\ No newline at end of file