build: Add Azure tables to specs CMakeLists (#6507)

This commit is contained in:
Teddy Reed 2020-06-25 09:10:17 -04:00 committed by GitHub
parent efe9a98290
commit 6710dbd5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 10 deletions

View File

@ -42,11 +42,9 @@ function(generateOsqueryTablesTableimplementations)
)
endif()
if(DEFINED PLATFORM_LINUX OR DEFINED PLATFORM_WINDOWS)
target_link_libraries(osquery_tables_tableimplementations INTERFACE
osquery_tables_cloud_azure
)
endif()
target_link_libraries(osquery_tables_tableimplementations INTERFACE
osquery_tables_cloud_azure
)
target_link_libraries(osquery_tables_tableimplementations INTERFACE
osquery_tables_applications

View File

@ -9,9 +9,7 @@ function(osqueryTablesCloudMain)
generateOsqueryTablesCloudAws()
endif()
if(DEFINED PLATFORM_LINUX OR DEFINED PLATFORM_WINDOWS)
generateOsqueryTablesCloudAzure()
endif()
generateOsqueryTablesCloudAzure()
endfunction()
function(generateOsqueryTablesCloudAws)

View File

@ -8,11 +8,12 @@
* You may select, at your option, one of the above-listed licenses.
*/
// Keep this included first (See #6507).
#include <osquery/remote/http_client.h>
#include <osquery/core.h>
#include <osquery/logger.h>
#include <osquery/filesystem/filesystem.h>
#include <osquery/remote/http_client.h>
#include <osquery/utils/azure/azure_util.h>
#include <osquery/utils/info/platform_type.h>
#include <osquery/utils/json/json.h>

View File

@ -30,6 +30,8 @@ endfunction()
function(generateNativeTables)
set(platform_independent_spec_files
azure_instance_metadata.table
azure_instance_tags.table
carbon_black_info.table
carves.table
chrome_extensions.table

View File

@ -0,0 +1,46 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed in accordance with the terms specified in
* the LICENSE file found in the root directory of this source tree.
*/
#include <osquery/tests/integration/tables/helper.h>
namespace osquery {
namespace table_tests {
class azureInstanceMetadata : public testing::Test {
protected:
void SetUp() override {
setUpEnvironment();
}
};
TEST_F(azureInstanceMetadata, test_sanity) {
auto const data = execute_query("select * from azure_instance_metadata");
if (!data.empty()) {
ValidationMap row_map = {
{"location", NormalType},
{"name", NormalType},
{"architecture", NormalType},
{"offer", NormalType},
{"publisher", NormalType},
{"sku", NormalType} {"version", NormalType},
{"os_type", NormalType},
{"platform_update_domain", NormalType},
{"platform_fault_domain", NormalType},
{"vm_id", NormalType},
{"vm_size", NormalType},
{"subscription_id", NormalType},
{"resource_group_name", NormalType},
{"placement_group_id", NormalType},
{"vm_scale_set_name", NormalType},
{"zone", NormalType},
};
validate_rows(data, row_map);
}
} // namespace table_tests
} // namespace table_tests

View File

@ -0,0 +1,34 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed in accordance with the terms specified in
* the LICENSE file found in the root directory of this source tree.
*/
#include <osquery/tests/integration/tables/helper.h>
namespace osquery {
namespace table_tests {
class azureInstanceTags : public testing::Test {
protected:
void SetUp() override {
setUpEnvironment();
}
};
TEST_F(azureInstanceTags, test_sanity) {
auto const data = execute_query("select * from azure_instance_tags");
if (!data.empty()) {
ValidationMap row_map = {
{"vm_id", NormalType},
{"key", NormalType},
{"value", NormalType},
};
validate_rows(data, row_map);
}
}
} // namespace table_tests
} // namespace osquery