Skip to content

Commit 7199708

Browse files
committed
UI and Installer
1 parent d605b1f commit 7199708

157 files changed

Lines changed: 15077 additions & 66 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
.vs/*
2+
obj/*
13
src/.vs/*
24
src/CGeoIPModule/*
35
src/x86/*
46
src/x64/*
7+
ui-src/.vs/*
8+
ui-src/obj/*
9+
ui-src/bin/*
10+
installer/bin/*
11+
installer/.vs/*
12+
installer/obj/*
13+
packages/*

CGeoIPModule.sln

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35431.28
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CGeoIPModule", "src\CGeoIPModule.vcxproj", "{385074E6-E90C-4896-BB06-CC9D7ACF547C}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CGeoIPModuleUI", "ui-src\CGeoIPModuleUI.csproj", "{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}"
9+
EndProject
10+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "CGeoIPModuleInstaller", "installer\CGeoIPModuleInstaller.wixproj", "{620D755E-A187-405B-8734-3FCFF95CE4F3}"
11+
ProjectSection(ProjectDependencies) = postProject
12+
{385074E6-E90C-4896-BB06-CC9D7ACF547C} = {385074E6-E90C-4896-BB06-CC9D7ACF547C}
13+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD} = {6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}
14+
EndProjectSection
15+
EndProject
16+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{79DD56F8-8C78-480B-9C88-B832AEB9280A}"
17+
ProjectSection(SolutionItems) = preProject
18+
OLDREADMESTUFF.md = OLDREADMESTUFF.md
19+
README.md = README.md
20+
EndProjectSection
21+
EndProject
22+
Global
23+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
24+
Debug|Any CPU = Debug|Any CPU
25+
Debug|x64 = Debug|x64
26+
Debug|x86 = Debug|x86
27+
Release|Any CPU = Release|Any CPU
28+
Release|x64 = Release|x64
29+
Release|x86 = Release|x86
30+
EndGlobalSection
31+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
32+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|Any CPU.ActiveCfg = Debug|x64
33+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|Any CPU.Build.0 = Debug|x64
34+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|x64.ActiveCfg = Debug|x64
35+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|x64.Build.0 = Debug|x64
36+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|x86.ActiveCfg = Debug|Win32
37+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Debug|x86.Build.0 = Debug|Win32
38+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|Any CPU.ActiveCfg = Release|x64
39+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|Any CPU.Build.0 = Release|x64
40+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|x64.ActiveCfg = Release|x64
41+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|x64.Build.0 = Release|x64
42+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|x86.ActiveCfg = Release|Win32
43+
{385074E6-E90C-4896-BB06-CC9D7ACF547C}.Release|x86.Build.0 = Release|Win32
44+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|x64.ActiveCfg = Debug|Any CPU
47+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|x64.Build.0 = Debug|Any CPU
48+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|x86.ActiveCfg = Debug|Any CPU
49+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Debug|x86.Build.0 = Debug|Any CPU
50+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
51+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|x64.ActiveCfg = Release|Any CPU
53+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|x64.Build.0 = Release|Any CPU
54+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|x86.ActiveCfg = Release|Any CPU
55+
{6FDF6411-6224-4CD7-A5E5-7F539DEF72CD}.Release|x86.Build.0 = Release|Any CPU
56+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|Any CPU.ActiveCfg = Debug|x64
57+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|Any CPU.Build.0 = Debug|x64
58+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x64.ActiveCfg = Debug|x64
59+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x64.Build.0 = Debug|x64
60+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x86.ActiveCfg = Debug|x86
61+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x86.Build.0 = Debug|x86
62+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|Any CPU.ActiveCfg = Release|x64
63+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|Any CPU.Build.0 = Release|x64
64+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x64.ActiveCfg = Release|x64
65+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x64.Build.0 = Release|x64
66+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x86.ActiveCfg = Release|x86
67+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x86.Build.0 = Release|x86
68+
EndGlobalSection
69+
GlobalSection(SolutionProperties) = preSolution
70+
HideSolutionNode = FALSE
71+
EndGlobalSection
72+
GlobalSection(ExtensibilityGlobals) = postSolution
73+
SolutionGuid = {CB5E7E79-A526-48FB-96C0-7C35D4A022BF}
74+
EndGlobalSection
75+
EndGlobal

OLDREADMESTUFF.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Installation
2+
3+
- copy `CGeoIPModule.xml` to `%windir%\System32\inetsrv\config\schema`
4+
5+
- edit `%windir%\System32\inetsrv\config\applicationHost.config` and find the line
6+
7+
```xml
8+
<sectionGroup name="system.webServer">
9+
```
10+
and add `<section name="CGeoIPModule" />`
11+
12+
copy `CGeoIPModule.dll` to `%windir%\System32\inetsrv`
13+
14+
install via IIS dialogs (Server->Modules->Configure Native Modules->Register)
15+
16+
## Usage
17+
18+
action options
19+
- `Not Found`
20+
- `Close`
21+
- `Forbidden`
22+
- `Unauthorized`
23+
- `Reset`
24+
25+
example usage `web.config` to block one country
26+
```xml
27+
<system.webServer>
28+
...
29+
<CGeoIPModule enabled="true" action="Not Found" allowListed="false" path="C:\GeoIP\GeoIP-country.mmdb">
30+
<CountryCodes>
31+
<clear />
32+
<add code="CN" />
33+
</CountryCodes>
34+
</CGeoIPModule>
35+
...
36+
```
37+
38+
example usage `web.config` to allow only one country
39+
```xml
40+
<system.webServer>
41+
...
42+
<CGeoIPModule enabled="true" action="Not Found" allowListed="true" path="C:\GeoIP\GeoIP-country.mmdb">
43+
<CountryCodes>
44+
<clear />
45+
<add code="US" />
46+
</CountryCodes>
47+
</CGeoIPModule>
48+
...
49+
```
50+
51+
or perhaps you just want the server variable to be set for easy retireval from server scripting, just set allowListed to false with no country code's selected
52+
```xml
53+
<system.webServer>
54+
...
55+
<CGeoIPModule enabled="true" allowListed="false" path="C:\GeoIP\GeoIP-country.mmdb">
56+
<CountryCodes>
57+
<clear />
58+
</CountryCodes>
59+
</CGeoIPModule>
60+
...
61+
```

README.md

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,13 @@
22
_Geoblocking module for IIS written in native C++_
33

44
This is my first real dive into C++! If you notice ive done something incorrectly within this code, please do point it out or make a PR!
5-
6-
## Installation
7-
8-
- copy `CGeoIPModule.xml` to `%windir%\System32\inetsrv\config\schema`
95

10-
- edit `%windir%\System32\inetsrv\config\applicationHost.config` and find the line
11-
12-
```xml
13-
<sectionGroup name="system.webServer">
14-
```
15-
and add `<section name="CGeoIPModule" />`
16-
17-
copy `CGeoIPModule.dll` to `%windir%\System32\inetsrv`
18-
19-
install via IIS dialogs (Server->Modules->Configure Native Modules->Register)
6+
## Installation
207

21-
## Usage
8+
Grab the latest installer from the releases page
229

23-
action options
24-
- `Not Found`
25-
- `Close`
26-
- `Forbidden`
27-
- `Unauthorized`
28-
- `Reset`
29-
3010
Server variable `GEOIP_COUNTRY` will contain the iso country code on successful lookup, `ZZ` for local addresses as defined by the `IsLocalAddress()` function or `--` for unsuccessful lookups
3111

32-
example usage `web.config` to block one country
33-
```xml
34-
<system.webServer>
35-
...
36-
<CGeoIPModule enabled="true" action="Not Found" allowListed="false" path="C:\GeoIP\GeoIP-country.mmdb">
37-
<CountryCodes>
38-
<clear />
39-
<add code="CN" />
40-
</CountryCodes>
41-
</CGeoIPModule>
42-
...
43-
```
44-
45-
example usage `web.config` to allow only one country
46-
```xml
47-
<system.webServer>
48-
...
49-
<CGeoIPModule enabled="true" action="Not Found" allowListed="true" path="C:\GeoIP\GeoIP-country.mmdb">
50-
<CountryCodes>
51-
<clear />
52-
<add code="US" />
53-
</CountryCodes>
54-
</CGeoIPModule>
55-
...
56-
```
57-
58-
or perhaps you just want the server variable to be set for easy retireval from server scripting, just set allowListed to false with no country code's selected
59-
```xml
60-
<system.webServer>
61-
...
62-
<CGeoIPModule enabled="true" allowListed="false" path="C:\GeoIP\GeoIP-country.mmdb">
63-
<CountryCodes>
64-
<clear />
65-
</CountryCodes>
66-
</CGeoIPModule>
67-
...
68-
```
69-
7012
## Building
7113

7214
- Get libmaxminddb
@@ -79,12 +21,16 @@ cmake --build . --config Release --target install
7921

8022
- Download and install Windows SDK.
8123

82-
- Build project with Visual Studio (I use 2022)
24+
- Get [Wix](https://github.com/wixtoolset/wix3/releases)
25+
26+
- Get [Wix Extension for VS2022](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension)
27+
28+
- Build project with Visual Studio
8329

8430
## Reason for this modules existence
8531
I have been using the [GeoIP2blockModule](https://github.com/RvdHout/IIS-GeoIP2block-Module) for several years, and while its a well written solution, it is a bit slower (probably due to the introduction of asp.net into the request pipeline)
8632

87-
This module has much lower impact on IIS's performance, making it more suitable to sites that see heavy load. Though it does lack a nice UI in IIS manager
33+
This module has much lower impact on IIS's performance, making it more suitable to sites that see heavy load.
8834

8935
## Bombardier results
9036
1.39 KB static file for testing (small to emphasize transactional throughput)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35431.28
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "CGeoIPModuleInstaller", "CGeoIPModuleInstaller.wixproj", "{620D755E-A187-405B-8734-3FCFF95CE4F3}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x64.ActiveCfg = Debug|x64
17+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x64.Build.0 = Debug|x64
18+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x86.ActiveCfg = Debug|x86
19+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Debug|x86.Build.0 = Debug|x86
20+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x64.ActiveCfg = Release|x86
21+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x64.Build.0 = Release|x86
22+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x86.ActiveCfg = Release|x86
23+
{620D755E-A187-405B-8734-3FCFF95CE4F3}.Release|x86.Build.0 = Release|x86
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {423E59BA-465B-45F8-8B54-FC4E138ADB3A}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>3.10</ProductVersion>
7+
<ProjectGuid>620d755e-a187-405b-8734-3fcff95ce4f3</ProjectGuid>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<OutputName>CGeoIPModuleInstaller</OutputName>
10+
<OutputType>Package</OutputType>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13+
<OutputPath>bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
15+
<DefineConstants>Debug</DefineConstants>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
18+
<OutputPath>bin\$(Configuration)\</OutputPath>
19+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
22+
<DefineConstants>Debug;</DefineConstants>
23+
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
24+
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
25+
<SuppressAllWarnings>False</SuppressAllWarnings>
26+
<Pedantic>True</Pedantic>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
29+
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
30+
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Compile Include="Product.wxs" />
34+
</ItemGroup>
35+
<ItemGroup>
36+
<WixExtension Include="WixUtilExtension">
37+
<HintPath>C:\Program Files (x86)\WiX Toolset v3.14\bin\WixUtilExtension.dll</HintPath>
38+
<Name>WixUtilExtension</Name>
39+
</WixExtension>
40+
</ItemGroup>
41+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
42+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
43+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
44+
<Error Text="The WiX Toolset v3.11 build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/v3.11/stable" />
45+
</Target>
46+
<!--
47+
To modify your build process, add your task inside one of the targets below and uncomment it.
48+
Other similar extension points exist, see Wix.targets.
49+
<Target Name="BeforeBuild">
50+
</Target>
51+
<Target Name="AfterBuild">
52+
</Target>
53+
-->
54+
</Project>

0 commit comments

Comments
 (0)