Skip to content

Commit 9c84e99

Browse files
Merge branch 'develop' into issue_2973
2 parents d764f40 + 75e0dbc commit 9c84e99

27 files changed

+495
-98
lines changed

roles/database/files/sql/idempotent/fworch-texts.sql

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ INSERT INTO txt VALUES ('added', 'German', 'hinzugefügt');
269269
INSERT INTO txt VALUES ('added', 'English', 'added');
270270
INSERT INTO txt VALUES ('deleted', 'German', 'gelöscht');
271271
INSERT INTO txt VALUES ('deleted', 'English', 'deleted');
272+
INSERT INTO txt VALUES ('surplus', 'German', 'zuviel');
273+
INSERT INTO txt VALUES ('surplus', 'English', 'surplus');
274+
INSERT INTO txt VALUES ('missing', 'German', 'fehlend');
275+
INSERT INTO txt VALUES ('missing', 'English', 'missing');
272276
INSERT INTO txt VALUES ('modified', 'German', 'geändert');
273277
INSERT INTO txt VALUES ('modified', 'English', 'modified');
274278
INSERT INTO txt VALUES ('id', 'German', 'Id');
@@ -631,7 +635,7 @@ INSERT INTO txt VALUES ('changes', 'English', 'Changes');
631635
INSERT INTO txt VALUES ('used_objects', 'German', 'Benutzte Objekte');
632636
INSERT INTO txt VALUES ('used_objects', 'English', 'Used Objects');
633637
INSERT INTO txt VALUES ('unused_objects', 'German', 'Unbenutzte Objekte');
634-
INSERT INTO txt VALUES ('inused_objects', 'English', 'Unused Objects');
638+
INSERT INTO txt VALUES ('unused_objects', 'English', 'Unused Objects');
635639
INSERT INTO txt VALUES ('modelled_objects', 'German', 'Modellierte Objekte');
636640
INSERT INTO txt VALUES ('modelled_objects', 'English', 'Modelled Objects');
637641
INSERT INTO txt VALUES ('rule_deleted', 'German', 'Regel gelöscht');
@@ -764,6 +768,8 @@ INSERT INTO txt VALUES ('missing_app_servers', 'German', 'Fehlende App Server a
764768
INSERT INTO txt VALUES ('missing_app_servers', 'English', 'Missing App Servers on Device');
765769
INSERT INTO txt VALUES ('surplus_app_servers', 'German', 'Überschüssige App Server auf Device');
766770
INSERT INTO txt VALUES ('surplus_app_servers', 'English', 'Surplus App Servers on Device');
771+
INSERT INTO txt VALUES ('missing_objects', 'German', 'Fehlende Objekte auf Device');
772+
INSERT INTO txt VALUES ('missing_objects', 'English', 'Missing Objects on Device');
767773

768774
-- schedule
769775
INSERT INTO txt VALUES ('schedule', 'German', 'Terminplan');
@@ -3394,6 +3400,8 @@ INSERT INTO txt VALUES ('C9018', 'German', 'Leere Service Gruppe(n) enthalten.
33943400
INSERT INTO txt VALUES ('C9018', 'English', 'Contains empty Service Groups(s). This connection will not be requested.');
33953401
INSERT INTO txt VALUES ('C9019', 'German', 'Leere Service Gruppe(n) enthalten. Nutzende Verbindungen dieser Schnittstelle werden nicht beantragt.');
33963402
INSERT INTO txt VALUES ('C9019', 'English', 'Contains empty Service Groups(s). Connections using this interface will not be requested.');
3403+
INSERT INTO txt VALUES ('C9020', 'German', 'Nur zu Dokumentation. Diese Verbindung wird nicht beantragt.');
3404+
INSERT INTO txt VALUES ('C9020', 'English', 'Only for documentation. This connection will not be requested.');
33973405

33983406
-- help pages
33993407
INSERT INTO txt VALUES ('H0001', 'German', 'Firewall Orchestrator ist eine Anwendung zum Erzeugen und Verwalten von verschiedenen Reports aus Konfigurationsdaten verteilter Firewallsysteme.
@@ -5350,15 +5358,21 @@ INSERT INTO txt VALUES ('H5635', 'German', 'Muster App Zone: Definiert, wie der
53505358
INSERT INTO txt VALUES ('H5635', 'English', 'App zone pattern: Defines how the name of an app zone begins (e.g. "AZ").');
53515359
INSERT INTO txt VALUES ('H5636', 'German', 'App Zonen erstellen: Wenn dieses Flag gesetzt wird, werden App Zonen erstellt.');
53525360
INSERT INTO txt VALUES ('H5636', 'English', 'Create app zones: If this flag is set, app zones are created.');
5353-
INSERT INTO txt VALUES ('H5637', 'German', 'Hier werden die möglichen Werte für Sonderkonfigurationstypen gesetzt.');
5354-
INSERT INTO txt VALUES ('H5637', 'English', 'Set here the possible values for extra configuration types, e.g. NAT.');
5361+
INSERT INTO txt VALUES ('H5637', 'German', 'Hier werden die möglichen Werte für Sonderkonfigurationstypen gesetzt, z.B. NAT. Ein Präfix "Doku_" (welches in der Benutzeroberfläche nicht dargestellt wird) bewirkt die Markierung einer Verbindung als nur zu Dokumentationszwecken.
5362+
Sie wird dann bei der Beantragung und dem Soll-Ist-Abgleich nicht berücksichtigt. Endet der Feldinhalt mit dem String "_user" (Case-insensitiv), so wird in den Produktionsdaten mindestens ein Objekt mit dem im zugehörigen Text angegebenen Namen erwartet.
5363+
In diesem werden dann alle (mindestens eines) nicht anderweitig zuzuordnenden modellierten Objekte als enthalten angenommen.
5364+
');
5365+
INSERT INTO txt VALUES ('H5637', 'English', 'Set here the possible values for extra configuration types, e.g. NAT. A prefix "Doku_" (which is then not displayed in the UI) leads to marking the connection as for documentation only.
5366+
It will not be regarded in the requesting process and Variance Analysis. If the field content ends with "_user" (case insensitive), an object with the name given in the extra configuration text is expected to be found in the production data.
5367+
This object is assumed to contain all modelled objects (at least one), which could not be matched so far.
5368+
');
53555369
INSERT INTO txt VALUES ('H5638', 'German', 'Hier wird der Anweisungstext für Sonderkonfigurationen eingetragen.');
53565370
INSERT INTO txt VALUES ('H5638', 'English', 'Insert text for extra configurations.');
53575371
INSERT INTO txt VALUES ('H5639', 'German', 'Hier wird der Meldungstext für Fehler im externen Beantragungsprozess eingetragen.');
53585372
INSERT INTO txt VALUES ('H5639', 'English', 'Insert customized text for errors in requests to external ticket system.');
53595373
INSERT INTO txt VALUES ('H5640', 'German', 'Auswahl des LDAP-Systems, in dem die Eigentümergruppen gepflegt werden.');
53605374
INSERT INTO txt VALUES ('H5640', 'English', 'Select LDAP system for storing owner groups.');
5361-
INSERT INTO txt VALUES ('H5641', 'German', 'Definieren Sie eine Namenskonvention, um die LDAP-Gruppe (nicht der volle DN) zu identifizieren, die zu einem Eigentümer gehört. Mindestens eine der Variablen @@AppId@@ oder @@ExternalAppId@@ muss enthalten sein. Optional können Sie auch @@AppPrefix@@ verwenden.');
5375+
INSERT INTO txt VALUES ('H5641', 'German', 'Definieren Sie eine Namenskonvention, um die LDAP-Gruppe (nicht der volle DN) zu identifizieren, die zu einem Eigentümer gehört. Mindestens eine der Variablen @@AppId@@ oder @@ExternalAppId@@ muss enthalten sein. Optional können Sie auch @@AppPrefix@@ verwenden.');
53625376
INSERT INTO txt VALUES ('H5641', 'English', 'Define naming convention in order to identify the LDAP group (not the full DN) belonging to an owner. At least one of the variables @@AppId@@ or @@ExternalAppId@@ must be included. Optionally you may also use @@AppPrefix@@.');
53635377
INSERT INTO txt VALUES ('H5642', 'German', 'Sollen die LDAP-Gruppen aktiv von FWO gepflegt werden (anlegen/ändern von Gruppenmitgliedern)? Ein Schreibzugriff auf den jeweiligen LDAP-Server ist notwendig.');
53645378
INSERT INTO txt VALUES ('H5642', 'English', 'Shall FWO manage LDAP groups for owners? Write access to the respective LDAP is needed if you choose this option.');

roles/lib/files/FWO.Basics/GlobalConstants.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public struct GlobalConst
3333
public const string kImportAreaSubnetData = "importAreaSubnetData";
3434
public const string kManual = "manual";
3535
public const string kCSV_ = "CSV_";
36+
public const string kDoku_ = "Doku_";
37+
public const string k_user = "_user";
38+
3639
public const char kAppIdSeparator = '-'; // hard-coded could be moved to settings
3740
public const string kModellerGroup = "ModellerGroup_";
3841
public const string kFullAppIdPlaceholder = "@@ExternalAppId@@";

roles/lib/files/FWO.Data/Modelling/ModellingConnection.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using FWO.Basics;
12
using System.Text.Json.Serialization;
23
using Newtonsoft.Json;
34

@@ -15,7 +16,9 @@ public enum ConState
1516

1617
EmptyAppRoles,
1718
DeletedObjects,
18-
EmptySvcGrps
19+
EmptySvcGrps,
20+
DocumentationOnly,
21+
VarianceFound
1922
}
2023

2124
public class ModellingConnection
@@ -290,6 +293,14 @@ public void SyncState(long dummyAppRoleId)
290293
{
291294
RemoveProperty(ConState.EmptySvcGrps.ToString());
292295
}
296+
if(IsDocumentationOnly())
297+
{
298+
AddProperty(ConState.DocumentationOnly.ToString());
299+
}
300+
else
301+
{
302+
RemoveProperty(ConState.DocumentationOnly.ToString());
303+
}
293304
}
294305

295306
public bool EmptyAppRolesFound(long dummyAppRoleId)
@@ -314,6 +325,19 @@ public bool EmptyAppRolesFound(long dummyAppRoleId)
314325
public bool EmptyServiceGroupsFound()
315326
=> ServiceGroups.Any(_ => _.Content.Services.Count == 0);
316327

328+
public bool IsDocumentationOnly()
329+
=> ExtraConfigs.Any(_ => _.ExtraConfigType.StartsWith(GlobalConst.kDoku_));
330+
331+
public Dictionary<string, bool> GetSpecialUserObjectNames()
332+
{
333+
Dictionary<string, bool> userObjectNames = [];
334+
foreach(var extraConfig in ExtraConfigs.Where(e => e.ExtraConfigType.ToLower().EndsWith(GlobalConst.k_user)))
335+
{
336+
userObjectNames.Add(extraConfig.ExtraConfigText.ToLower(),false);
337+
}
338+
return userObjectNames;
339+
}
340+
317341
public bool DeletedObjectsFound()
318342
{
319343
foreach(var area in SourceAreas)

roles/lib/files/FWO.Data/Modelling/ModellingExtraConfig.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using FWO.Basics;
12
using System.Text.Json.Serialization;
23
using Newtonsoft.Json;
34

@@ -26,7 +27,8 @@ public ModellingExtraConfig(ModellingExtraConfig conf)
2627

2728
public string Display()
2829
{
29-
return $"{ExtraConfigType}: {ExtraConfigText}";
30+
return ExtraConfigType.StartsWith(GlobalConst.kDoku_) ?
31+
$"{ExtraConfigType[GlobalConst.kDoku_.Length..]}" : $"{ExtraConfigType}: {ExtraConfigText}";
3032
}
3133

3234
public bool Sanitize()

roles/lib/files/FWO.Data/Rule.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public class Rule
101101
public long ConnId;
102102
public bool ModellOk = false;
103103
public bool Detailed = false;
104+
public List<string> UnusedSpecialUserObjects = [];
104105

105106
public bool IsDropRule()
106107
{

roles/lib/files/FWO.Report/Display/RuleDifferenceDisplayHtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public string DisplayServiceDiff(Rule rule, OutputLocation location, ReportType
4242
private string DisplayDiff(List<string> addedElems, List<string> deletedElems, List<string> unchangedElems)
4343
{
4444
return (unchangedElems.Count > 0 ? $"<p>{string.Join("<br>", unchangedElems)}<br></p>" : "")
45-
+ (deletedElems.Count > 0 ? $"{userConfig.GetText("deleted")}: <p style=\"{GlobalConst.kStyleDeleted}\">{string.Join("<br>", deletedElems)}<br></p>" : "")
46-
+ (addedElems.Count > 0 ? $"{userConfig.GetText("added")}: <p style=\"{GlobalConst.kStyleAdded}\">{string.Join("<br>", addedElems)}</p>" : "");
45+
+ (deletedElems.Count > 0 ? $"{userConfig.GetText("missing")}: <p style=\"{GlobalConst.kStyleDeleted}\">{string.Join("<br>", deletedElems)}<br></p>" : "")
46+
+ (addedElems.Count > 0 ? $"{userConfig.GetText("surplus")}: <p style=\"{GlobalConst.kStyleAdded}\">{string.Join("<br>", addedElems)}</p>" : "");
4747
}
4848
}
4949
}

roles/lib/files/FWO.Report/ReportGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ private static async Task PrepareConnReportData(FwoOwner selectedOwner, OwnerRep
104104
await PrepareVarianceData(ownerReport, modellingFilter, apiConnection, userConfig, displayMessageInUi);
105105
}
106106
ownerReport.Name = selectedOwner.Name;
107-
ownerReport.RegularConnections = ownerReport.Connections.Where(x => !x.IsInterface && !x.IsCommonService).ToList();
108-
ownerReport.Interfaces = ownerReport.Connections.Where(x => x.IsInterface).ToList();
109-
ownerReport.CommonServices = ownerReport.Connections.Where(x => !x.IsInterface && x.IsCommonService).ToList();
107+
ownerReport.RegularConnections = [.. ownerReport.Connections.Where(x => !x.IsInterface && !x.IsCommonService)];
108+
ownerReport.Interfaces = [.. ownerReport.Connections.Where(x => x.IsInterface)];
109+
ownerReport.CommonServices = [.. ownerReport.Connections.Where(x => !x.IsInterface && x.IsCommonService)];
110110
}
111111

112112
private static async Task PrepareVarianceData(OwnerReport ownerReport, ModellingFilter modellingFilter, ApiConnection apiConnection,
@@ -115,7 +115,7 @@ private static async Task PrepareVarianceData(OwnerReport ownerReport, Modelling
115115
ownerReport.ExtractConnectionsToAnalyse();
116116
ExtStateHandler extStateHandler = new(apiConnection);
117117
ModellingVarianceAnalysis varianceAnalysis = new(apiConnection, extStateHandler, userConfig, ownerReport.Owner, displayMessageInUi);
118-
ModellingVarianceResult result = await varianceAnalysis.AnalyseRulesVsModelledConnections(ownerReport.Connections, modellingFilter);
118+
ModellingVarianceResult result = await varianceAnalysis.AnalyseRulesVsModelledConnections([.. ownerReport.Connections.Where(x => !x.IsDocumentationOnly())], modellingFilter);
119119
ownerReport.Connections = result.ConnsNotImplemented;
120120
ownerReport.RuleDifferences = result.RuleDifferences;
121121
ownerReport.MissingAppRoles = result.MissingAppRoles;

roles/lib/files/FWO.Report/ReportVariances.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ private void AppendConnDiffs(ref StringBuilder report, OwnerReport ownerReport,
185185
report.AppendLine($"<h4 id=\"{Guid.NewGuid()}\">{userConfig.GetText("connections_with_diffs")}</h4>");
186186
foreach(var difference in ownerReport.RuleDifferences)
187187
{
188+
bool anyUnusedSpecialUsers = difference.ImplementedRules.Any(r => r.UnusedSpecialUserObjects.Count > 0);
188189
report.AppendLine($"<h5 id=\"{Guid.NewGuid()}\">{difference.ModelledConnection.Name}</h5>");
189190
AppendConnectionsGroupHtml([difference.ModelledConnection], ownerReport, chapterNumber, ref report, false, false, true);
190191
report.AppendLine("<table>");
@@ -194,6 +195,10 @@ private void AppendConnDiffs(ref StringBuilder report, OwnerReport ownerReport,
194195
report.AppendLine($"<th>{userConfig.GetText("source")}</th>");
195196
report.AppendLine($"<th>{userConfig.GetText("services")}</th>");
196197
report.AppendLine($"<th>{userConfig.GetText("destination")}</th>");
198+
if(anyUnusedSpecialUsers)
199+
{
200+
report.AppendLine($"<th>{userConfig.GetText("missing_objects")}</th>");
201+
}
197202
report.AppendLine("</tr>");
198203

199204
Rule modelledRule = difference.ModelledConnection.ToRule();
@@ -206,6 +211,10 @@ private void AppendConnDiffs(ref StringBuilder report, OwnerReport ownerReport,
206211
report.AppendLine($"<td>{ruleDiffDisplay.DisplaySourceDiff(diff, OutputLocation.export, ReportType)}</td>");
207212
report.AppendLine($"<td>{ruleDiffDisplay.DisplayServiceDiff(diff, OutputLocation.export, ReportType)}</td>");
208213
report.AppendLine($"<td>{ruleDiffDisplay.DisplayDestinationDiff(diff, OutputLocation.export, ReportType)}</td>");
214+
if(anyUnusedSpecialUsers)
215+
{
216+
report.AppendLine($"<td style=\"{GlobalConst.kStyleHighlightedRed}\">{string.Join(", ", diff.UnusedSpecialUserObjects)}</td>");
217+
}
209218
report.AppendLine("</tr>");
210219
}
211220
report.AppendLine("</table>");

0 commit comments

Comments
 (0)