mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-06 17:45:22 +00:00
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
/**
|
|
* 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.
|
|
*/
|
|
|
|
// Sanity check integration test for iptables
|
|
// Spec file: specs/linux/iptables.table
|
|
|
|
#include <osquery/tests/integration/tables/helper.h>
|
|
|
|
namespace osquery {
|
|
namespace table_tests {
|
|
|
|
class iptables : public testing::Test {
|
|
protected:
|
|
void SetUp() override {
|
|
setUpEnvironment();
|
|
}
|
|
};
|
|
|
|
TEST_F(iptables, test_sanity) {
|
|
auto const data = execute_query("select * from iptables");
|
|
|
|
ASSERT_GE(data.size(), 0ul);
|
|
|
|
ValidationMap row_map = {{"filter_name", NonEmptyString},
|
|
{"chain", NormalType},
|
|
{"policy", NormalType},
|
|
{"target", NormalType},
|
|
{"protocol", IntType},
|
|
{"src_port", IntMinMaxCheck(0, 65535)},
|
|
{"dst_port", IntMinMaxCheck(0, 65535)},
|
|
{"src_ip", verifyEmptyStringOrIpAddress},
|
|
{"src_mask", verifyEmptyStringOrIpAddress},
|
|
{"iniface", NormalType},
|
|
{"iniface_mask", verifyEmptyStringOrIpAddress},
|
|
{"dst_ip", verifyEmptyStringOrIpAddress},
|
|
{"dst_mask", verifyEmptyStringOrIpAddress},
|
|
{"outiface", NormalType},
|
|
{"outiface_mask", verifyEmptyStringOrIpAddress},
|
|
{"match", SpecificValuesCheck{"yes", "no"}},
|
|
{"packets", NonNegativeInt},
|
|
{"bytes", NonNegativeInt}};
|
|
validate_rows(data, row_map);
|
|
}
|
|
|
|
} // namespace table_tests
|
|
} // namespace osquery
|