Parameters
- from
- lower bound
- till
- upper bound
services.AddFireWall("Token", "domain key" , domainName: new Uri("https://www.test.dll", UriKind.Absolute), options => { options.JoinCustomerImprovementProgramWithEmail = "EMail@Address.com"; options.Cypher.ApplicationPassword = "123456Seven"; options.ApplicationName = "www.test.dll"; options.ApplicationTag = "WS3"; options.Rules.AllowWhiteListing = false; options.Rules.PhysicalFileWallExcludeReasons = Walter.BOM.FirewallBlockReasons.ALL & ~Walter.BOM.FirewallBlockReasons.NoAccessFromRegion; options.UseSession = false; options.Cashing.GeoLocation.SlidingExpiration = TimeSpan.FromMinutes(20); options.Rules.BlockRequest.BlockDuration.SlideExpiration = true; options.Rules.BlockRequest.BlockDuration.Expires = TimeSpan.FromSeconds(10); options.WebServices.IsUserApiUrl = new Uri(Links.IsUserEndpoint, UriKind.Relative); options.WebServices.RegisterLinksApiUrl = new Uri(Links.SiteMapEndPoint, UriKind.Relative); options.WebServices.BeaconApiUrl = new Uri(Links.BeaconPoint, UriKind.Relative); options.WebServices.CSPReportUrl = new Uri(Links.CSPViolation, UriKind.Relative); options.Rules.AllowWhiteListing = true; options.OnEndpointsCreated+= Options_OnEndpointsCreated; options.OnFireWallCreated += Options_OnFireWallCreated; options.Rules.Headers.AddDefaultSecurePolicy() .AddStrictTransportSecurityNoCache() .AddXssProtectionBlockAndReport() .AddContentSecurityPolicyButTrust(trustingSites: Walter.Web.FireWall.TrustingSites.Jquery | Walter.Web.FireWall.TrustingSites.Google , allowInline: true , framesPolicy: Walter.Web.FireWall.FramesPolicy.Self); }) .UseGeography(new System.IO.DirectoryInfo(@"D:\MaxMind")) .UseDiskLogging(options => { options.Directory = @"d:\administration\FireWall"; }) .UserDatabase(DatabaseConnections.FireWallState) .UseFireWallReportingDatabase(DatabaseConnections.FireWall) .UseSMTPReportingDatabase(DatabaseConnections.FireWallMail, options => { options.Archive = TimeSpan.FromDays(180); options.Server = "mail.asp-waf.com"; options.UserName = "noreply@domain.com"; options.Password = "Kuazuua$ki82#ksKKjsk"; options.Port = 25; options.From = "noreply@domain.com"; options.IgnoreServerCertificateErrors = true; options.DefaultEmail = "webmaster@domain.com"; options.Archive = TimeSpan.FromDays(60); options.MailingList.AddRange(new[] { new EMailAddress("Security Admin","security@domain.com") { Frequency= TimeSpan.FromHours(1), Roles= EMailRoles.FireWallAdministrationViolations | EMailRoles.UnauthorizedPhysicalFilesViolation } , new EMailAddress("Website Admin","admin@domain.com"){ Frequency= TimeSpan.FromHours(1), Roles= EMailRoles.ProductUpdates | EMailRoles.OwnAccountRelatedViolations } , }); }); //use test all requests services.AddMvc(options => options.Filters.Add<Walter.Web.FireWall.Filters.FireWallFilter>() ); //use mvc and set json options on the MVC views services.AddControllersWithViews() .AddNewtonsoftJson(options=> { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; options.SerializerSettings.Formatting = Formatting.Indented; }); } private void Options_OnEndpointsCreated(object sender, Walter.Web.FireWall.EventArguments.EndpointsCreatedEventArgs e) { foreach (var item in e.Links.EndpointsInPath("*.zip", "*.pdf")) { item.AllowAddhockAccess = true; } foreach (var item in e.Links.EndpointsInPath("*.css", "*.png","*.jpg")) { item.FirewallDisabled = true; } } private void Options_OnFireWallCreated(Walter.Web.FireWall.IFireWall firewall) { //get the configuration var json= JsonConvert.SerializeObject(firewall.Configuration); //get filename var fileName = Path.Combine(new FileInfo(this.GetType().Assembly.Location).DirectoryName,"last known good firewall configuration.json"); //tell firewall to write it to disk as uncontrolled changes to disk will raise an incident firewall.WriteFile(new FileInfo(fileName), json); //Reset any blocking rules that might have blocked Google firewall.ResetFireWallBlocking(new IPAddress("8.8.8.0"),new IPAddress("8.8.8.8")); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2