Skip to content

Commit 713a3dc

Browse files
authored
Merge pull request #1200 from ITfoxtec/test
Test
2 parents bd06cf2 + 94b9ec7 commit 713a3dc

File tree

23 files changed

+177
-55
lines changed

23 files changed

+177
-55
lines changed

ReleaseConfig/FoxIDs.Control/appsettings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"Options": {
2929
"Log": "Stdout",
30+
//"Log": "OpenSearchAndStdoutErrors",
3031
"DataStorage": "MongoDb",
3132
//"DataStorage": "PostgreSql",
3233
"KeyStorage": "None",
@@ -40,6 +41,11 @@
4041
//"PostgreSql": {
4142
// "ConnectionString": "Host=localhost;Username=postgres;Password=xxxxxxxx;Database=FoxIDs"
4243
//},
44+
//"OpenSearch": {
45+
// "Nodes": [ "https://admin:xxxxxxxx@localhost:9200/" ],
46+
// "LogLifetime": "Max180Days",
47+
// "AllowInsecureCertificates": true //Accept self-signed certificate
48+
//},
4349
"MasterSeedEnabled": true,
4450
"MainTenantSeedEnabled": true
4551

ReleaseConfig/FoxIDs/appsettings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"Options": {
2828
"Log": "Stdout",
29+
//"Log": "OpenSearchAndStdoutErrors",
2930
"DataStorage": "MongoDb",
3031
//"DataStorage": "PostgreSql",
3132
"KeyStorage": "None",
@@ -37,7 +38,12 @@
3738
"ConnectionString": "mongodb://localhost:27017"
3839
},
3940
//"PostgreSql": {
40-
// "ConnectionString": "Host=localhost;Username=xxxxxxxx;Password=xxxxxxxx;Database=FoxIDs"
41+
// "ConnectionString": "Host=localhost;Username=postgres;Password=xxxxxxxx;Database=FoxIDs"
42+
//},
43+
//"OpenSearch": {
44+
// "Nodes": [ "https://admin:xxxxxxxx@localhost:9200/" ],
45+
// "LogLifetime": "Max180Days",
46+
// "AllowInsecureCertificates": true //Accept self-signed certificate
4147
//},
4248
"RequestDomainAsCustomDomain": true,
4349
"ReadLoopbackRequestDomain": true

docs/deployment-window-iis.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ This deployment include:
1818

1919
- Two websites one for FoxIDs and one for the FoxIDs Control (Admin Client and API).
2020
- The two websites are exposed on two different domains / sub-domains.
21-
- NoSQL database containing all data including tenants, environments and users. Either deploy [MongoDB Community Edition](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows/) or [PostgreSQL](https://www.postgresql.org/download/windows/).
21+
- NoSQL database containing all data including tenants, environments and users. Either deploy **MongoDB Community Edition** or **PostgreSQL**.
22+
- FoxIDs logs are default saved in files. Depending on the load, consider to use [OpenSearch](#opensearch) in production.
2223

2324
## Deployment
2425

@@ -94,11 +95,11 @@ Download the `win-acme.v2.x.x.x64.pluggable.zip` file from the latest [win-acme
9495
9596
The two websites now have `https` bindings with the certificate created by Let's encrypt and the certificate will automatically be updated for every 3 months or so.
9697
97-
### Add FoxIDs to the websites
98+
### Xcopy deploy FoxIDs to websites
9899
Download the `FoxIDs-x.x.x-win-x64.zip` file from the [FoxIDs release](https://github.com/ITfoxtec/FoxIDs/releases) and unpack the ZIP file. The zip file contains two folders one for the FoxIDs site and one for the FoxIDs Control site.
99100
100-
- Copy the zip file folder FoxIDs into the websites physical path e.g. `C:\inetpub\FoxIDs`
101-
- And copy the zip file folder FoxIDs.Control into the websites physical path e.g. `C:\inetpub\FoxIDs.Control`
101+
- Xcopy the zip file folder FoxIDs into the websites physical path e.g. `C:\inetpub\FoxIDs`
102+
- And Xcopy the zip file folder FoxIDs.Control into the websites physical path e.g. `C:\inetpub\FoxIDs.Control`
102103
103104
Configure both the FoxIDs site and the FoxIDs Control site in the `appsettings.json` files, located in e.g. `C:\inetpub\FoxIDs\appsettings.json` and `C:\inetpub\FoxIDs.Control\appsettings.json`
104105
@@ -128,15 +129,62 @@ Configure both the FoxIDs site and the FoxIDs Control site in the `appsettings.j
128129
"DataCache": "None"
129130
},
130131
"PostgreSql": {
131-
"ConnectionString": "Host=localhost;Username=postgres;Password=xxxx;Database=FoxIDs"
132+
"ConnectionString": "Host=localhost;Username=postgres;Password=xxxxxxxx;Database=FoxIDs"
132133
},
133134
```
134135
5. Optionally configure to send emails with SMTP.
135136
136137
### FoxIDs Logs
137138
FoxIDs log files are default saved in `C:\inetpub\logs\LogFiles`. You can change the path in the `web.config` file in the two websites.
138139
139-
The logs contain errors, warnings, events and trace. Depending on the load, consider using [OpenSearch](https://docs.opensearch.org/docs/latest/install-and-configure/install-opensearch/windows/) in production.
140+
The logs contain errors, warnings, events and trace.
141+
142+
### OpenSearch
143+
Depending on the load, consider to use OpenSearch in production instead of log files.
144+
145+
Download [OpenSearch](https://docs.opensearch.org/docs/latest/install-and-configure/install-opensearch/windows/) or download from the [download page](https://opensearch.org/downloads/).
146+
147+
1. Create a folder on a permanent place e.g. `C:\opensearch` on the C drive. The OpenSearch `.bat` file is subsequently registered to run in Windows Task Scheduler.
148+
2. Move the downloaded file `opensearch-x.x.x-windows-x64.zip` to the folder and unpack the file - *the file names are to log to unpack in the default download folder*
149+
3. Start a Command Prompt
150+
4. Navigate to the `opensearch-x.x.x` folder
151+
5. Set an administrator password, run `set OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>`
152+
6. Start service, run `.\opensearch-windows-install.bat`
153+
7. Start another Command Prompt
154+
8. Test the OpenSearch, run test request `curl.exe -X GET https://localhost:9200 -u "admin:<custom-admin-password>" --insecure`
155+
9. Test the OpenSearch plugins, run test request `curl.exe -X GET https://localhost:9200/_cat/plugins?v -u "admin:<custom-admin-password>" --insecure`
156+
10. Go back to the OpenSearch Command Prompt and stop OpenSearch by clicking `ctrl+c` and then `y`
157+
158+
Create a task to rune OpenSearch
159+
1. Open **Task Scheduler**
160+
2. Click **Create Task...**
161+
3. Add the **Name** `OpenSearch`
162+
4. Change the account that run the task, click **Change User or Group...**
163+
5. Write `NETWORK SERVICE` and click **OK**
164+
6. Select the **Actions** tab
165+
7. Click **New...**
166+
8. In **Program/script** start the `.bat` file e.g., write `C:\opensearch\opensearch-x.x.x\opensearch-windows-install.bat` and click **OK**
167+
9. Select the **Settings** tab
168+
10. Select the setting **If the task fails, restart every:**
169+
11. Deselect the setting (remove the checkmark) **Stop the task if it runs longer then:**
170+
12. Click **OK**
171+
13. Start the task
172+
173+
OpenSearch is default started with a self-signed certificate. You can configure a domain and a certificate but, in this guide, the self-signed certificate is retained and FoxIDs is configured to accept the certificate.
174+
175+
Configure OpenSearch in both the FoxIDs site and the FoxIDs Control site in the `appsettings.json` files, located in e.g. `C:\inetpub\FoxIDs\appsettings.json` and `C:\inetpub\FoxIDs.Control\appsettings.json`
176+
177+
```json
178+
"Options": {
179+
"Log": "OpenSearchAndStdoutErrors",
180+
//DB configuration...
181+
},
182+
"OpenSearch": {
183+
"Nodes": [ "https://admin:xxxxxxxx@localhost:9200/" ],
184+
"LogLifetime": "Max180Days",
185+
"AllowInsecureCertificates": true //Accept self-signed certificate
186+
},
187+
```
140188
141189
## First login
142190
Open your FoxIDs Control site (<a href="http://control.my-domain.com" target="_blank">http://control.my-domain.com</a> or <a href="https://control.my-domain.com" target="_blank">https://control.my-domain.com</a>) in a browser.

docs/risk-passwords.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ You can achieve higher password quality and a higher level of security by using
44

55
Hundreds of millions of real world passwords previously exposed in data breaches is collected as risk passwords. By validating that the leaked passwords are not reused, you significantly increase the level of password security.
66

7-
**1) Download risk passwords (pwned passwords)**
7+
> The risk passwords are uploaded ones per FoxIDs deployment in the master tenant and can be used in all tenants and environments.
8+
9+
10+
## 1) Download risk passwords (pwned passwords)
811
Download the `SHA-1` pwned passwords in a single file from [haveibeenpwned.com/passwords](https://haveibeenpwned.com/Passwords) using the [PwnedPasswordsDownloader tool](https://github.com/HaveIBeenPwned/PwnedPasswordsDownloader).
912

1013
> Be aware that it takes some time to download all risk passwords.
1114
12-
**2) Upload risk passwords to FoxIDs**
13-
You can upload risk passwords with the FoxIDs seed tool console application. The seed tool code is [downloaded](https://github.com/ITfoxtec/FoxIDs/tree/master/tools/FoxIDs.SeedTool) and need to be compiled and [configured](#configure-the-seed-tool) to run.
14-
15-
> The risk passwords is uploaded ones per FoxIDs deployment in the master tenant.
15+
## 2) Upload risk passwords to FoxIDs
16+
You then upload the risk passwords with the FoxIDs seed tool console application.
1617

17-
**3) Test**
18-
You can read the number of risk passwords uploaded to FoxIDs in [FoxIDs Control Client](control.md#foxids-control-client) master tenant on the Settings / Risk Passwords tap. And you can test if a password is okay or has appeared in breaches.
18+
Download the `FoxIDs.SeedTool-x.x.x-win-x64.zip` or `FoxIDs.SeedTool-x.x.x-linux-x64.zip` file from the [FoxIDs release](https://github.com/ITfoxtec/FoxIDs/releases) and unpack the seed tool.
1919

20-
## Configure the Seed Tool
20+
### Configure the Seed Tool
2121

2222
The seed tool is configured in the `appsettings.json` file.
2323

@@ -51,18 +51,22 @@ Add your FoxIDs and FoxIDs Control API endpoints and client secret and local ris
5151

5252
```json
5353
"SeedSettings": {
54-
"FoxIDsEndpoint": "https://foxidsxxxx.azurewebsites.net",
55-
"FoxIDsControlEndpoint": "https://foxidscontrolxxxx.azurewebsites.net",
54+
"FoxIDsEndpoint": "https://foxidsxxxx.com", // custom domain or local development https://localhost:44330
55+
"FoxIDsControlEndpoint": "https://control.foxidsxxxx.com", // custom domain or local development https://localhost:44331
5656
"ClientSecret": "xxx",
5757
...
5858
"PwnedPasswordsPath": "c:\\... xxx ...\\pwned-passwords-sha1-ordered-by-count-v4.txt"
5959
}
6060
```
6161

62-
## Run the Seed Tool
62+
### Run the Seed Tool
63+
64+
1. Start a Command Prompt
65+
2. Run the seed tool with `SeedTool.exe`
66+
3. Click `U` to start uploading risk passwords
6367

64-
Run the seed tool executable SeedTool.exe or run the seed tool directly from Visual Studio.
68+
> The risk password upload will take a while.
6569
66-
* Click 'p' to start uploading risk passwords
70+
## 3) Test
71+
You can read the number of risk passwords uploaded to FoxIDs in [FoxIDs Control Client](control.md#foxids-control-client) master tenant on the Settings / Risk Passwords tap. And you can test if a password is okay or has appeared in breaches.
6772

68-
The risk password upload will take a while.

src/FoxIDs.Control/FoxIDs.Control.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.17.2</Version>
5+
<Version>1.17.3</Version>
66
<RootNamespace>FoxIDs</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>FoxIDs</Company>

src/FoxIDs.Control/Infrastructure/Hosting/ServiceCollectionExtensions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,17 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
142142

143143
if (settings.Options.Log == LogOptions.OpenSearchAndStdoutErrors)
144144
{
145-
var openSearchQueryLogSettings = new ConnectionSettings(settings.OpenSearch.Nodes.Count == 1 ? new SingleNodeConnectionPool(settings.OpenSearch.Nodes.First()) : new StaticConnectionPool(settings.OpenSearch.Nodes))
145+
var openSearchNodes = settings.OpenSearchQuery != null ? settings.OpenSearchQuery.Nodes : settings.OpenSearch.Nodes;
146+
var openSearchQueryLogSettings = new ConnectionSettings(openSearchNodes.Count == 1 ? new SingleNodeConnectionPool(openSearchNodes.First()) : new StaticConnectionPool(openSearchNodes))
146147
.RequestTimeout(TimeSpan.FromSeconds(20))
147148
.MaxRetryTimeout(TimeSpan.FromSeconds(30))
148149
.ThrowExceptions();
149150

151+
if (settings.OpenSearch.AllowInsecureCertificates)
152+
{
153+
openSearchQueryLogSettings.ServerCertificateValidationCallback(CertificateValidations.AllowAll);
154+
}
155+
150156
services.AddSingleton(new OpenSearchClientQueryLog(openSearchQueryLogSettings));
151157
}
152158

src/FoxIDs.Control/Logic/Logs/LogOpenSearchLogic.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,16 @@ private async Task<IEnumerable<OpenSearchLogItem>> LoadLogsAsync(Api.LogRequest
253253
}
254254

255255
private IEnumerable<string> GetIndexName()
256+
{
257+
foreach(var name in GetIndexBaseName()) { yield return name; }
258+
259+
if (settings.OpenSearchQuery != null && !string.IsNullOrWhiteSpace(settings.OpenSearchQuery?.CrossClusterSearchClusterName))
260+
{
261+
foreach (var name in GetIndexBaseName()) { yield return $"{settings.OpenSearchQuery.CrossClusterSearchClusterName}:{name}"; }
262+
}
263+
}
264+
265+
private IEnumerable<string> GetIndexBaseName()
256266
{
257267
yield return $"{settings.OpenSearch.LogName}*";
258268
// Remove in about 8 month (support logtype changed to keyword) from now 2025.01.17

src/FoxIDs.Control/Logic/Logs/UsageLogOpenSearchLogic.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,16 @@ private async Task<FiltersAggregate> LoadUsageEventsAsync(string tenantName, str
274274
}
275275

276276
private IEnumerable<string> GetIndexName()
277+
{
278+
foreach (var name in GetIndexBaseName()) { yield return name; }
279+
280+
if (settings.OpenSearchQuery != null && !string.IsNullOrWhiteSpace(settings.OpenSearchQuery?.CrossClusterSearchClusterName))
281+
{
282+
foreach (var name in GetIndexBaseName()) { yield return $"{settings.OpenSearchQuery.CrossClusterSearchClusterName}:{name}"; }
283+
}
284+
}
285+
286+
private IEnumerable<string> GetIndexBaseName()
277287
{
278288
yield return $"{settings.OpenSearch.LogName}*";
279289
// Remove in about 8 month (support logtype changed to keyword) from now 2025.01.17

src/FoxIDs.Control/Models/Config/FoxIDsControlSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public class FoxIDsControlSettings : Settings, IValidatableObject
1515
[Required]
1616
public string DownParty { get; set; } = Constants.ControlApi.ResourceName;
1717

18+
/// <summary>
19+
/// Optional, OpenSearch Query configuration.
20+
/// </summary>
21+
[ValidateComplexType]
22+
public OpenSearchQuerySettings OpenSearchQuery { get; set; }
23+
1824
[ValidateComplexType]
1925
public ApplicationInsightsSettings ApplicationInsights { get; set; }
2026

src/FoxIDs.ControlClient/FoxIDs.ControlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.17.2</Version>
5+
<Version>1.17.3</Version>
66
<RootNamespace>FoxIDs.Client</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>FoxIDs</Company>

0 commit comments

Comments
 (0)