37 lines
1.9 KiB
C#
37 lines
1.9 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace HanaToolbox.Config;
|
|
|
|
[JsonConverter(typeof(JsonStringEnumConverter<FirewallDecision>))]
|
|
public enum FirewallDecision { Skip, All, Ip }
|
|
|
|
public sealed class FirewallServiceEntry
|
|
{
|
|
public string Name { get; set; } = string.Empty;
|
|
public List<string> Ports { get; set; } = [];
|
|
public FirewallDecision Decision { get; set; } = FirewallDecision.Skip;
|
|
public List<string> AllowedIps { get; set; } = [];
|
|
}
|
|
|
|
public sealed class FirewallConfig
|
|
{
|
|
public bool Enabled { get; set; } = false;
|
|
public int ScheduleHour { get; set; } = 4;
|
|
public int ScheduleMinute { get; set; } = 0;
|
|
|
|
/// <summary>Whether to flush all existing rules before applying. Saved in config.</summary>
|
|
public bool FlushBeforeApply { get; set; } = false;
|
|
|
|
public List<FirewallServiceEntry> Services { get; set; } =
|
|
[
|
|
new() { Name = "SAP Web Client", Ports = ["443"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SAP HANA Database (System & Company DB)", Ports = ["30013","30015"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SAP Business One SLD", Ports = ["40000"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SAP Business One Auth", Ports = ["40020"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SAP Business One Service Layer/Cockpit", Ports = ["50000","4300"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SAP Host Agent", Ports = ["1128","1129"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SSH Remote Access", Ports = ["22"], Decision = FirewallDecision.Skip },
|
|
new() { Name = "SMB / B1_SHR (File Sharing)", Ports = ["139","445"], Decision = FirewallDecision.Skip },
|
|
];
|
|
}
|