/src/osquery/plugins/config/update.cpp
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /**  | 
2  |  |  * Copyright (c) 2014-present, The osquery authors  | 
3  |  |  *  | 
4  |  |  * This source code is licensed as defined by the LICENSE file found in the  | 
5  |  |  * root directory of this source tree.  | 
6  |  |  *  | 
7  |  |  * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)  | 
8  |  |  */  | 
9  |  |  | 
10  |  | #include <osquery/config/config.h>  | 
11  |  | #include <osquery/registry/registry_factory.h>  | 
12  |  |  | 
13  |  | namespace osquery { | 
14  |  |  | 
15  |  | /**  | 
16  |  |  * @brief A special config plugin that updates an osquery core's config.  | 
17  |  |  *  | 
18  |  |  * Config plugins may asynchronously change config data for the core osquery  | 
19  |  |  * process. This is a rare instance where a plugin acts to change core state.  | 
20  |  |  * Plugins normally act on behalf of a registry or extension call.  | 
21  |  |  * To achieve plugin-initiated calls, Config plugins chain calls to plugins  | 
22  |  |  * using the UpdateConfigPlugin named 'update'.  | 
23  |  |  *  | 
24  |  |  * Plugins do not need to implement call-chaining explicitly. If an extension  | 
25  |  |  * plugin implements an asynchronous feature it should call `Config::update`  | 
26  |  |  * directly. The osquery config will check if the registry is external, meaning  | 
27  |  |  * the config instance is running as an extension. If external, config will  | 
28  |  |  * route the update request and the registry will send missing (in this case  | 
29  |  |  * "config/update" is missing) requests to core.  | 
30  |  |  */  | 
31  |  | class UpdateConfigPlugin : public ConfigPlugin { | 
32  |  |  public:  | 
33  | 0  |   Status genConfig(std::map<std::string, std::string>& config) { | 
34  | 0  |     return Status(0, "Unused");  | 
35  | 0  |   }  | 
36  |  | };  | 
37  |  |  | 
38  |  | REGISTER(UpdateConfigPlugin, "config", "update");  | 
39  |  | }  |