From deb4b5b6faf50399929b82011fcc26e06ed88d5c Mon Sep 17 00:00:00 2001 From: karamchandan <amit.kbatra@alumnos.upm.es> Date: Fri, 7 Jul 2023 13:09:08 +0200 Subject: [PATCH] Updated deploy scripts, added README and added latest Grafana dashboard to scenario_3/l3 folder --- src/tests/scenario3/l3/README.md | 12 +- src/tests/scenario3/l3/complete_deploy.sh | 23 - ..._detection_and_mitigation.sh => deploy.sh} | 8 +- src/tests/scenario3/l3/grafana_dashboard.json | 1211 +++++++++++++++++ ...ttack_detection_and_mitigation_complete.sh | 26 - src/tests/scenario3/l3/run.sh | 29 + 6 files changed, 1251 insertions(+), 58 deletions(-) delete mode 100755 src/tests/scenario3/l3/complete_deploy.sh rename src/tests/scenario3/l3/{launch_l3_attack_detection_and_mitigation.sh => deploy.sh} (90%) mode change 100644 => 100755 create mode 100644 src/tests/scenario3/l3/grafana_dashboard.json delete mode 100644 src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh create mode 100644 src/tests/scenario3/l3/run.sh diff --git a/src/tests/scenario3/l3/README.md b/src/tests/scenario3/l3/README.md index f66d8e351..2e243997d 100644 --- a/src/tests/scenario3/l3/README.md +++ b/src/tests/scenario3/l3/README.md @@ -1,3 +1,9 @@ -# Scripts to automatically run the "Attack Detection & Mitigation at the L3 Layer" workflow (Scenario 3). -"launch_l3_attack_detection_and_mitigation.sh" launches the TeraFlow OS components, which includes the CentralizedAttackDetector and AttackMitigator componentes necessary to perform this workflow. -"launch_l3_attack_detection_and_mitigation_complete.sh" also launches the DistributedAttackDetector, which monitors the network data plane and passively collects traffic packets and aggregates them in network flows, which are then provided to the CentralizedAttackDetector to detect attacks that may be occurring in the network. +# Demonstration of a L3 Cybersecurity Components for Attack Detection and Mitigation + +__Authors__: Partners of Universidad Politécnica de Madrid and Telefónica I+D + +## Executing + +```bash +python src/tests/scenario3/l3/run.sh +``` \ No newline at end of file diff --git a/src/tests/scenario3/l3/complete_deploy.sh b/src/tests/scenario3/l3/complete_deploy.sh deleted file mode 100755 index 5e8a2772c..000000000 --- a/src/tests/scenario3/l3/complete_deploy.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -./src/tests/ofc22/run_test_03_delete_service.sh -./src/tests/ofc22/run_test_04_cleanup.sh -source src/tests/ofc22/deploy_specs.sh -source my_deploy.sh -./deploy/all.sh -source tfs_runtime_env_vars.sh -ofc22/run_test_01_bootstrap.sh -ofc22/run_test_02_create_service.sh diff --git a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh b/src/tests/scenario3/l3/deploy.sh old mode 100644 new mode 100755 similarity index 90% rename from src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh rename to src/tests/scenario3/l3/deploy.sh index a22d98bad..e8e02b026 --- a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh +++ b/src/tests/scenario3/l3/deploy.sh @@ -13,12 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -cd /home/ubuntu/tfs-ctrl -source my_deploy.sh -./deploy.sh -./show_deploy.sh - +source deploy_specs.sh +./deploy/all.sh source tfs_runtime_env_vars.sh - ofc22/run_test_01_bootstrap.sh ofc22/run_test_02_create_service.sh diff --git a/src/tests/scenario3/l3/grafana_dashboard.json b/src/tests/scenario3/l3/grafana_dashboard.json new file mode 100644 index 000000000..337693129 --- /dev/null +++ b/src/tests/scenario3/l3/grafana_dashboard.json @@ -0,0 +1,1211 @@ +{ + "overwrite": true, + "folderId": 0, + "dashboard": { + "id": null, + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "iteration": 1675103296430, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, service_id, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type}) AND kpi_sample_type LIKE 'L3_SECURITY_STATUS_CRYPTO'\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 Security Status Crypto", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {kpi_sample_type=\\\"([^\\\"]+)\\\", service_id=\\\"([^\\\"]+)\\\"}", + "renamePattern": "Security Status Crypto - L3 (Service Id: $2)" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#2635d4", + "mode": "fixed" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 8, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, service_id, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type}) AND kpi_sample_type LIKE 'ML_CONFIDENCE'\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 ML Confidence", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {kpi_sample_type=\\\"([^\\\"]+)\\\", service_id=\\\"([^\\\"]+)\\\"}", + "renamePattern": "ML Confidence - L3 (Service Id: $2)" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "dark-orange", + "mode": "fixed" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 16, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, service_id, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type}) AND kpi_sample_type LIKE 'L3_UNIQUE_ATTACK_CONNS'\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 Unique Attack Connections", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {kpi_sample_type=\\\"([^\\\"]+)\\\", service_id=\\\"([^\\\"]+)\\\"}", + "renamePattern": "Unique Attack Connections - L3 (Service Id: $2)" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#ad3fe3", + "mode": "fixed" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, service_id, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type}) AND kpi_sample_type LIKE 'L3_UNIQUE_COMPROMISED_CLIENTS'\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 Unique Compromised Clients", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {kpi_sample_type=\\\"([^\\\"]+)\\\", service_id=\\\"([^\\\"]+)\\\"}", + "renamePattern": "Unique Compromised Clients - L3 (Service Id: $2)" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#f6ca1b", + "mode": "fixed" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, service_id, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type}) AND kpi_sample_type LIKE 'L3_UNIQUE_ATTACKERS'\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 Unique Attackers", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {kpi_sample_type=\\\"([^\\\"]+)\\\", service_id=\\\"([^\\\"]+)\\\"}", + "renamePattern": "Unique Attackers - L3 (Service Id: $2)" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*PACKETS_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "left" + }, + { + "id": "unit", + "value": "pps" + }, + { + "id": "custom.axisLabel", + "value": "Packets / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*BYTES_.*" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "right" + }, + { + "id": "unit", + "value": "Bps" + }, + { + "id": "custom.axisLabel", + "value": "Bytes / sec" + }, + { + "id": "custom.axisSoftMin", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 19, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "first", + "min", + "mean", + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "kpi_value", + "rawQuery": true, + "rawSql": "SELECT\r\n $__time(timestamp), kpi_value AS metric, device_name, endpoint_name, kpi_sample_type\r\nFROM\r\n tfs_monitoring\r\nWHERE\r\n $__timeFilter(timestamp) AND device_name IN (${device_name}) AND endpoint_name IN (${endpoint_name}) AND kpi_sample_type IN (${kpi_sample_type})\r\nGROUP BY\r\n device_name, endpoint_name, kpi_sample_type\r\nORDER BY\r\n timestamp", + "refId": "A", + "select": [ + [ + { + "params": [ + "kpi_value" + ], + "type": "column" + } + ] + ], + "table": "monitoring", + "timeColumn": "timestamp", + "where": [ + { + "name": "", + "params": [ + "device_id", + "IN", + "$device_id" + ], + "type": "expression" + } + ] + } + ], + "title": "L3 Monitoring Packets/Bytes Received/Sent", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "metric {device_name=\\\"([^\\\"]+)\\\", endpoint_name=\\\"([^\\\"]+)\\\", kpi_sample_type=\\\"([^\\\"]+)\\\"}", + "renamePattern": "$3 ($1 : $2)" + } + } + ], + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 36, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "definition": "SELECT DISTINCT device_name FROM tfs_monitoring;", + "hide": 0, + "includeAll": true, + "label": "Device", + "multi": true, + "name": "device_name", + "options": [], + "query": "SELECT DISTINCT device_name FROM tfs_monitoring;", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "definition": "SELECT DISTINCT endpoint_name FROM tfs_monitoring WHERE device_name IN (${device_name})", + "hide": 0, + "includeAll": true, + "label": "EndPoint", + "multi": true, + "name": "endpoint_name", + "options": [], + "query": "SELECT DISTINCT endpoint_name FROM tfs_monitoring WHERE device_name IN (${device_name})", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "postgres", + "uid": "questdb" + }, + "definition": "SELECT DISTINCT kpi_sample_type FROM tfs_monitoring;", + "hide": 0, + "includeAll": true, + "label": "Kpi Sample Type", + "multi": true, + "name": "kpi_sample_type", + "options": [], + "query": "SELECT DISTINCT kpi_sample_type FROM tfs_monitoring;", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "L3 Monitoring", + "uid": "tf-l3-monit", + "version": 6, + "weekStart": "" + } +} \ No newline at end of file diff --git a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh b/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh deleted file mode 100644 index 05b20077e..000000000 --- a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cd /home/ubuntu/tfs-ctrl -source my_deploy.sh -./deploy.sh -./show_deploy.sh - -source tfs_runtime_env_vars.sh - -ofc22/run_test_01_bootstrap.sh -ofc22/run_test_02_create_service.sh - -sshpass -p "ubuntu" ssh -o StrictHostKeyChecking=no -n -f ubuntu@192.168.165.73 "sh -c 'nohup /home/ubuntu/TeraflowDockerDistributed/restart.sh > /dev/null 2>&1 &'" diff --git a/src/tests/scenario3/l3/run.sh b/src/tests/scenario3/l3/run.sh new file mode 100644 index 000000000..c62ea89ea --- /dev/null +++ b/src/tests/scenario3/l3/run.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Deploy TeraFlowSDN with L3 Cybersecurity Components for Attack Detection and Mitigation +echo "Deploying TFS with L3 Cybersecurity Components for Attack Detection and Mitigation..." +./deploy.sh +echo "TFS deployed." + +# Deploy Distributed Attack Detector +if $DAD_NODE_PASSWORD == "" || $DAD_NODE_IP == ""; then + echo "Please set the DAD_NODE_PASSWORD and DAD_NODE_IP environment variables." + exit 1 +fi + +echo "Deploying Distributed Attack Detector..." +sshpass -p $DAD_NODE_PASSWORD ssh -o StrictHostKeyChecking=no -n -f ubuntu@$DAD_NODE_IP "sh -c 'nohup /home/ubuntu/TeraflowDockerDistributed/restart.sh > /dev/null 2>&1 &'" +echo "Distributed Attack Detector deployed." \ No newline at end of file -- GitLab