From 0d7c98115336857ad48a2c55bcfdc7f4690b6bcb Mon Sep 17 00:00:00 2001 From: abarz722 Date: Tue, 12 Mar 2024 20:02:50 +0100 Subject: [PATCH] fixes, test + doku --- .../files/sql/idempotent/fworch-texts.sql | 46 +++-- .../lib/files/FWO.Report/Data/OwnerReport.cs | 36 +++- roles/lib/files/FWO.Report/ReportBase.cs | 4 +- .../lib/files/FWO.Report/ReportConnections.cs | 41 +++- roles/lib/files/FWO.Report/ReportNatRules.cs | 12 +- roles/lib/files/FWO.Report/ReportRules.cs | 12 +- roles/test/files/FWO.Test/ExportTest.cs | 193 +++++++++++++----- .../files/FWO.Test/SimulatedUserConfig.cs | 14 +- .../Help/HelpReportingLeftSidebar.cshtml | 1 + .../ui/files/FWO.UI/Shared/ObjectGroup.razor | 6 +- 10 files changed, 266 insertions(+), 99 deletions(-) diff --git a/roles/database/files/sql/idempotent/fworch-texts.sql b/roles/database/files/sql/idempotent/fworch-texts.sql index 7c9ca53ce..18511ab4c 100644 --- a/roles/database/files/sql/idempotent/fworch-texts.sql +++ b/roles/database/files/sql/idempotent/fworch-texts.sql @@ -650,6 +650,10 @@ INSERT INTO txt VALUES ('delete_unused_rule', 'German', 'Unbenutzte Regel l&oum INSERT INTO txt VALUES ('delete_unused_rule', 'English', 'Delete unused rule'); INSERT INTO txt VALUES ('delete_unused_rules', 'German', 'Unbenutzte Regeln löschen'); INSERT INTO txt VALUES ('delete_unused_rules', 'English', 'Delete unused rules'); +INSERT INTO txt VALUES ('network', 'German', 'Netzwerk'); +INSERT INTO txt VALUES ('network', 'English', 'network'); +INSERT INTO txt VALUES ('ip_range', 'German', 'Ip-Bereich'); +INSERT INTO txt VALUES ('ip_range', 'English', 'Ip Range'); -- schedule INSERT INTO txt VALUES ('schedule', 'German', 'Terminplan'); @@ -2656,10 +2660,11 @@ INSERT INTO txt VALUES ('H1101', 'German', '
  • Alle Filter sind schreibungsun
  • Alle Filterausdrücke müssen logisch mit den Operatoren: and, or, not miteinander kombiniert werden.
  • Klammern können genutzt werden, um die Filterausdrücke zu strukturieren.
  • Anführungszeichen (") können optional für Wertdefinitionen genutzt werden. Wenn Leerzeichen im Wert vorkommen (z.B. für Datum/Zeit-Werte), müssen sie genutzt werden.
  • -
  • Ein Gateway muss ausgewählt werden. Dies kann manuell oder über die linke Randleiste, von wo die Auswahl automatisch in den Filter integriert wird, erfolgen.
  • +
  • Muss ein Gateway ausgewählt werden, kann dies manuell oder über die linke Randleiste, von wo die Auswahl automatisch in den Filter integriert wird, erfolgen.
  • Zeitfilterung funktioniert zur Zeit nur für Zeitpunkte vor dem letzten Import, der einen Config Change gefunden hat.
  • Regeln werden immer in voller Tiefe durchsucht, d.h. alle Gruppen in Quell-, Ziel- und Dienstfeldern werden aufgelöst. Zur Zeit gibt es noch keine Möglichkeit, nur auf der obersten Regelebene zu suchen.
  • +
  • Auch Verbindungen können mit den entsprechenden Schlüsselwörtern für Quelle, Dienst und Ziel durchsucht werden.
  • '); INSERT INTO txt VALUES ('H1101', 'English', '
  • All filtering is case insensitive.
  • There are multiple variants for most keywords, e.g. DestinationPort filters can be written as: @@ -2667,10 +2672,11 @@ INSERT INTO txt VALUES ('H1101', 'English', '
  • All filtering is case insensit
  • All filter statements must be logically combined using either: and, or, not.
  • Brackets can be used for structuring the filter statement.
  • Quotation marks (") can be used optionally for the value definition. If there are white spaces in the value (e.g. for date/time values) the quotation marks have to be used.
  • -
  • A gateway has to be selected. This can be done manually or via the left sidebar, from where the selection is automatically integrated to the filter.
  • +
  • If a gateway has to be selected, this can be done manually or via the left sidebar, from where the selection is automatically integrated to the filter.
  • Time filtering currently only works for points in time before the last import that found a config change.
  • Rules are always deep-searched, meaning all groups in source, destination and service fields are resolved. There is currently no option to only search at the rule top-level.
  • +
  • Also connections can be filtered with the respective keywords for source, service and destination.
  • '); INSERT INTO txt VALUES ('H1102', 'German', 'Folgende Report-Typen stehen zur Auswahl: '); INSERT INTO txt VALUES ('H1102', 'English', 'Choose from the following report types: @@ -2701,6 +2709,8 @@ INSERT INTO txt VALUES ('H1102', 'English', 'Choose from the following report t
  • Changes (resolved) - display all changes in a defined time interval but not showing any group structure but only resolved group content. Default report interval: this year
  • Changes (technical) - display all changes in a defined time interval resolving groups and not showing object names. Default report interval: this year
  • Statistics - display statistical data on the number of objects and rules. Default report time: now
  • +
  • Connections - display of all connections, interfaces and Common Services modelled in an application with additional lists of all network and service objects used here. + Additionally a list of all global Common Services is given.
  • '); INSERT INTO txt VALUES ('H1111', 'German', '
  • gateway (gw, firewall, fw, device, dev): Zusätzlich zu der in der Linken Randleiste zu tätigenden Auswahl spezifischer Devices @@ -2816,12 +2826,12 @@ INSERT INTO txt VALUES ('H1303', 'English', 'After clicking the "Export Report" INSERT INTO txt VALUES ('H1401', 'German', 'Im unteren Teil der Hauptseite werden die Ausgabedaten des generierten Reports dargestellt. Unerwünschte Spalten können mit der jeweiligen "-" Schaltfläche ausgeblendet werden. Wenn dargestellt, können die Spalten auch zum Sortieren oder Filtern genutzt werden.
    - Die zur Verfügung stehenden Datenspalten sind: + Die in regelbasierten Reports zur Verfügung stehenden Datenspalten sind: '); INSERT INTO txt VALUES ('H1401', 'English', 'In the lower part of the main page the output data of the generated report is displayed. Unwanted columns can be removed by clicking on the respective "-" button. If diplayed the columns can be used for sorting or filtering.
    - The available data columns are: + The available data columns in rule based reports are: '); INSERT INTO txt VALUES ('H1402', 'German', '
  • Nummer
  • Name
  • Quellzone
  • Quelle
  • Zielzone
  • Ziel
  • Dienste
  • Aktion
  • Logging
  • Aktiviert
  • UID
  • Kommentar
  • @@ -2831,18 +2841,20 @@ INSERT INTO txt VALUES ('H1402', 'English', '
  • Number
  • Name
  • Sou '); INSERT INTO txt VALUES ('H1403', 'German', 'Zusätzlich werden in einzelnen Reporttypen weitere Spalten dargestellt: '); INSERT INTO txt VALUES ('H1403', 'English', 'Additionally in the different Report Types further columns are displayed: '); @@ -2910,16 +2922,22 @@ INSERT INTO txt VALUES ('H1511', 'English', 'Only for Recertification Report: Re
  • Show any rules: If flag is set, rules with Ip 0.0.0.0 in source or destination are shown. When deselecting an excluding statement is added to the filter line.
  • '); -INSERT INTO txt VALUES ('H1601', 'German', 'Die rechte Randleiste hat drei Reiter: Unter "Alle" werden alle aktuell abgeholten Objekte dargestellt, +INSERT INTO txt VALUES ('H1512', 'German', 'Nur beim Verbindungs-Report: Eigentümer: Hier kann aus den dem Nutzer zur Modellierung zugeordneten Eigentümerschaften ausgewählt werden. +'); +INSERT INTO txt VALUES ('H1512', 'English', 'Only for Connections Report: Owner: Select the modelling owner out of the ownerships related to the user. +'); +INSERT INTO txt VALUES ('H1601', 'German', 'Die rechte Randleiste hat mehrere Reiter, die je nach Report eingeblendet werden: Für regelbasierte Reports werden unter "Alle" sämtliche aktuell abgeholten Objekte dargestellt, während unter "Report" nur die Objekte der im Report vorkommenden Regeln gezeigt werden. Im Reiter "Regel" sind dann nur die Objekte der in der Reportausgabe ausgewählten Regeln dargestellt.
    ("Alle"- und "Regel"-Reiter werden mit derselben Funktionalität auch im Rezertifizierungsdialog angeboten).
    + In eigentümerbasierten Reports erscheint der Reiter "Benutzte Objekte", in dem alle in den Verbindungen verwendeten Objekte aufgelistet werden.
    Folgende Daten werden soweit verfügbar dargestellt, gruppiert nach den ausgewählten Devices: '); -INSERT INTO txt VALUES ('H1601', 'English', 'There are three Tabs shown in the right sidebar: The "All" tab displays all currently fetched objects, +INSERT INTO txt VALUES ('H1601', 'English', 'There are several tabs shown in the right sidebar, depending on the report type: In rule based reports the "All" tab displays all currently fetched objects, whereas in the "Report" tab only the objects of the rules of the report are shown. In the "Rule" tab only objects of rules selected in the report output are dispalyed.
    ("All" and "Rule" tab are also offered in the Recertification dialogue with the same functionality).
    + In owner based reports the Tab "Used Objects" is displayed, where all objects used in the connections are listed.
    The following data are displayed if available, grouped by the selected devices: '); INSERT INTO txt VALUES ('H1602', 'German', '
  • Netzwerkobjekte: Name, Typ, IP, Zone, ggf. Gruppenmitglieder, zuletzt geändert, Kommentar
  • @@ -5466,23 +5484,27 @@ INSERT INTO txt VALUES ('H8717', 'English', '

    7) Activate Planning phase

    INSERT INTO txt VALUES ('H9001', 'German', 'Insbesondere in grösseren Netzwerken besteht der Bedarf, die vielfältigen Verbindungen zwischen den Teilnehmern zu modellieren, um sie so einer weitergehenden Verwaltung zugänglich zu machen. Dieses Modul stellt die Hilfsmittel, bereits vorhandene Applikationen von anderen Systemen zu importieren - und ihre Elemente nach vorgegebenen Kriterien zu verknüpfen. Dadurch wird ein Kommunikationsprofil erzeugt, bestehend aus einem Satz von Verbindungen und Schnittstellen.
    + und ihre Elemente nach vorgegebenen Kriterien zu verknüpfen. Dadurch wird ein Kommunikationsprofil erzeugt, bestehend aus einem Satz von Verbindungen und Schnittstellen.

    Zur Definition der Schnittstellen und Verbindungen wird auf der linken Seite eine Bibliothek bereitgestellt, in der zunächst die zur Applikation zugeordneten (in der Regel aus Fremdsystemen importierten) Host-Adressen (App-Server) angeboten werden. Diese können im ersten Schritt zu App-Rollen gebündelt werden (sh. Netzwerkobjekte). Die App-Rollen (und je nach Modellierungseinstellungen auch die App-Server selbst) können dann als Quelle oder Ziel in die zu erstellende Verbindung übertragen werden. Hinzu können noch weitere Objekte (z. B. Netzwerke) kommen, und es können (interne und externe) Schnittstellen eingebunden werden.
    Desweiteren werden in der Bibliothek vordefinierte (vom Administrator eingestellte) Dienste angeboten. Diese können durch selbst definierte Dienste ergänzt, - als Dienstgruppen gebündelt und dann in den zu definierenden Verbindungen verwendet werden. + als Dienstgruppen gebündelt und dann in den zu definierenden Verbindungen verwendet werden.

    + Für das erstellte Kommunikationsprofil kann per Knopfdruck automatisch ein Verbindungs-Report erstellt werden. Er wird dann in dem Report-Modul dargestellt. + Dort stehen dann die vom Report-Modul bereitgestellten Funktionalitäten zur weiteren Eingrenzung mittels zusätzlicher Filter, Erzeugung von Vorlagen und Terminen, sowie der Archivierung zur Verfügung. '); INSERT INTO txt VALUES ('H9001', 'English', 'Especially in greater networks there is the demand to model the connections between the participants, with the aim of further administration. This module provides tools to import already existing applications from other systems - and to connect their elements by predefined criteria. By doing this a communication profile is created, composed by a set of connections and interfaces.
    + and to connect their elements by predefined criteria. By doing this a communication profile is created, composed by a set of connections and interfaces.

    To define interfaces and connections a library is provided on the left side, where at the beginning the host addresses (App Server) associated to the application (which usually are imported from external systems) are offered. They can in a first step be bundled to App Roles (see Network Objects). These App Roles (and depending on the Modelling Settings also the App Servers themselves) can be used as source or destination in the connections to be created. Additionally further objects (e.g. networks) and (internal or external) interfaces can be integrated.
    Furthermore the library offers predefined Services (inserted by the administrator). They can be complemented by self defined services, bundled as Service Groups, - and used in the connections. + and used in the connections.

    + For the communication profile a Connections Report can be created automatically. It is displayed in the Report module. + Here the reporting functionalities for further filtering, creation of templates and schedules, as well as archiving can be used. '); INSERT INTO txt VALUES ('H9011', 'German', 'Eine Applikation ist aus Sicht des Firewall Orchestrators ein Behälter, in dem aus zugeordneten Host-Adressen ein Kommunikationsprofil erstellt wird. Sie wird in der Regel extern aus den Anforderungen und Gegebenheiten der jeweiligen Unternehmung definiert und kann über eine Importschnittstelle in den Firewall Orchestrator importiert diff --git a/roles/lib/files/FWO.Report/Data/OwnerReport.cs b/roles/lib/files/FWO.Report/Data/OwnerReport.cs index 201f244cf..41bd4c8c6 100644 --- a/roles/lib/files/FWO.Report/Data/OwnerReport.cs +++ b/roles/lib/files/FWO.Report/Data/OwnerReport.cs @@ -19,7 +19,12 @@ public OwnerReport() public OwnerReport(OwnerReport report) { Name = report.Name; - Connections = new (report.Connections); + Connections = report.Connections; + RegularConnections = report.RegularConnections; + Interfaces = report.Interfaces; + CommonServices = report.CommonServices; + AllObjects = report.AllObjects; + AllServices = report.AllServices; } public static void AssignConnectionNumbers(List connections) @@ -96,7 +101,30 @@ public List GetAllServices() return allServices; } - public List GetSrcNames(ModellingConnection conn) + public static List GetSrcNames(ModellingConnection conn) + { + List names = ModellingNwGroupWrapper.Resolve(conn.SourceNwGroups).ToList().ConvertAll(s => s.DisplayHtml()); + names.AddRange(ModellingAppRoleWrapper.Resolve(conn.SourceAppRoles).ToList().ConvertAll(s => s.DisplayHtml())); + names.AddRange(ModellingAppServerWrapper.Resolve(conn.SourceAppServers).ToList().ConvertAll(s => s.DisplayHtml())); + return names; + } + + public static List GetDstNames(ModellingConnection conn) + { + List names = ModellingNwGroupWrapper.Resolve(conn.DestinationNwGroups).ToList().ConvertAll(s => s.DisplayHtml()); + names.AddRange(ModellingAppRoleWrapper.Resolve(conn.DestinationAppRoles).ToList().ConvertAll(s => s.DisplayHtml())); + names.AddRange(ModellingAppServerWrapper.Resolve(conn.DestinationAppServers).ToList().ConvertAll(s => s.DisplayHtml())); + return names; + } + + public static List GetSvcNames(ModellingConnection conn) + { + List names = ModellingServiceGroupWrapper.Resolve(conn.ServiceGroups).ToList().ConvertAll(s => s.DisplayHtml()); + names.AddRange(ModellingServiceWrapper.Resolve(conn.Services).ToList().ConvertAll(s => s.DisplayHtml())); + return names; + } + + public List GetLinkedSrcNames(ModellingConnection conn) { List names = ModellingNwGroupWrapper.Resolve(conn.SourceNwGroups).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.NwObj, ResolveObjNumber(s))); names.AddRange(ModellingAppRoleWrapper.Resolve(conn.SourceAppRoles).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.NwObj, ResolveObjNumber(s)))); @@ -104,7 +132,7 @@ public List GetSrcNames(ModellingConnection conn) return names; } - public List GetDstNames(ModellingConnection conn) + public List GetLinkedDstNames(ModellingConnection conn) { List names = ModellingNwGroupWrapper.Resolve(conn.DestinationNwGroups).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.NwObj, ResolveObjNumber(s))); names.AddRange(ModellingAppRoleWrapper.Resolve(conn.DestinationAppRoles).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.NwObj, ResolveObjNumber(s)))); @@ -112,7 +140,7 @@ public List GetDstNames(ModellingConnection conn) return names; } - public List GetSvcNames(ModellingConnection conn) + public List GetLinkedSvcNames(ModellingConnection conn) { List names = ModellingServiceGroupWrapper.Resolve(conn.ServiceGroups).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.Svc, ResolveSvcNumber(s))); names.AddRange(ModellingServiceWrapper.Resolve(conn.Services).ToList().ConvertAll(s => ConstructOutput(s, ObjCatString.Svc, ResolveSvcNumber(s)))); diff --git a/roles/lib/files/FWO.Report/ReportBase.cs b/roles/lib/files/FWO.Report/ReportBase.cs index ef743410b..8ed6f01a8 100644 --- a/roles/lib/files/FWO.Report/ReportBase.cs +++ b/roles/lib/files/FWO.Report/ReportBase.cs @@ -71,10 +71,10 @@ public abstract class ReportBase

    ##Title##

    -

    Filter: ##Filter##

    ##Date-of-Config##: ##GeneratedFor## (UTC)

    ##GeneratedOn##: ##Date## (UTC)

    ##OtherFilters##

    +

    ##Filter##


    ##Body## @@ -153,7 +153,7 @@ protected string GenerateHtmlFrame(string title, string filter, DateTime date, S if (string.IsNullOrEmpty(htmlExport)) { HtmlTemplate = HtmlTemplate.Replace("##Title##", title); - HtmlTemplate = HtmlTemplate.Replace("##Filter##", filter); + HtmlTemplate = HtmlTemplate.Replace("##Filter##", userConfig.GetText("filter") + ": " + filter); HtmlTemplate = HtmlTemplate.Replace("##GeneratedOn##", userConfig.GetText("generated_on")); HtmlTemplate = HtmlTemplate.Replace("##Date##", date.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssK")); if(ReportType.IsChangeReport()) diff --git a/roles/lib/files/FWO.Report/ReportConnections.cs b/roles/lib/files/FWO.Report/ReportConnections.cs index a8c49099f..8122f897c 100644 --- a/roles/lib/files/FWO.Report/ReportConnections.cs +++ b/roles/lib/files/FWO.Report/ReportConnections.cs @@ -65,41 +65,64 @@ public override string ExportToHtml() } if(ownerReport.CommonServices.Count > 0) { - report.AppendLine($"

    {userConfig.GetText("common_services")}

    "); + report.AppendLine($"

    {userConfig.GetText("own_common_services")}

    "); AppendConnectionsGroupHtml(ownerReport.CommonServices, ownerReport, ref report); } AppendNetworkObjectsHtml(ownerReport.AllObjects, ref report); AppendNetworkServicesHtml(ownerReport.AllServices, ref report); } + if(ReportData.GlobalComSvc.Count > 0) + { + report.AppendLine($"

    {userConfig.GetText("global_common_services")}

    "); + AppendConnectionsGroupHtml(ReportData.GlobalComSvc, null, ref report); + } return GenerateHtmlFrame(userConfig.GetText(ReportType.ToString()), Query.RawFilter, DateTime.Now, report); } - private void AppendConnectionsGroupHtml(List connections, OwnerReport ownerReport, ref StringBuilder report) + private void AppendConnectionsGroupHtml(List connections, OwnerReport? ownerReport, ref StringBuilder report) { OwnerReport.AssignConnectionNumbers(connections); + bool IsGlobalComSvc = ownerReport == null; report.AppendLine(""); - AppendConnectionHeadlineHtml(ref report); + AppendConnectionHeadlineHtml(ref report, IsGlobalComSvc); foreach (var connection in connections) { report.AppendLine(""); report.AppendLine($""); report.AppendLine($""); + if(IsGlobalComSvc) + { + report.AppendLine($""); + } report.AppendLine($""); report.AppendLine($""); - report.AppendLine($""); - report.AppendLine($""); - report.AppendLine($""); + if(IsGlobalComSvc) + { + report.AppendLine($""); + report.AppendLine($""); + report.AppendLine($""); + } + else + { + report.AppendLine($""); + report.AppendLine($""); + report.AppendLine($""); + } } report.AppendLine("
    {connection.OrderNumber}{connection.Id}{connection.App.Name}{connection.Name}{connection.Reason}{String.Join("
    ", ownerReport.GetSrcNames(connection))}
    {String.Join("
    ", ownerReport.GetSvcNames(connection))}
    {String.Join("
    ", ownerReport.GetDstNames(connection))}
    {String.Join("
    ", OwnerReport.GetSrcNames(connection))}
    {String.Join("
    ", OwnerReport.GetSvcNames(connection))}
    {String.Join("
    ", OwnerReport.GetDstNames(connection))}
    {String.Join("
    ", ownerReport.GetLinkedSrcNames(connection))}
    {String.Join("
    ", ownerReport.GetLinkedSvcNames(connection))}
    {String.Join("
    ", ownerReport.GetLinkedDstNames(connection))}
    "); report.AppendLine("
    "); } - private void AppendConnectionHeadlineHtml(ref StringBuilder report) + private void AppendConnectionHeadlineHtml(ref StringBuilder report, bool showOwnerName) { report.AppendLine(""); report.AppendLine($"{userConfig.GetText("number")}"); report.AppendLine($"{userConfig.GetText("id")}"); + if(showOwnerName) + { + report.AppendLine($"{userConfig.GetText("owner")}"); + } report.AppendLine($"{userConfig.GetText("name")}"); report.AppendLine($"{userConfig.GetText("func_reason")}"); report.AppendLine($"{userConfig.GetText("source")}"); @@ -118,7 +141,7 @@ private void AppendNetworkObjectsHtml(List networkObjects, ref St report.AppendLine(""); report.AppendLine($"{nwObj.Number}"); report.AppendLine($"{nwObj.Id}"); - report.AppendLine($"{nwObj.Name}"); + report.AppendLine($"{nwObj.Name}"); report.AppendLine($"{nwObj.IP}"); } report.AppendLine(""); @@ -145,7 +168,7 @@ private void AppendNetworkServicesHtml(List networkServices, ref report.AppendLine(""); report.AppendLine($"{svc.Number}"); report.AppendLine($"{svc.Id}"); - report.AppendLine($"{svc.Name}"); + report.AppendLine($"{svc.Name}"); report.AppendLine($"{svc.Protocol.Name}"); report.AppendLine($"{svc.DestinationPort}"); } diff --git a/roles/lib/files/FWO.Report/ReportNatRules.cs b/roles/lib/files/FWO.Report/ReportNatRules.cs index 0e5fadc1b..1c07faa86 100644 --- a/roles/lib/files/FWO.Report/ReportNatRules.cs +++ b/roles/lib/files/FWO.Report/ReportNatRules.cs @@ -99,8 +99,8 @@ public override string ExportToHtml() { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{nwobj.Name}"); - report.AppendLine($"{nwobj.Type.Name}"); + report.AppendLine($"{nwobj.Name}"); + report.AppendLine($"{(nwobj.Type.Name != "" ? userConfig.GetText(nwobj.Type.Name) : "")}"); report.AppendLine($"{NwObjDisplay.DisplayIp(nwobj.IP, nwobj.IpEnd, nwobj.Type.Name)}"); if (nwobj.MemberNames != null && nwobj.MemberNames.Contains("|")) report.AppendLine($"{string.Join("
    ", nwobj.MemberNames.Split('|'))}"); @@ -133,8 +133,8 @@ public override string ExportToHtml() { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{svcobj.Name}"); - report.AppendLine($"{svcobj.Name}"); + report.AppendLine($"{svcobj.Name}"); + report.AppendLine($"{(svcobj.Type.Name != "" ? userConfig.GetText(svcobj.Type.Name) : "")}"); report.AppendLine($"{((svcobj.Type.Name!=ObjectType.Group && svcobj.Protocol!=null)?svcobj.Protocol.Name:"")}"); if (svcobj.DestinationPortEnd != null && svcobj.DestinationPortEnd != svcobj.DestinationPort) report.AppendLine($"{svcobj.DestinationPort}-{svcobj.DestinationPortEnd}"); @@ -169,8 +169,8 @@ public override string ExportToHtml() { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{userobj.Name}"); - report.AppendLine($"{userobj.Name}"); + report.AppendLine($"{userobj.Name}"); + report.AppendLine($"{(userobj.Type.Name != "" ? userConfig.GetText(userobj.Type.Name) : "")}"); if (userobj.MemberNames != null && userobj.MemberNames.Contains("|")) report.AppendLine($"{string.Join("
    ", userobj.MemberNames.Split('|'))}"); else diff --git a/roles/lib/files/FWO.Report/ReportRules.cs b/roles/lib/files/FWO.Report/ReportRules.cs index c9d30baaf..3d6d35b67 100644 --- a/roles/lib/files/FWO.Report/ReportRules.cs +++ b/roles/lib/files/FWO.Report/ReportRules.cs @@ -457,8 +457,8 @@ private void appendNetworkObjectsForManagementHtml(ref StringBuilder report, ref { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{nwobj.Name}"); - report.AppendLine($"{nwobj.Type.Name}"); + report.AppendLine($"{nwobj.Name}"); + report.AppendLine($"{(nwobj.Type.Name != "" ? userConfig.GetText(nwobj.Type.Name) : "")}"); report.AppendLine($"{NwObjDisplay.DisplayIp(nwobj.IP, nwobj.IpEnd, nwobj.Type.Name)}"); if (nwobj.MemberNames != null && nwobj.MemberNames.Contains('|')) report.AppendLine($"{string.Join("
    ", nwobj.MemberNames.Split('|'))}"); @@ -494,8 +494,8 @@ private void appendNetworkServicesForManagementHtml(ref StringBuilder report, re { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{svcobj.Name}"); - report.AppendLine($"{svcobj.Name}"); + report.AppendLine($"{svcobj.Name}"); + report.AppendLine($"{(svcobj.Type.Name != "" ? userConfig.GetText(svcobj.Type.Name) : "")}"); report.AppendLine($"{((svcobj.Type.Name!=ObjectType.Group && svcobj.Protocol != null) ? svcobj.Protocol.Name : "")}"); if (svcobj.DestinationPortEnd != null && svcobj.DestinationPortEnd != svcobj.DestinationPort) report.AppendLine($"{svcobj.DestinationPort}-{svcobj.DestinationPortEnd}"); @@ -533,8 +533,8 @@ private void appendUsersForManagementHtml(ref StringBuilder report, ref int objN { report.AppendLine(""); report.AppendLine($"{objNumber++}"); - report.AppendLine($"{userobj.Name}"); - report.AppendLine($"{userobj.Name}"); + report.AppendLine($"{userobj.Name}"); + report.AppendLine($"{(userobj.Type.Name != "" ? userConfig.GetText(userobj.Type.Name) : "")}"); if (userobj.MemberNames != null && userobj.MemberNames.Contains("|")) report.AppendLine($"{string.Join("
    ", userobj.MemberNames.Split('|'))}"); else diff --git a/roles/test/files/FWO.Test/ExportTest.cs b/roles/test/files/FWO.Test/ExportTest.cs index fab23d6ed..9328e73cc 100644 --- a/roles/test/files/FWO.Test/ExportTest.cs +++ b/roles/test/files/FWO.Test/ExportTest.cs @@ -61,10 +61,10 @@ public void RulesGenerateHtml() "" + "" + "

    Rules Report

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "" + @@ -82,19 +82,19 @@ public void RulesGenerateHtml() "
    No.NameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    denynoneYuid2:123comment2
    " + "

    Network Objects


    " + "" + - "" + - "" + - "" + + "" + + "" + + "" + "
    No.NameTypeIP AddressMembersUidComment
    1TestIp1network1.2.3.4/32
    2TestIp2network127.0.0.1/32
    3TestIpRangeip_range1.2.3.4-1.2.3.5
    1TestIp1Network1.2.3.4/32
    2TestIp2Network127.0.0.1/32
    3TestIpRangeIP Range1.2.3.4-1.2.3.5
    " + "

    Network Services


    " + "" + - "" + - "" + + "" + + "" + "
    No.NameTypeProtocolPortMembersUidComment
    1TestService1TestService1TCP443
    2TestService2TestService2UDP6666-7777
    1TestService1TCP443
    2TestService2UDP6666-7777
    " + "

    Users


    " + "" + - "" + - "" + + "" + + "" + "
    No.NameTypeMembersUidComment
    1TestUser1TestUser1
    2TestUser2TestUser2
    1TestUser1
    2TestUser2Group
    "; Assert.AreEqual(expectedHtmlResult, removeLinebreaks(removeGenDate(reportRules.ExportToHtml(), true))); } @@ -112,10 +112,10 @@ public void ResolvedRulesGenerateHtml() "" + "" + "

    Rules Report (resolved)

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "" + @@ -148,10 +148,10 @@ public void ResolvedRulesTechGenerateHtml() "" + "" + "

    Rules Report (technical)

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "
    No.NameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    " + @@ -184,10 +184,10 @@ public void UnusedRulesGenerateHtml() "" + "" + "

    Unused Rules Report

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "
    No.NameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    " + @@ -205,19 +205,19 @@ public void UnusedRulesGenerateHtml() "
    No.Last HitNameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    denynoneYuid2:123comment2
    " + "

    Network Objects


    " + "" + - "" + - "" + - "" + + "" + + "" + + "" + "
    No.NameTypeIP AddressMembersUidComment
    1TestIp1network1.2.3.4/32
    2TestIp2network127.0.0.1/32
    3TestIpRangeip_range1.2.3.4-1.2.3.5
    1TestIp1Network1.2.3.4/32
    2TestIp2Network127.0.0.1/32
    3TestIpRangeIP Range1.2.3.4-1.2.3.5
    " + "

    Network Services


    " + "" + - "" + - "" + + "" + + "" + "
    No.NameTypeProtocolPortMembersUidComment
    1TestService1TestService1TCP443
    2TestService2TestService2UDP6666-7777
    1TestService1TCP443
    2TestService2UDP6666-7777
    " + "

    Users


    " + "" + - "" + - "" + + "" + + "" + "
    No.NameTypeMembersUidComment
    1TestUser1TestUser1
    2TestUser2TestUser2
    1TestUser1
    2TestUser2Group
    "; Assert.AreEqual(expectedHtmlResult, removeLinebreaks(removeGenDate(reportRules.ExportToHtml(), true))); } @@ -235,10 +235,10 @@ public void RecertReportGenerateHtml() "" + "" + "

    Recertification Report

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "" + @@ -275,17 +275,17 @@ public void RecertReportGenerateHtml() "" + "
    No.Next Recertification DateOwnerIP address matchLast HitNameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    uid2:123comment2
    " + "

    Network Objects


    " + - "" + - "" + - "" + + "" + + "" + + "" + "
    No.NameTypeIP AddressMembersUidComment
    1TestIp1network1.2.3.4/32
    2TestIp2network127.0.0.1/32
    3TestIpRangeip_range1.2.3.4-1.2.3.5
    1TestIp1Network1.2.3.4/32
    2TestIp2Network127.0.0.1/32
    3TestIpRangeIP Range1.2.3.4-1.2.3.5
    " + "

    Network Services


    " + - "" + - "" + + "" + + "" + "
    No.NameTypeProtocolPortMembersUidComment
    1TestService1TestService1TCP443
    2TestService2TestService2UDP6666-7777
    1TestService1TCP443
    2TestService2UDP6666-7777
    " + "

    Users


    " + - "" + - "" + + "" + + "" + "
    No.NameTypeMembersUidComment
    1TestUser1TestUser1
    2TestUser2TestUser2
    1TestUser1
    2TestUser2Group
    "; Assert.AreEqual(expectedHtmlResult, removeLinebreaks(removeGenDate(reportRecerts.ExportToHtml(), true))); } @@ -303,10 +303,10 @@ public void NatRulesGenerateHtml() "" + "" + "

    NAT Rules Report

    " + - "

    Filter: TestFilter

    " + "

    Time of configuration: 2023-04-20T15:50:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "" + @@ -324,18 +324,18 @@ public void NatRulesGenerateHtml() "" + "
    No.NameSource ZoneSourceDestination ZoneDestinationServicesTranslated SourceTranslated DestinationTranslated ServicesEnabledUidComment
    uid1comment1
    " + "

    Network Objects


    " + - "" + - "" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + + "" + "
    No.NameTypeIP AddressMembersUidComment
    1TestIp1network1.2.3.4/32
    2TestIp2network127.0.0.1/32
    3TestIpRangeip_range1.2.3.4-1.2.3.5
    4TestIpNewnetwork10.0.6.0/24
    5TestIp1Changedhost2.3.4.5
    1TestIp1Network1.2.3.4/32
    2TestIp2Network127.0.0.1/32
    3TestIpRangeIP Range1.2.3.4-1.2.3.5
    4TestIpNewNetwork10.0.6.0/24
    5TestIp1ChangedHost2.3.4.5
    " + "

    Network Services


    " + - "" + - "" + + "" + + "" + "
    No.NameTypeProtocolPortMembersUidComment
    1TestService1TestService1TCP443
    2TestService2TestService2UDP6666-7777
    1TestService1TCP443
    2TestService2UDP6666-7777
    " + "

    Users


    " + - "" + + "" + "
    No.NameTypeMembersUidComment
    1TestUser2TestUser2
    1TestUser2Group
    "; Assert.AreEqual(expectedHtmlResult, removeLinebreaks(removeGenDate(reportNatRules.ExportToHtml(), true))); } @@ -353,10 +353,10 @@ public void ChangesGenerateHtml() "" + "" + "

    Changes Report

    " + - "

    Filter: TestFilter

    " + "

    Change Time: from: 2023-04-19T15:00:04Z, until: 2023-04-20T15:00:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "" + @@ -419,10 +419,10 @@ public void ResolvedChangesGenerateHtml() "" + "" + "

    Changes Report (resolved)

    " + - "

    Filter: TestFilter

    " + "

    Change Time: from: 2023-04-19T15:00:04Z, until: 2023-04-20T15:00:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "
    Change TimeChange TypeNameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    " + @@ -481,10 +481,10 @@ public void ResolvedChangesTechGenerateHtml() "" + "" + "

    Changes Report (technical)

    " + - "

    Filter: TestFilter

    " + "

    Change Time: from: 2023-04-19T15:00:04Z, until: 2023-04-20T15:00:04Z (UTC)

    " + "

    Generated on: Z (UTC)

    " + - "

    Devices: TestMgt [TestDev]


    " + + "

    Devices: TestMgt [TestDev]

    " + + "

    Filter: TestFilter


    " + "

    TestMgt


    " + "

    TestDev


    " + "
    Change TimeChange TypeNameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    " + @@ -544,11 +544,54 @@ public void ConnectionsGenerateHtml() "" + "" + "

    Connections Report

    " + - "

    Filter: TestFilter

    " + "

    Generated on: Z (UTC)

    " + - "

    Owners: TestOwner


    " + + "

    Owners: TestOwner

    " + + "

    Filter: TestFilter


    " + "

    TestOwner

    " + - + "

    Connections

    Change TimeChange TypeNameSource ZoneSourceDestination ZoneDestinationServicesActionTrackEnabledUidComment
    " + + "" + + "" + + "" + + "" + + "
    No.IdNameFunctional ReasonSourceServicesDestination
    1101Conn1 AppServer1 (1.0.0.0) ServiceGroup1
    " + + " Service1 (1234/TCP)
     AppRole1 ()

    " + + "

    Interfaces

    " + + "" + + "" + + "" + + "
    No.IdNameFunctional ReasonSourceServicesDestination
    1102Inter2 
    " + + " Service2 (2345/UDP)
      ()
    " + + " AppServer2 (2.0.0.0)

    " + + "

    Own Common Services

    " + + "" + + "" + + "" + + "" + + "
    No.IdNameFunctional ReasonSourceServicesDestination
    1103ComSvc3 AppServer1 (1.0.0.0) 
    " + + " Service2 (2345/UDP)
     AppServer2 (2.0.0.0)

    " + + + "

    Network Objects

    " + + "" + + "" + + "" + + "" + + "" + + "
    No.IdNameIp
    121AppRole1
    20
    311AppServer11.0.0.0
    412AppServer22.0.0.0

    " + + "

    Network Services

    " + + "" + + "" + + "" + + "" + + "" + + "
    No.IdNameProtocolPort
    141ServiceGroup1
    231Service1TCP1234
    30
    432Service2UDP2345

    " + + + "

    Global Common Services

    " + + "" + + "" + + "" + + "" + + "
    No.IdOwnerNameFunctional ReasonSourceServicesDestination
    1103App1ComSvc3AppServer1 (1.0.0.0)
    " + + "Service2 (2345/UDP)
    AppServer2 (2.0.0.0)

    " + ""; Assert.AreEqual(expectedHtmlResult, removeLinebreaks(removeGenDate(reportConnections.ExportToHtml(), true))); } @@ -1214,21 +1257,59 @@ private ReportData ConstructChangeReport(bool resolved) }; } - private ReportData ConstructConnectionReport(bool resolved) + private static ReportData ConstructConnectionReport(bool resolved) { - return new ReportData() + ModellingAppServer AppServer1 = new() {Id = 11, Number = 1, Name = "AppServer1", Ip = "1.0.0.0"}; + ModellingAppServer AppServer2 = new() {Id = 12, Number = 2, Name = "AppServer2", Ip = "2.0.0.0"}; + ModellingAppRole AppRole1 = new() { Id = 21, Number = 3, Name = "AppRole1", Comment = "CommAR1", AppServers = new() { new() { Content = AppServer1 } } }; + ModellingService Service1 = new() { Id = 31, Number = 1, Name = "Service1", Port = 1234, Protocol = new() { Name = "TCP" } }; + ModellingService Service2 = new() { Id = 32, Number = 2, Name = "Service2", Port = 2345, Protocol = new() { Name = "UDP" } }; + ModellingServiceGroup ServiceGroup1 = new() { Id = 41, Number = 3, Name = "ServiceGroup1", Comment = "CommSG1", Services = new(){ new() { Content = Service1 } } }; + ModellingConnection Conn1 = new() + { + Id = 101, Name = "Conn1", + SourceAppServers = new(){ new() { Content = AppServer1 } }, + DestinationAppRoles = new(){ new() { Content = AppRole1 } }, + Services = new(){ new() { Content = Service1 } }, + ServiceGroups = new(){ new() { Content = ServiceGroup1 } } + }; + ModellingConnection Inter2 = new() + { + Id = 102, Name = "Inter2", + DestinationAppServers = new(){ new() { Content = AppServer2 } }, + DestinationAppRoles = new(){ new() {} }, + Services = new(){ new() { Content = Service2 } }, + ServiceGroups = new(){ new() {} } + }; + ModellingConnection ComSvc3 = new() + { + Id = 103, Name = "ComSvc3", App = new(){ Name = "App1" }, + SourceAppServers = new(){ new() { Content = AppServer1 } }, + DestinationAppServers = new(){ new() { Content = AppServer2 } }, + Services = new(){ new() { Content = Service2 } }, + ServiceGroups = new(){ new() {} } + }; + + ReportData reportData = new () { - OwnerData = new List() + OwnerData = new () { new () { Name = "TestOwner", + Connections = new(){ Conn1, Inter2, ComSvc3 }, + RegularConnections = new(){ Conn1 }, + Interfaces = new(){ Inter2 }, + CommonServices = new(){ ComSvc3 }, } - } + }, + GlobalComSvc = new(){ ComSvc3 } }; + reportData.OwnerData.First().PrepareObjectData(); + return reportData; } - private string removeGenDate(string exportString, bool html = false, bool json = false) + private static string removeGenDate(string exportString, bool html = false, bool json = false) { string dateText = html ? "

    Generated on: " : "report generation date" + (json ? "\"" : "") + ": " + (json ? "\"" : ""); int startGenTime = exportString.IndexOf(dateText); @@ -1239,7 +1320,7 @@ private string removeGenDate(string exportString, bool html = false, bool json = return exportString; } - private string removeLinebreaks(string exportString) + private static string removeLinebreaks(string exportString) { while(exportString.Contains("\n ")) { diff --git a/roles/test/files/FWO.Test/SimulatedUserConfig.cs b/roles/test/files/FWO.Test/SimulatedUserConfig.cs index 23de82cb3..0e00ffbbc 100644 --- a/roles/test/files/FWO.Test/SimulatedUserConfig.cs +++ b/roles/test/files/FWO.Test/SimulatedUserConfig.cs @@ -59,7 +59,19 @@ internal class SimulatedUserConfig : UserConfig {"C9002","This App Server was..."}, {"is_in_use","Is in use"}, {"devices","Devices"}, - {"owners","Owners"} + {"owners","Owners"}, + {"filter","Filter"}, + {"id","Id"}, + {"ip","Ip"}, + {"group","Group"}, + {"host","Host"}, + {"network","Network"}, + {"ip_range","IP Range"}, + {"connections","Connections"}, + {"interfaces","Interfaces"}, + {"own_common_services","Own Common Services"}, + {"global_common_services","Global Common Services"}, + {"func_reason","Functional Reason"} }; public override string GetText(string key) diff --git a/roles/ui/files/FWO.UI/Pages/Help/HelpReportingLeftSidebar.cshtml b/roles/ui/files/FWO.UI/Pages/Help/HelpReportingLeftSidebar.cshtml index 3f2d6990f..79b7601d6 100644 --- a/roles/ui/files/FWO.UI/Pages/Help/HelpReportingLeftSidebar.cshtml +++ b/roles/ui/files/FWO.UI/Pages/Help/HelpReportingLeftSidebar.cshtml @@ -31,5 +31,6 @@

  • @(Html.Raw(userConfig.GetText("H1510")))
  • @(Html.Raw(userConfig.GetText("H1511")))
  • @(Html.Raw(userConfig.GetText("H1503")))
  • +
  • @(Html.Raw(userConfig.GetText("H1512")))
  • diff --git a/roles/ui/files/FWO.UI/Shared/ObjectGroup.razor b/roles/ui/files/FWO.UI/Shared/ObjectGroup.razor index cda19bdcb..d21e8d7b6 100644 --- a/roles/ui/files/FWO.UI/Shared/ObjectGroup.razor +++ b/roles/ui/files/FWO.UI/Shared/ObjectGroup.razor @@ -51,7 +51,7 @@ - + @@ -119,7 +119,7 @@ - + @if (context.Type.Name != ObjectType.Group) { @@ -193,7 +193,7 @@ - + @if (context.Type != null && context.Type.Name == ObjectType.Group && context.UserGroups != null && context.UserGroupFlats != null)