Skip to content
Snippets Groups Projects
Commit 06d38829 authored by delacal's avatar delacal
Browse files

- Added EndpointId in the Centralized Attack Detector component.

- Enabled the correct code in the Attack Mitigator component to properly configure ACL rules in the corresponding service to block detected attack connections.
parent 064ffb26
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!93Updated L3 components + scalability
...@@ -146,8 +146,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): ...@@ -146,8 +146,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer):
) )
acl_entry.match.src_address = "{}/32".format(src_ip) acl_entry.match.src_address = "{}/32".format(src_ip)
acl_entry.match.dst_address = "{}/32".format(dst_ip) acl_entry.match.dst_address = "{}/32".format(dst_ip)
acl_entry.match.src_port = src_port acl_entry.match.src_port = int(src_port)
acl_entry.match.dst_port = dst_port acl_entry.match.dst_port = int(dst_port)
# TODO: update the following parameters; for instance, add them as parameters of the method configure_acl_rule # TODO: update the following parameters; for instance, add them as parameters of the method configure_acl_rule
acl_entry.action.forward_action = AclForwardActionEnum.ACLFORWARDINGACTION_DROP acl_entry.action.forward_action = AclForwardActionEnum.ACLFORWARDINGACTION_DROP
acl_entry.action.log_action = AclLogActionEnum.ACLLOGACTION_NOLOG acl_entry.action.log_action = AclLogActionEnum.ACLLOGACTION_NOLOG
...@@ -194,23 +194,23 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): ...@@ -194,23 +194,23 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer):
LOGGER.info("Service obtained from ServiceId:\n{}".format(service)) LOGGER.info("Service obtained from ServiceId:\n{}".format(service))
# Old version # Old version
config_rule = self.GetConfigRule(ip_o, ip_d, port_o, port_d) # config_rule = self.GetConfigRule(ip_o, ip_d, port_o, port_d)
service_config = ServiceConfig() # service_config = ServiceConfig()
service_config.config_rules.extend([config_rule]) # service_config.config_rules.extend([config_rule])
service.service_config.CopyFrom(service_config) # service.service_config.CopyFrom(service_config)
# New version # New version
# self.configure_acl_rule( self.configure_acl_rule(
# context_uuid=service_id.context_id.context_uuid.uuid, context_uuid=service_id.context_id.context_uuid.uuid,
# service_uuid=service_id.service_uuid.uuid, service_uuid=service_id.service_uuid.uuid,
# device_uuid=request.device_id.device_uuid.uuid, device_uuid=request.endpoint_id.device_id.device_uuid.uuid,
# endpoint_uuid=request.endpoint_id.endpoint_uuid.uuid, endpoint_uuid=request.endpoint_id.endpoint_uuid.uuid,
# src_ip=ip_o, src_ip=ip_o,
# dst_ip=ip_d, dst_ip=ip_d,
# src_port=port_o, src_port=port_o,
# dst_port=port_d, dst_port=port_d,
# ) )
LOGGER.info("Service with new rule:\n{}".format(service)) LOGGER.info("Service with new rule:\n{}".format(service))
self.UpdateService(service) self.UpdateService(service)
......
...@@ -112,6 +112,7 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto ...@@ -112,6 +112,7 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto
"port_d": request.port_d, "port_d": request.port_d,
"ml_id": "RandomForest", "ml_id": "RandomForest",
"service_id": request.service_id, "service_id": request.service_id,
"endpoint_id": request.endpoint_id,
"time_start": request.time_start, "time_start": request.time_start,
"time_end": request.time_end, "time_end": request.time_end,
} }
...@@ -203,4 +204,3 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto ...@@ -203,4 +204,3 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto
k = np.sum(k) k = np.sum(k)
return self.make_inference(k) return self.make_inference(k)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment