Fin protocol

Specification of the SOARCA Fin protocol

Goals

The goal of the protocol is to provide a simple and robust way to communicate between the SOARCA orchestrator and the capabilities (Fins) that can provide extra functions.

MQTT

To allow for dynamic communication MQTT is used to provide the backbone for the fin communication. SOARCA can be configured using the environment to use MQTT or just run stand-alone.

The Fin will use the protocol to register itself to SOARCA via the register message. Once register, it will communicate over the channel new channel designated by the fin UUID.

Commands to a specific capability will be communicated of the capability UUID channel.

Messages

Messages defined in the protocol

  • ack
  • nack
  • register
  • unregister
  • command
  • pause
  • resume
  • stop

legend

|field |content |type |description |field name have the (optional) key if the field is not required |content indication |type of the value could be string, int etc. |A description for the field to provide extra information and context

ack

The ack message is used to acknowledge messages.

fieldcontenttypedescription
typeackstringThe ack message type
message_idUUIDstringmessage id that the ack is referring to
@startjson
{
    "type": "ack",
    "message_id": "uuid"
}
@endjson

nack

The nack message is used to non acknowledgements, message was unimplemented or unsuccessful.

fieldcontenttypedescription
typenackstringThe ack message type
message_idUUIDstringmessage id that the nack is referring to
@startjson
{
    "type": "nack",
    "message_id": "uuid"
}
@endjson

register

The message is used to register a fin to SOARCA. It has the following payload.

fieldcontenttypedescription
typeregisterstringThe register message type
message_idUUIDstringMessage UUID
fin_idUUIDstringFin uuid separate form the capability id
NameNamestringFin name
protocol_versionversionstringVersion information of the protocol in semantic version schema e.g. 1.2.4-beta
securitysecurity informationSecuritySecurity information for protocol see security structure
capabilitieslist of capability structurelist of capability structureCapability structure information for protocol see security structure
metameta dictMetaMeta information for the fin protocol structure

capability structure

fieldcontenttypedescription
capability_idUUIDstringCapability id to identify the unique capability a fin can have multiple
typeactionworkflow-step-type-enumMost common is action
namenamestringcapability name
versionversionstringVersion information of the Fin implementation used in semantic version schema e.g. 1.2.4-beta
stepstep structurestep structureStep to specify an example for the step so it can be queried in the SOARCA API
agentagent structureagent structureAgent to specify the agent definition to match in playbooks for SOARCA

step structure

fieldcontenttypedescription
typeactionstringAction type
namenamestringmessage id
descriptiondescriptionstringDescription of the step
external_referenceslist of external referenceReferences to external recourses to further enhance the step also see CACAO V2 10.9.
commandcommandstringCommand to execute
targetUUIDstringTarget UUID cto execute command against

agent structure

fieldcontenttypedescription
typesoarca-finstringSOARCA Fin type, a custom type used to specify Fins
namenamestringSOARCA Fin name in the following form: soarca-fin-<name>-<uuid>, this grantees the fin is unique
@startjson
{
    "type": "register",
    "message_id": "uuid",
    "fin_id" : "uuid",
    "name": "Fin name",
    "protocol_version": "<semantic-version>",
    "security": {
        "version": "0.0.0",
        "channel_security": "plaintext"
    },
    "capabilities": [
        {
            "capability_id": "uuid",
            "name": "ssh executer",
            "version": "0.1.0", 
            "step": { 
                "type": "action",
                "name": "<step_name>",
                "description": "<description>",
                "external_references": { 
                    "name": "<reference name>",
                    "...": "..."
                    },
                "command": "<command string example>",
                "target": "<target uuid>"
            },
            "agent" : {
                "soarca-fin--<uuid>": {
                    "type": "soarca-fin",
                    "name": "soarca-fin--<name>-<capability_uuid>"
                }
            }

        }
    ],
    "meta": {

        "timestamp": "string: <utc-timestamp-nanoes + timezone-offset>",
        "sender_id": "uuid"
    }
}
@endjson

unregister

The message is used to unregister a fin to SOARCA. It has the following payload.

fieldcontenttypedescription
typeunregisterstringUnregister message type
message_idUUIDstringMessage UUID
capability_idUUIDstringCapability id or null (either capability_id != null, fin_id != null or all == true need to be set)
fin_idUUIDstringFin id or null (either capability_id != null, fin_id != null or all == true need to be set)
allboolboolTrue to address all fins to unregister otherwise false (either capability_id != null, fin_id != null or all == true need to be set)
@startjson
{
    "type": "unregister",
    "message_id": "uuid",
    "capability_id" : "capability uuid",
    "fin_id" : "fin uuid",
    "all" : "true | false"
}
@endjson

command

The message is used to send a command from SOARCA. It has the following payload.

fieldcontenttypedescription
typecommandstringCommand message type
message_idUUIDstringMessage UUID
commandcommandcommand substructurecommand structure
metameta dictMetaMeta information for the fin protocol structure

command substructure

fieldcontenttypedescription
commandcommandstringThe command to be executed
authentication (optional)authentication informationauthentication informationCACAO authentication information
contextcacao contextContextContext form the playbook
variablesdict of variablesdict of VariablesFrom the playbook
@startjson
{
    "type": "command",
    "message_id": "uuid",
    "command": {
        "command": "command",
        "authentication": {"auth-uuid": "<cacao authentication struct"},
        "context": {
            "generated_on": "string: <utc-timestamp-nanoes + timezone-offset>",
            "timeout": "string: <utc-timestamp-nanoes + timezone-offset>",
            "step_id": "uuid",
            "playbook_id": "uuid",
            "execution_id": "uuid"
        },
        "variables": {
            "__<var1>__": {
                "type": "<cacao.variable-type-ov>",
                "name": "__<var1>__",
                "description": "<string>",
                "value": "<string>",
                "constant": "<bool>",
                "external": "<bool>"
            },
            "__<var2>__": {
                "type": "<cacao.variable-type-ov>",
                "name": "__<var2>__",
                "description": "<string>",
                "value": "<string>",
                "constant": "<bool>",
                "external": "<bool>"
            }
        }
    },
    "meta": {
        "timestamp": "string: <utc-timestamp-nanoes + timezone-offset>",
        "sender_id": "uuid"
    }
}
@endjson

result

The message is used to send a response from the Fin to SOARCA. It has the following payload.

fieldcontenttypedescription
typeresultstringUnregister message type
message_idUUIDstringMessage UUID
resultresult structureresult structureThe result of the execution
metameta dictMetaMeta information for the fin protocol structure

result structure

fieldcontenttypedescription
statesucces or failurestringThe execution state of the playbook
contextcacao contextContextContext form the playbook
variablesdict of variablesdict of variablesDictionary of CACAO compatible variables
@startjson
{   
    "type": "result",
    "message_id": "uuid",
    "result": {
        "state": "enum(success | failure)",
        "context": {
            "generated_on": "string: <utc-timestamp-nanoes + timezone-offset>",
            "timeout": "string: <utc-timestamp-nanoes + timezone-offset>",
            "step_id": "uuid",
            "playbook_id": "uuid",
            "execution_id": "uuid"
        },
        "variables": {
            "__<var1>__": {
                "type": "<cacao.variable-type-ov>",
                "name": "__<var1>__",
                "description": "<string>",
                "value": "<string>",
                "constant": "<bool>",
                "external": "<bool>"
            },
            "__<var2>__": {
                "type": "<cacao.variable-type-ov>",
                "name": "__<var2>__",
                "description": "<string>",
                "value": "<string>",
                "constant": "<bool>",
                "external": "<bool>"
            }
        }
    },
    "meta": {
        "timestamp": "string: <utc-timestamp-nanoes + timezone-offset>",
        "sender_id": "uuid"
    }
}
@endjson

control

fieldcontenttypedescription
typepause or resume or stop or progressstringMessage type
message_idUUIDstringmessage uuid
capability_idUUIDstringCapability uuid to control

pause

The message is used to halt the further execution of the Fin. The following command will be responded to with a nack, unless it is resumed or stopped.

@startjson
{
    "type": "pause",
    "message_id" : "uuid",
    "capability_id": "uuid"
}
@endjson

resume

The message is used to resume a paused Fin, the response will be an ack if ok or a nack when the Fin could not be resumed.

@startjson
{
    "type": "resume",
    "message_id" : "uuid",
    "capability_id": "uuid"
}
@endjson

stop

The message is used to shut down the Fin. this will be responded to by ack, after that there will follow an unregister.

@startjson
{
    "type": "stop",
    "message_id" : "uuid",
    "capability_id": "uuid"
}
@endjson

progress

Ask for the progress of the execution of the

@startjson
{
    "type": "progress",
    "message_id" : "uuid",
    "capability_id": "uuid"
}
@endjson

Status response

fieldcontenttypedescription
typestatusstringMessage type
message_idUUIDstringmessage uuid
capability_idUUIDstringCapability uuid to control
progressready, working, paused, stoppedstringProgress of the execution or state it’s in.

Report the progress of the execution of the capability

@startjson
{
    "type": "status",
    "message_id" : "uuid",
    "capability_id": "uuid",
    "progress": "<execution status>"
}
@endjson

Common

These contain command parts that are used in different messages.

Security

fieldcontenttypedescription
versionversionstringVersion information of the protocol in semantic version schema e.g. 1.2.4-beta
channel_securityplaintextstringSecurity mechanism used for encrypting the channel and topic, plaintext is only supported at this time
@startjson
{
    "security": {
        "version": "0.0.0",
        "channel_security": "plaintext"
    }
}
@endjson

Variables

Variables information structure

fieldcontenttypedescription
typevariable typevariable-type-ovThe cacao variable type see CACAO V2 chapter 10.18, 10.18.4 Variable Type Vocabulary
namenamestringName of the variable this must be the same as the key on the map
descriptiondescriptionstringDescription of the variable
valuevaluestringValue of the variable
constanttrue or falseboolwhether it is constant
externaltrue or falseboolwhether it is external to the playbook
@startjson
{
    "__<var1>__": {
        "type": "<cacao.variable-type-ov>",
        "name": "<string>",
        "description": "<string>",
        "value": "<string>",
        "constant": "<bool>",
        "external": "<bool>"
        }
}
@endjson

Context

CACAO playbook context information structure

fieldcontenttypedescription
completed_on (optional)timestampstring<utc-timestamp-nanoes + timezone-offset>
generated_on (optional)timestampstring<utc-timestamp-nanoes + timezone-offset>
timeout (optional)durationstring<utc-timestamp-nanoes + timezone-offset>
step_idUUIDstringStep uuid that is referred to
playbook_idUUIDstringPlaybook uuid that is referred to
execution_idUUIDstringSOARCA execution uuid
@startjson
{
    "context": {
        "completed_on": "string: <utc-timestamp-nanoes + timezone-offset>",
        "generated_on": "string: <utc-timestamp-nanoes + timezone-offset>",
        "timeout": "string: <utc-timestamp-nanoes + timezone-offset>",
        "step_id": "uuid",
        "playbook_id": "uuid",
        "execution_id": "uuid"
    }
}
@endjson

Meta

Meta information for the fin protocol structure

fieldcontenttypedescription
timestamptimestampstring<utc-timestamp-nanoes + timezone-offset>
sender_idUUIDstringStep uuid that is referred to
@startjson
{
    "meta": {
        "timestamp": "string: <utc-timestamp-nanoes + timezone-offset>",
        "sender_id": "uuid"
    }
}
@endjson

Sequences

Registering a capability

@startuml

participant "SOARCA" as soarca
participant Capability as fin

soarca -> soarca : create [soarca] topic

fin -> fin : create [fin UUID] topic
soarca <- fin : [soarca] register
soarca --> fin : [fin UUID] ack 

@enduml

Sending command

@startuml

participant "SOARCA" as soarca
participant Capability as fin

soarca -> fin : [capability UUID] command
soarca <-- fin : [capability UUID] ack 

.... processing .... 

soarca <- fin : [capability UUID] result
soarca --> fin: ack

@enduml

Unregistering a capability

@startuml

participant "SOARCA" as soarca
participant Capability as fin
participant "Second capability" as fin2

... SOARCA initiate unregistering one fin ...

soarca -> fin : [SOARCA] unregister fin-id
soarca <-- fin : [SOARCA] ack 
note right fin2
    This capability does not respond to this message
end note

... Fin initiate unregistering ...

soarca <- fin : [SOARCA] unregister fin-id
soarca --> fin : [SOARCA] ack 
note right fin2
    This capability does not respond to this message
end note

... SOARCA unregister all ...

soarca -> fin : [SOARCA] unregister all == true
soarca <-- fin : [SOARCA] ack 
soarca <-- fin2 : [SOARCA] ack
note over soarca, fin2
    soarca will go down after this command
end note
@enduml

Control

@startuml

participant "SOARCA" as soarca
participant Capability as fin


soarca -> fin : [fin UUID] control message
soarca <-- fin : [fin UUID] status 

@enduml