otupy.actuators.ctxd.ctxd_actuator_kubernetes.CTXDActuator_kubernetes
- class CTXDActuator_kubernetes(auth, **kwargs)
Bases:
CTXDActuatorKubernetes Actuator Manager
Extend the base CTDXActuator to retrieve services and links for a Kubernetes cluster. Currently discovery is mostly limited to pods, nodes, and containers. It should be extended in future releases with additional resources (e.g., services and file systems).
Methods
Automatically discover links between Kubernetes components
Discovers K8S services
Returns consumer data
Returns the list of current services
Query action
Entry point for running commands
Attributes
api_clientconfig_filekube_contextIt identifies the type of the service
Namespaces list
Name of the service
- __init__(auth, **kwargs)
Initialization
The necessary parameters are: - auth: Authentication information to connect to a Kubernetes cluster Optional parameters: - namespaces: List of namespaces which resources are to be discovered. If not provided, resources from all namespaces will be discovered.
- discover_links()
Automatically discover links between Kubernetes components
The current implementation discovers links between: - Kubernetes and nodes - Kubernetes and pods - Pods and containers - Network Policy firewall and pods
- discover_services()
Discovers K8S services
Implements the required method to discover services. Currently it discover: - K8S base services (e.g., dns) - Pods in selected namespaces - Nodes - Namespaces available
- get_consumer(service_name: Name) Consumer
Returns consumer data
Returns the Consumer data for the selected service name.
- Parameters:
service_name – name of the service which consumer is searched.
- Returns:
The consumer serving the given service, if any, None otherwise.
- get_services(name: Name = None, filter: ServiceType = None) []
Returns the list of current services
Returns the list of discovered services. Filter by name and type.
- Parameters:
name – The name of the service to retrieve (all if not set).
filter – The type of service (given by a void instance of ServiceType).
- Returns:
A list of services that match the searching criteria.
- links: ArrayOf = None
It identifies the type of the service
- namespace = []
Namespaces list
- query(cmd)
Query action
This method implements the query action.
- Parameters:
cmd – The Command including Target and optional Args.
- Returns:
A Response including the result of the query and appropriate status code and messages.
- run(cmd)
Entry point for running commands
This is the actuator entry point to receive OpenC2 commands from the otupy Consumer.
- Parameters:
cmd – A Command in the format of the otupy framework.
- Returns:
Response to the provided command.
- services: ArrayOf = None
Name of the service