Draft: Initial implementation of the optical cybersecurity loop

The changes are mainly to four components:

  • DBSCANServing
  • Optical Attack Manager
  • Optical Attack Detector
  • Optical Attack Mitigator

The changes include:

  • Improvements in the names of the components, i.e., by removing the unnecessary "centralized" term
  • Improvements to the building of images, now using a standard teraflow user for all images
  • Inclusion of the .dockerignore file to prevent Docker to copy generated photo files
  • Inclusion of the generation of async proto files needed for the attack manager
  • Inclusion of the four components to the specification in my_deploy.sh
  • Inclusion of the four services to the common.Constants file
  • Update to specific Python 3.9 version
  • Updates to the gitlab-ci yaml files

Still to do:

  • Fix the tests of the optical attack manager
Edited by Lluis Gifre Renom

Merge request reports

Loading
+43 −26
Changes for manifests/cachingservice.yaml: 43 added lines, 26 removed lines.
Original line number Diff line number Diff line
@@ -12,29 +12,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

# General settings
LOG_LEVEL = logging.DEBUG

# gRPC settings
GRPC_SERVICE_PORT = 10005
GRPC_MAX_WORKERS  = 10
GRPC_GRACE_PERIOD = 60

# service settings
MONITORING_INTERVAL = 2  # monitoring interval in seconds
#TODO: adjust the addresses below for the specific case
MONITORING_SERVICE_ADDRESS = 'monitoringservice'  # address/name of the monitoring service
# MONITORING_SERVICE_ADDRESS = '10.99.41.20'  # address/name of the monitoring service
CONTEXT_SERVICE_ADDRESS = 'contextservice'  # address/name of the monitoring service
# CONTEXT_SERVICE_ADDRESS = '10.107.199.65'  # address/name of the monitoring service
SERVICE_SERVICE_ADDRESS = 'serviceservice'  # address/name of the service service
# SERVICE_SERVICE_ADDRESS = '10.99.234.88'  # address/name of the service service
# INFERENCE_SERVICE_ADDRESS = '10.108.113.78'  # address/name of the inference service
INFERENCE_SERVICE_ADDRESS = 'dbscanservingservice'  # address/name of the inference service
# ATTACK_MITIGATOR_SERVICE_ADDRESS = '10.96.248.167'
ATTACK_MITIGATOR_SERVICE_ADDRESS = 'opticalattackmitigatorservice'

# Prometheus settings
METRICS_PORT = 9192
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cachingservice
spec:
  selector:
    matchLabels:
      app: cachingservice
  template:
    metadata:
      labels:
        app: cachingservice
    spec:
      containers:
      - name: redis
        image: redis:7.0-alpine
        env:
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: redis-secrets
              key: REDIS_PASSWORD
        ports:
        - containerPort: 6379
          name: client
        command: ["redis-server"]
        args:
        - --requirepass
        - $(REDIS_PASSWORD)
---
apiVersion: v1
kind: Service
metadata:
  name: cachingservice
spec:
  type: ClusterIP
  selector:
    app: cachingservice
  ports:
  - name: redis
    port: 6379
    targetPort: 6379
+5 −5
Changes for manifests/dbscanservingservice.yaml: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -31,16 +31,16 @@ spec:
        image: registry.gitlab.com/teraflow-h2020/controller/dbscanserving:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10006
        - containerPort: 10008
        env:
        - name: LOG_LEVEL
          value: "DEBUG"
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
            command: ["/bin/grpc_health_probe", "-addr=:10008"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
            command: ["/bin/grpc_health_probe", "-addr=:10008"]
        resources:
          requests:
            cpu: 250m
@@ -59,5 +59,5 @@ spec:
    app: dbscanservingservice
  ports:
  - name: grpc
    port: 10006
    targetPort: 10006
    port: 10008
    targetPort: 10008
+68
Changes for manifests/opticalattackdetectorservice.yaml: 68 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: opticalattackdetectorservice
spec:
  selector:
    matchLabels:
      app: opticalattackdetectorservice
  template:
    metadata:
      labels:
        app: opticalattackdetectorservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/opticalattackdetector:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10006
        env:
        - name: LOG_LEVEL
          value: "DEBUG"
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: redis-secrets
              key: REDIS_PASSWORD
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10006"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
          limits:
            cpu: 700m
            memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: opticalattackdetectorservice
spec:
  type: ClusterIP
  selector:
    app: opticalattackdetectorservice
  ports:
  - name: grpc
    port: 10006
    targetPort: 10006
+9 −15
Changes for manifests/opticalattackmanagerservice.yaml: 9 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -15,32 +15,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
  name: opticalcentralizedattackdetectorservice
  name: opticalattackmanagerservice
spec:
  selector:
    matchLabels:
      app: opticalcentralizedattackdetectorservice
      app: opticalattackmanagerservice
  template:
    metadata:
      labels:
        app: opticalcentralizedattackdetectorservice
        app: opticalattackmanagerservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/opticalcentralizedattackdetector:latest
        image: registry.gitlab.com/teraflow-h2020/controller/opticalattackmanager:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10005
        envFrom:
          - secretRef:
              name: monitoring-secrets
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10005"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10005"]
        env:
        - name: LOG_LEVEL
          value: "DEBUG"
        resources:
          requests:
            cpu: 250m
@@ -52,11 +46,11 @@ spec:
apiVersion: v1
kind: Service
metadata:
  name: opticalcentralizedattackdetectorservice
  name: opticalattackmanagerservice
spec:
  type: ClusterIP
  selector:
    app: opticalcentralizedattackdetectorservice
    app: opticalattackmanagerservice
  ports:
  - name: grpc
    port: 10005
−38

File deleted.

Loading
Loading