Firewall
Code examples for configuring firewall settings (enable/disable, bypass domains/processes, Killswitch, DNS monitor) using FirewallRequest.
Firewall config
Requests presented below are used for configuring the Firewall features:
Enable - enables firewall.
var request = new FirewallRequest { Enable = EmptyRequest.Empty, }
Disable - disables firewall (disabled all firewall features).
var request = new FirewallRequest { Disable = EmptyRequest.Empty, }
UpdateBypassDomains - updates bypass domain list, constructor contains:
var request = new FirewallRequest
{
UpdateBypassDomains = new UpdateBypassDomainsRequest
{
Domains = new List<string> { "domain", },
}
}
UpdateBypassProcessesRequest - updates bypass proceses list
var request = new FirewallRequest
{
UpdateBypassDomains = new UpdateBypassDomainsRequest
{
Processes = new List<string> { "PathToTheProcessExe", },
}
}
PermitProcess - adds a process to killswitch exceptions list
var request = new FirewallRequest
{
PermitProcess = new PermitProcessRequest
{
ProcessPath = "PathToTheProcessExe",
}
}
RemovePermitProcess - removes a process to killswitch exceptions list
var request = new FirewallRequest
{
RemoveProcessPermit= new RemoveProcessPermitRequest
{
ProcessPath = "PathToTheProcessExe",
}
}
EnableDnsMonitor - enables DNS monitor
var request = new FirewallRequest
{
EnableDnsMonitor = new EnableDnsMonitorRequest(),
}
DisableDnsMonitor - disables DNS monitor
var request = new FirewallRequest
{
DisableDnsMonitor = new DisableDnsMonitorRequest(),
}
GetKillSwitchState - returns killswitch state
var request = new FirewallRequest
{
GetKillSwitchState = EmptyRequest.Empty,
}
ConfigureFirewallAsync
Sends firewall configuration to the service.
var sdk = new SDK();
var request = new FirewallRequest()
{
UpdateBypassDomains = new UpdateBypassDomainsRequest()
{
Domains = new List<string>(),
},
UpdateBypassProcesses = new UpdateBypassProcessesRequest()
{
Processes = new List<string>(), },
}
}
var configureFirewallResponse = await sdk.ConfigureFirewallAsync(request).ConfigureAwait(false);
Console.WriteLine(configureFirewallResponse.UpdateBypassProcesses);
Console.WriteLine(configureFirewallResponse.UpdateBypassDomains);