Closed mssalvatore closed 1 year ago
We need a manifest to describe the plugin. This includes, but is not limited to
This base manifest can then be expanded per plugin type, it can have additional fields like
The source of the manifest can be in any format. It's probably best if it's defined in python. The creator of the plugin can import the AgentPluginManifest
and build it with his own parameters, validating it as it's being defined.
Each plugin might contain options. These options need to be defined. Metainformation, like description, title are needed as well as validation rules. Configuration schema should be in jsonschema format, as it's easier to display and common.
Each plugin might contain options. The default value for options needs to be defined. The default values from the schema can be used to generate this, but that's not the purpose of the default values in jsonschema. It's probably better to have this.
Definition of classes required:
from typing import Tuple, Optional
from common import OperatingSystem
from common.types import PluginType
class AgentPluginManifest:
name: str
type: PluginType
supported_operating_systems: Tuple[OperatingSystem, ...] = [OperatingSystem.WINDOWS,
OperatingSystem.LINUX]
title: Optional[str]
description: Optional[str]
link_to_documentation: Optional[str]
safe: bool = False
from common.types import JSONSerializable
class AgentPlugin:
plugin_manifest: AgentPluginManifest
config_schema: JSONSerializable
default_config: JSONSerializable
source_archive: bytes
Description
Create a new class that will contain all of the information about a plugin, including the plugin itself. This will be used by the Island to store/retrieve agent plugins, as well as by the agent to load and use plugins in the puppet.
Suggestion:
Note
Consider this class to be a first draft. We want to get it reasonably close, but we don't need to agonize over every decision. We can improve and modify it as our plugin framework develops.
Tasks
AgentPluginManifest
proposed above is missing any necessary fields (0d) - @VakarisZAgentPluginManifest
class as a pydantic model (0d) - @VakarisZAgentPlugin
class as a pydantic model (0d) - @VakarisZsrc_archive
(bytes
). You may need to use base64 encoding or some other scheme to send bytes as JSON. (0d) - @VakarisZ