2015-02-04 03:55:16 +00:00
|
|
|
namespace cpp osquery.extensions
|
|
|
|
|
|
|
|
/// Registry operations use a registry name, plugin name, request/response.
|
|
|
|
typedef map<string, string> ExtensionPluginRequest
|
|
|
|
typedef list<map<string, string>> ExtensionPluginResponse
|
|
|
|
|
2015-03-13 15:11:08 +00:00
|
|
|
/// Extensions should request osquery options to set active registries and
|
|
|
|
/// bootstrap any config/logger plugins.
|
|
|
|
struct InternalOptionInfo {
|
|
|
|
1:string value,
|
|
|
|
2:string default_value,
|
|
|
|
3:string type,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Each option (CLI flag) has a unique name.
|
|
|
|
typedef map<string, InternalOptionInfo> InternalOptionList
|
|
|
|
|
2015-02-18 02:42:09 +00:00
|
|
|
/// When communicating extension metadata, use a thrift-internal structure.
|
2015-02-04 03:55:16 +00:00
|
|
|
struct InternalExtensionInfo {
|
|
|
|
1:string name,
|
|
|
|
2:string version,
|
|
|
|
3:string sdk_version,
|
2015-02-19 01:19:45 +00:00
|
|
|
4:string min_sdk_version,
|
2015-02-04 03:55:16 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Unique ID for each extension.
|
2015-02-05 00:54:44 +00:00
|
|
|
typedef i64 ExtensionRouteUUID
|
2015-02-18 02:42:09 +00:00
|
|
|
/// A map from each plugin name to its optional route information.
|
2015-02-23 05:56:52 +00:00
|
|
|
typedef map<string, ExtensionPluginResponse> ExtensionRouteTable
|
2015-02-18 02:42:09 +00:00
|
|
|
/// A map from each registry name.
|
2015-02-04 03:55:16 +00:00
|
|
|
typedef map<string, ExtensionRouteTable> ExtensionRegistry
|
2015-02-18 02:42:09 +00:00
|
|
|
/// A map from each extension's unique ID to its map of registries.
|
2015-02-10 20:50:07 +00:00
|
|
|
typedef map<ExtensionRouteUUID, InternalExtensionInfo> InternalExtensionList
|
2015-02-04 03:55:16 +00:00
|
|
|
|
|
|
|
enum ExtensionCode {
|
|
|
|
EXT_SUCCESS = 0,
|
|
|
|
EXT_FAILED = 1,
|
|
|
|
EXT_FATAL = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Most communication uses the Status return type.
|
|
|
|
struct ExtensionStatus {
|
|
|
|
1:i32 code,
|
|
|
|
2:string message,
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Add a thrift Status parameter identifying the request/response.
|
2015-02-04 03:55:16 +00:00
|
|
|
3:ExtensionRouteUUID uuid,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ExtensionResponse {
|
|
|
|
1:ExtensionStatus status,
|
|
|
|
2:ExtensionPluginResponse response,
|
|
|
|
}
|
|
|
|
|
|
|
|
exception ExtensionException {
|
|
|
|
1:i32 code,
|
|
|
|
2:string message,
|
|
|
|
3:ExtensionRouteUUID uuid,
|
|
|
|
}
|
|
|
|
|
|
|
|
service Extension {
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Ping to/from an extension and extension manager for metadata.
|
2015-02-04 03:55:16 +00:00
|
|
|
ExtensionStatus ping(),
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Call an extension (or core) registry plugin.
|
2015-02-04 03:55:16 +00:00
|
|
|
ExtensionResponse call(
|
2015-02-18 02:42:09 +00:00
|
|
|
/// The registry name (e.g., config, logger, table, etc).
|
2015-02-04 03:55:16 +00:00
|
|
|
1:string registry,
|
2015-02-18 02:42:09 +00:00
|
|
|
/// The registry item name (plugin name).
|
2015-02-04 03:55:16 +00:00
|
|
|
2:string item,
|
2015-02-18 02:42:09 +00:00
|
|
|
/// The thrift-equivilent of an osquery::PluginRequest.
|
2015-02-04 03:55:16 +00:00
|
|
|
3:ExtensionPluginRequest request),
|
|
|
|
}
|
|
|
|
|
2015-02-18 02:42:09 +00:00
|
|
|
/// The extension manager is run by the osquery core process.
|
2015-02-04 03:55:16 +00:00
|
|
|
service ExtensionManager extends Extension {
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Return the list of active registered extensions.
|
2015-02-10 20:50:07 +00:00
|
|
|
InternalExtensionList extensions(),
|
2015-03-13 15:11:08 +00:00
|
|
|
/// Return the list of bootstrap or configuration options.
|
|
|
|
InternalOptionList options(),
|
2015-02-18 02:42:09 +00:00
|
|
|
/// The API endpoint used by an extension to register its plugins.
|
2015-02-04 03:55:16 +00:00
|
|
|
ExtensionStatus registerExtension(
|
|
|
|
1:InternalExtensionInfo info,
|
|
|
|
2:ExtensionRegistry registry),
|
|
|
|
ExtensionStatus deregisterExtension(
|
|
|
|
1:ExtensionRouteUUID uuid,
|
|
|
|
),
|
2015-02-18 02:42:09 +00:00
|
|
|
/// Allow an extension to query using an SQL string.
|
|
|
|
ExtensionResponse query(
|
|
|
|
1:string sql,
|
|
|
|
),
|
2015-02-19 01:19:45 +00:00
|
|
|
/// Allow an extension to introspect into SQL used in a parsed query.
|
|
|
|
ExtensionResponse getQueryColumns(
|
|
|
|
1:string sql,
|
|
|
|
),
|
2015-02-04 03:55:16 +00:00
|
|
|
}
|