//---------------------------------------------------------------------------- // // Copyright (C) 2008 Intel Corporation // // File: AuditLogFlow.h // // Contents: Flow code for Intel(R) Active Management Technology // (Intel� AMT) AccessMonitor Sample. // // Notes: This file contains the AccessMonitor flow definition. // //---------------------------------------------------------------------------- #pragma once #include #include "CimWsman.h" #include "AccessMonitorUtils.h" using namespace std; using namespace Intel::WSManagement; #include "AMT_AuditLog.h" #include "AMT_AuditPolicyRule.h" #include "AMT_GeneralSettings.h" #include "AMT_AuthorizationService.h" static const unsigned int SHA_FOR_SHA2_SUPPORTING_VERSION = RSA_SHA256; static const char INSTANCE_ID_STRING[] = "InstanceID"; static const char AMT_FW_CORE_VERSION_INSTANCE_ID[] = "AMT FW Core Version"; static const char FIRST_VERSION_SUPPORTING_DASH_1_0[] = "5.1.0"; static const char FIRST_VERSION_SUPPORTING_SHA2[] = "6.0.0"; static const char FIRST_VERSION_SUPPORTING_AUDIT_STORAGE_POLICY[] = "5.1.0"; const int MAX_INT_VALUE = 65535; const unsigned short ENABLE_AUDITING = 2; const unsigned short DISBLE_AUDITING = 3; const unsigned short CRITICAL = 1; const unsigned short NON_CRITICAL = 0; const int BASE = 10; const int BUFF_SIZE = 65; using namespace Intel::Manageability::Cim::Typed; class AuditLogFlow { private: ICimWsmanClient* wsmanClient; // Pointer to the ICimWsmanClient object AMT_AuditLog auditLog; // Audit Log Object AMT_AuditPolicyRule auditPolicyRule; // Audit Policy Rule Object AMT_AuthorizationService authorizationService; // Authorization Service Object string coreVersion; // The target machine's FW Core Version bool verbose; // The verbose choice of the user bool isAuditLogInitialize; // Indicates whether the AMT_AuditLog instance is initialize bool isAuditPolicyInitialize; // Indicates whether the AMT_AuditLogPolicyRule instance is initialize bool isAuthorizationServiceInitialize; // Indicates whether the AMT_AuthorizationService instance is initialize public: AuditLogFlow(ICimWsmanClient* wsmanClient, bool verbose); ~AuditLogFlow(); // Api functions void ApiTest(); void AddAuditor(); void EnableAuditing(); void ClearAuditLog(); void ManipulateAuditPolicy(); void Unprovisioning(); void ManipulateAuditLog(); void ViewAuditLog(); void CleanUp(); private: void UpdateWsmanClientCredentials(string newUsername, string newPassword); int GetIntegerOutOfCimDateTimeString(string date); void StringToUInteger(const string& str, unsigned int& t); void CleanAfterManipulateAuditPolicy(vector &policy, bool ruleInitiallyEnabled); void LockAuditLog(AuditLockType lock, unsigned int &handle); void GetDigestRealm(OUT string & digest_realm); void GetAuditPolicy(OUT vector & policy); //string ManipulateOutputXML(const string outputXML, const string mofClassName, const vector elementNames); //string ManipulateOutputXML(const string outputXML, const string mofClassName, const string elementName); void GetAuditRuleStatus(OUT bool & ruleInitiallyEnabled, bool *isCritical); void GetAuditLogStatus(OUT AuditLogStatus & auditLogStatus); void GetCoreVersion(OUT string & fwCoreVersion); void GetAuditLogStoragePolicy(OUT StoragePolicyType & auditStoragePolicy, OUT unsigned int & daysToKeep); void SetAuditLogStoragePolicy(const StoragePolicyType & auditStoragePolicy, const unsigned int & daysToKeep); void EnableAuditRule(const AuditRule & auditRule); void DisableAuditRule(const AuditRule & auditRule); void SetSigningKeyingMaterial(); void ViewAuditLog(OUT vector & records); void ReadAuditLog(OUT vector & records); void RemoveAddedAuditor(); void EnableAuditing(bool enable); void ExportAuditLogSignature(OUT AuditSignature & auditSignature); void AddUserAclEntryEx(const string & username, const string & password, vector & realms, unsigned short accessPermission); AMT_AuditLog GetAuditLogInstance(); AMT_AuthorizationService GetAuthorizationServiceInstance(); AMT_AuditPolicyRule GetAuditPolicyInstance(); }; class AuditLogException: public exception { public: AuditLogException(const char *const &msg):exception(msg){} };