Skip to content

Commit 02abfa8

Browse files
committed
Switched to using a common package for filtering
1 parent 1576e90 commit 02abfa8

File tree

4 files changed

+18
-139
lines changed

4 files changed

+18
-139
lines changed

DuplicatiIngress.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<PackageReference Include="SharpAESCrypt" Version="2.0.2" />
2424
<PackageReference Include="UuidExtensions" Version="1.2.0" />
2525
<PackageReference Include="RobotsTxtCore" Version="3.0.0" />
26+
27+
<PackageReference Include="SimpleSecurityFilter" Version="1.0.2" />
2628
</ItemGroup>
2729

2830
</Project>

Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using Serilog;
2828
using Serilog.Core;
2929
using Serilog.Events;
30+
using SimpleSecurityFilter;
3031

3132
var builder = WebApplication.CreateBuilder(args);
3233

@@ -85,6 +86,9 @@
8586

8687
builder.Services.AddHttpContextAccessor();
8788

89+
var securityconfig = builder.Configuration.GetSection("Security").Get<SimpleSecurityOptions>();
90+
builder.AddSimpleSecurityFilter(securityconfig, msg => Log.Warning(msg));
91+
8892
// Load encryption keys
8993
var encryptionKeys = builder.Configuration.GetSection("EncryptionKey")
9094
.GetChildren()
@@ -164,7 +168,7 @@
164168
};
165169
});
166170

167-
app.UseSecurityFilter();
171+
app.UseSimpleSecurityFilter(securityconfig);
168172

169173
app.MapPost("/backupreports/{token}",
170174
async ([FromServices] IngressHandler handler, [FromRoute] string token, CancellationToken ct) =>

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ The ingress server is intended to have very few moving parts and generally just
3636

3737
The following environment variables are optional, and should be considered for a production deployment:
3838

39-
| Variable | Description |
40-
| -------------------------------- | ----------------------------------------------------------------------------- |
41-
| ENVIRONMENT\_\_HOSTNAME | The server hostname for logging purposes |
42-
| ENVIRONMENT\_\_MACHINENAME | Name of the machine for logging purposes |
43-
| ENVIRONMENT\_\_REDIRECTURL | Url to redirect to when visiting the root path |
44-
| PRECONFIGUREDTOKENS\_\_STORAGE | The KVPSButter connection string to the storage that contains an IP blacklist |
45-
| PRECONFIGUREDTOKENS\_\_WHITELIST | The key that contains the IP blacklist |
46-
| PRECONFIGUREDTOKENS\_\_BLACKLIST | The key that contains the IP blacklist |
39+
| Variable | Description |
40+
| ------------------------------------- | ------------------------------------------------------------------------------ |
41+
| ENVIRONMENT\_\_HOSTNAME | The server hostname for logging purposes |
42+
| ENVIRONMENT\_\_MACHINENAME | Name of the machine for logging purposes |
43+
| ENVIRONMENT\_\_REDIRECTURL | Url to redirect to when visiting the root path |
44+
| PRECONFIGUREDTOKENS\_\_STORAGE | The KVPSButter connection string to the storage that contains an IP blacklist |
45+
| PRECONFIGUREDTOKENS\_\_WHITELIST | The key that contains the IP blacklist |
46+
| PRECONFIGUREDTOKENS\_\_BLACKLIST | The key that contains the IP blacklist |
47+
| SECURITY\_\_MAXREQUESTSPERSECONDPERIP | The maximum number of request from a single IP per second before throttling it |
48+
| SECURITY\_\_FILTERPATTERNS | Boolean toggling filtering of scanning patterns |
49+
| SECURITY\_\_RATELIMITENABLED | Boolean toggling if IP rate limiting is enabled |
4750

4851
## Setting Up Local Development Environment
4952

SecurityMiddleware.cs

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)