mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 11:16:30 +03:00
Updating local policy, metrics, and local update trigger
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include "i_orchestration_tools.h"
|
||||
#include "i_agent_details.h"
|
||||
#include "i_orchestration_status.h"
|
||||
#include "i_messaging.h"
|
||||
#include "i_mainloop.h"
|
||||
#include "i_encryptor.h"
|
||||
#include "i_details_resolver.h"
|
||||
@@ -23,6 +22,7 @@
|
||||
#include "i_shell_cmd.h"
|
||||
#include "i_encryptor.h"
|
||||
#include "i_env_details.h"
|
||||
#include "i_declarative_policy.h"
|
||||
#include "maybe_res.h"
|
||||
#include "event.h"
|
||||
#include "rest.h"
|
||||
@@ -43,6 +43,7 @@ private:
|
||||
|
||||
class DeclarativePolicyUtils
|
||||
:
|
||||
public Singleton::Provide<I_DeclarativePolicy>::SelfInterface,
|
||||
public Singleton::Consume<I_ShellCmd>,
|
||||
Singleton::Consume<I_LocalPolicyMgmtGen>,
|
||||
Singleton::Consume<I_EnvDetails>,
|
||||
@@ -75,13 +76,12 @@ public:
|
||||
const std::string &tenant_id,
|
||||
const std::string &profile_id,
|
||||
const std::string &fog_address
|
||||
);
|
||||
std::string getUpdate(CheckUpdateRequest &request);
|
||||
bool shouldApplyPolicy();
|
||||
void turnOffApplyPolicyFlag();
|
||||
) override;
|
||||
std::string getUpdate(CheckUpdateRequest &request) override;
|
||||
bool shouldApplyPolicy() override;
|
||||
void turnOffApplyPolicyFlag() override;
|
||||
|
||||
std::string getCurrVersion() { return curr_version; }
|
||||
std::string getCurrPolicy() { return curr_policy; }
|
||||
std::string getCurrPolicy() override { return curr_policy; }
|
||||
|
||||
void upon(const ApplyPolicyEvent &event) override;
|
||||
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
) const override;
|
||||
|
||||
private:
|
||||
DeclarativePolicyUtils declarative_policy_utils;
|
||||
I_DeclarativePolicy *i_declarative_policy = nullptr;
|
||||
};
|
||||
|
||||
#endif // __FOG_COMMUNICATION_H__
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
Maybe<std::string> getNewVersion();
|
||||
|
||||
DeclarativePolicyUtils declarative_policy_utils;
|
||||
I_DeclarativePolicy *i_declarative_policy = nullptr;
|
||||
};
|
||||
|
||||
#endif // __HYBRID_COMMUNICATION_H__
|
||||
|
@@ -0,0 +1,32 @@
|
||||
#ifndef __I_DECLARATIVE_POLICY__
|
||||
#define __I_DECLARATIVE_POLICY__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "singleton.h"
|
||||
#include "orchestrator/rest_api/orchestration_check_update.h"
|
||||
|
||||
class I_DeclarativePolicy
|
||||
{
|
||||
public:
|
||||
virtual bool shouldApplyPolicy() = 0;
|
||||
|
||||
virtual std::string getUpdate(CheckUpdateRequest &request) = 0;
|
||||
|
||||
virtual void sendUpdatesToFog(
|
||||
const std::string &access_token,
|
||||
const std::string &tenant_id,
|
||||
const std::string &profile_id,
|
||||
const std::string &fog_address
|
||||
) = 0;
|
||||
|
||||
virtual std::string getCurrPolicy() = 0;
|
||||
|
||||
virtual void turnOffApplyPolicyFlag() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~I_DeclarativePolicy() {}
|
||||
};
|
||||
|
||||
|
||||
#endif // __I_DECLARATIVE_POLICY__
|
@@ -27,9 +27,13 @@ class MockUpdateCommunication :
|
||||
public Singleton::Provide<I_UpdateCommunication>::From<MockProvider<I_UpdateCommunication>>
|
||||
{
|
||||
public:
|
||||
void init() {}
|
||||
MOCK_METHOD0(authenticateAgent, Maybe<void>());
|
||||
MOCK_METHOD1(getUpdate, Maybe<void>(CheckUpdateRequest &));
|
||||
MOCK_METHOD1(downloadAttributeFile, Maybe<std::string>(const GetResourceFile &));
|
||||
MOCK_METHOD2(
|
||||
downloadAttributeFile,
|
||||
Maybe<std::string>(const GetResourceFile &, const std::string &)
|
||||
);
|
||||
MOCK_METHOD1(setAddressExtenesion, void(const std::string &));
|
||||
MOCK_CONST_METHOD2(sendPolicyVersion, Maybe<void>(const std::string &, const std::string &));
|
||||
};
|
||||
|
Reference in New Issue
Block a user