diff --git a/osquery/tables/CMakeLists.txt b/osquery/tables/CMakeLists.txt index 9b441703..57a5f6d5 100644 --- a/osquery/tables/CMakeLists.txt +++ b/osquery/tables/CMakeLists.txt @@ -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 diff --git a/osquery/tables/cloud/CMakeLists.txt b/osquery/tables/cloud/CMakeLists.txt index 95327edf..4a720c84 100644 --- a/osquery/tables/cloud/CMakeLists.txt +++ b/osquery/tables/cloud/CMakeLists.txt @@ -9,9 +9,7 @@ function(osqueryTablesCloudMain) generateOsqueryTablesCloudAws() endif() - if(DEFINED PLATFORM_LINUX OR DEFINED PLATFORM_WINDOWS) - generateOsqueryTablesCloudAzure() - endif() + generateOsqueryTablesCloudAzure() endfunction() function(generateOsqueryTablesCloudAws) diff --git a/osquery/utils/azure/azure_util.cpp b/osquery/utils/azure/azure_util.cpp index dd3d580f..e2817d9f 100644 --- a/osquery/utils/azure/azure_util.cpp +++ b/osquery/utils/azure/azure_util.cpp @@ -8,11 +8,12 @@ * You may select, at your option, one of the above-listed licenses. */ +// Keep this included first (See #6507). +#include + #include #include - #include -#include #include #include #include diff --git a/specs/CMakeLists.txt b/specs/CMakeLists.txt index 5cc90898..867aca29 100644 --- a/specs/CMakeLists.txt +++ b/specs/CMakeLists.txt @@ -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 diff --git a/tests/integration/tables/azure_instance_metadata.cpp b/tests/integration/tables/azure_instance_metadata.cpp new file mode 100644 index 00000000..0bf34d1e --- /dev/null +++ b/tests/integration/tables/azure_instance_metadata.cpp @@ -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 + +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 diff --git a/tests/integration/tables/azure_instance_tags.cpp b/tests/integration/tables/azure_instance_tags.cpp new file mode 100644 index 00000000..12f354bb --- /dev/null +++ b/tests/integration/tables/azure_instance_tags.cpp @@ -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 + +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