facter 3.9.6.cfacter.20180612 → 3.11.0.cfacter.20180319
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/facter/facter/CMakeLists.txt +1 -1
- data/ext/facter/facter/acceptance/Gemfile +3 -4
- data/ext/facter/facter/acceptance/Rakefile +342 -2
- data/ext/facter/facter/acceptance/config/aio/options.rb +6 -0
- data/ext/facter/facter/acceptance/config/git/options.rb +5 -1
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/010_Install.rb +22 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/021_InstallAristaModule.rb +12 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/022_Remove_LD_PRELOAD.rb +11 -0
- data/ext/facter/facter/acceptance/setup/common/00_EnvSetup.rb +64 -0
- data/ext/facter/facter/acceptance/setup/common/pre-suite/000-delete-puppet-when-none.rb +11 -0
- data/ext/facter/facter/acceptance/setup/git/pre-suite/01_TestSetup.rb +31 -0
- data/ext/facter/facter/acceptance/tests/ticket_1238_hostname_fqdn.rb +20 -0
- data/ext/facter/facter/lib/CMakeLists.txt +3 -2
- data/ext/facter/facter/lib/Doxyfile +1 -1
- data/ext/facter/facter/lib/inc/facter/facts/fact.hpp +5 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/linux/fips_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/osx/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/posix/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/fips_resolver.hpp +46 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/networking_resolver.hpp +2 -3
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ssh_resolver.hpp +6 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/networking_resolver.hpp +0 -7
- data/ext/facter/facter/lib/schema/facter.yaml +38 -18
- data/ext/facter/facter/lib/src/cwrapper.cc +5 -0
- data/ext/facter/facter/lib/src/facts/aix/disk_resolver.cc +2 -11
- data/ext/facter/facter/lib/src/facts/aix/networking_resolver.cc +0 -5
- data/ext/facter/facter/lib/src/facts/freebsd/dmi_resolver.cc +5 -1
- data/ext/facter/facter/lib/src/facts/freebsd/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/freebsd/virtualization_resolver.cc +1 -4
- data/ext/facter/facter/lib/src/facts/linux/collection.cc +2 -0
- data/ext/facter/facter/lib/src/facts/linux/fips_resolver.cc +31 -0
- data/ext/facter/facter/lib/src/facts/linux/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/openbsd/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/osx/networking_resolver.cc +1 -10
- data/ext/facter/facter/lib/src/facts/posix/networking_resolver.cc +2 -3
- data/ext/facter/facter/lib/src/facts/posix/ssh_resolver.cc +3 -2
- data/ext/facter/facter/lib/src/facts/resolvers/fips_resolver.cc +23 -0
- data/ext/facter/facter/lib/src/facts/resolvers/networking_resolver.cc +7 -23
- data/ext/facter/facter/lib/src/facts/resolvers/ssh_resolver.cc +1 -0
- data/ext/facter/facter/lib/src/facts/solaris/networking_resolver.cc +0 -5
- data/ext/facter/facter/lib/tests/facts/resolvers/ssh_resolver.cc +8 -1
- data/ext/facter/facter/lib/tests/facts/schema.cc +17 -0
- data/ext/facter/facter/locales/FACTER.pot +2 -23
- data/ext/facter/leatherman/CHANGELOG.md +16 -9
- data/ext/facter/leatherman/CMakeLists.txt +1 -2
- data/ext/facter/leatherman/appveyor.yml +26 -19
- data/ext/facter/leatherman/catch/CMakeLists.txt +1 -1
- data/ext/facter/leatherman/curl/tests/client_test.cc +396 -398
- data/ext/facter/leatherman/curl/tests/mock_curl.cc +2 -0
- data/ext/facter/leatherman/curl/tests/request_test.cc +66 -68
- data/ext/facter/leatherman/curl/tests/response_test.cc +50 -52
- data/ext/facter/leatherman/dynamic_library/tests/dynamic_library_tests.cc +71 -75
- data/ext/facter/leatherman/execution/src/execution.cc +3 -0
- data/ext/facter/leatherman/execution/src/posix/execution.cc +5 -6
- data/ext/facter/leatherman/execution/src/windows/execution.cc +2 -0
- data/ext/facter/leatherman/execution/tests/windows/execution.cc +4 -2
- data/ext/facter/leatherman/file_util/tests/directory_utils_test.cc +66 -68
- data/ext/facter/leatherman/file_util/tests/file_utils_test.cc +175 -177
- data/ext/facter/leatherman/json_container/inc/leatherman/json_container/json_container.hpp +7 -0
- data/ext/facter/leatherman/json_container/src/json_container.cc +10 -1
- data/ext/facter/leatherman/json_container/tests/json_container_test.cc +152 -8
- data/ext/facter/leatherman/locale/CMakeLists.txt +0 -7
- data/ext/facter/leatherman/locales/leatherman.pot +8 -13
- data/ext/facter/leatherman/logging/src/logging.cc +2 -0
- data/ext/facter/leatherman/util/tests/timer.cc +1 -3
- data/ext/facter/leatherman/vendor/Catch-1.10.0.zip +0 -0
- data/ext/facter/leatherman/vendor/nowide/doc/Doxyfile +4 -4
- data/ext/facter/leatherman/vendor/nowide/doc/LICENSE_1_0.txt +23 -0
- data/ext/facter/leatherman/vendor/nowide/doc/main.txt +62 -54
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/convert.hpp +16 -16
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/cstdio.hpp +4 -4
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/utf8_codecvt.hpp +1 -1
- data/ext/facter/leatherman/vendor/nowide/src/iostream.cpp +32 -30
- data/ext/facter/leatherman/vendor/nowide/standalone/convert +6 -6
- data/ext/facter/leatherman/vendor/nowide/standalone/encoding_utf.hpp +1 -1
- data/ext/facter/leatherman/vendor/nowide/standalone/run_convert_and_build.sh +1 -3
- metadata +15 -6
- data/ext/facter/leatherman/cmake/FindICU.cmake +0 -690
- data/ext/facter/leatherman/scripts/travis_target.sh +0 -79
- data/ext/facter/leatherman/vendor/catch-1.4.0.zip +0 -0
@@ -30,7 +30,12 @@ uint8_t get_default_facts(char **result) {
|
|
30
30
|
|
31
31
|
auto json_facts = stream.str();
|
32
32
|
auto l = json_facts.length()+1;
|
33
|
+
|
33
34
|
*result = static_cast<char*>(malloc(sizeof(char)*l));
|
35
|
+
if (*result == nullptr) {
|
36
|
+
return EXIT_FAILURE;
|
37
|
+
}
|
38
|
+
|
34
39
|
strncpy(*result, json_facts.c_str(), l);
|
35
40
|
} catch (const std::exception&) {
|
36
41
|
return EXIT_FAILURE;
|
@@ -36,18 +36,9 @@ namespace facter { namespace facts { namespace aix {
|
|
36
36
|
|
37
37
|
{
|
38
38
|
string device = (boost::format("/dev/%1%") % d.name).str();
|
39
|
-
|
40
|
-
if (descriptor < 0) {
|
41
|
-
LOG_DEBUG("Could not open device %1% for reading: %2% (%3%). Disk facts will not be populated for this device", d.name, strerror(errno), errno);
|
42
|
-
continue;
|
43
|
-
}
|
44
|
-
scoped_descriptor fd(descriptor);
|
39
|
+
scoped_descriptor fd(open(device.c_str(), O_RDONLY));
|
45
40
|
devinfo info;
|
46
|
-
|
47
|
-
if (result < 0) {
|
48
|
-
LOG_DEBUG("Ioctl IOCINFO failed for device %1%: %2% (%3%). Disk facts will not be populated for this device", d.name, strerror(errno), errno);
|
49
|
-
continue;
|
50
|
-
}
|
41
|
+
ioctl(fd, IOCINFO, &info);
|
51
42
|
switch (info.devtype) {
|
52
43
|
case DD_DISK:
|
53
44
|
case DD_SCDISK:
|
@@ -20,6 +20,10 @@ namespace facter { namespace facts { namespace freebsd {
|
|
20
20
|
result.product_name = result.bios_vendor;
|
21
21
|
}
|
22
22
|
result.manufacturer = kenv_lookup("smbios.system.maker");
|
23
|
+
// Fix for Proxmox VMs
|
24
|
+
if (result.manufacturer == "QEMU") {
|
25
|
+
result.product_name = "KVM";
|
26
|
+
}
|
23
27
|
|
24
28
|
return result;
|
25
29
|
}
|
@@ -30,7 +34,7 @@ namespace facter { namespace facts { namespace freebsd {
|
|
30
34
|
|
31
35
|
LOG_DEBUG("kenv lookup for {1}", file);
|
32
36
|
if (kenv(KENV_GET, file, buffer, sizeof(buffer) - 1) == -1) {
|
33
|
-
|
37
|
+
LOG_INFO("kenv lookup for {1} failed: {2} ({3})", file, strerror(errno), errno);
|
34
38
|
return "";
|
35
39
|
}
|
36
40
|
return buffer;
|
@@ -27,21 +27,12 @@ namespace facter { namespace facts { namespace freebsd {
|
|
27
27
|
return nullptr;
|
28
28
|
}
|
29
29
|
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
30
|
-
if (link_addr->sdl_alen != 6
|
30
|
+
if (link_addr->sdl_alen != 6) {
|
31
31
|
return nullptr;
|
32
32
|
}
|
33
33
|
return reinterpret_cast<uint8_t const*>(LLADDR(link_addr));
|
34
34
|
}
|
35
35
|
|
36
|
-
uint8_t networking_resolver::get_link_address_length(sockaddr const* addr) const
|
37
|
-
{
|
38
|
-
if (!is_link_address(addr)) {
|
39
|
-
return 0;
|
40
|
-
}
|
41
|
-
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
42
|
-
return link_addr->sdl_alen;
|
43
|
-
}
|
44
|
-
|
45
36
|
boost::optional<uint64_t> networking_resolver::get_link_mtu(string const& interface, void* data) const
|
46
37
|
{
|
47
38
|
ifreq ifr;
|
@@ -20,10 +20,7 @@ namespace facter { namespace facts { namespace freebsd {
|
|
20
20
|
string value = get_jail_vm();
|
21
21
|
|
22
22
|
if (value.empty()) {
|
23
|
-
|
24
|
-
if (product_name) {
|
25
|
-
value = get_product_name_vm(product_name->value());
|
26
|
-
}
|
23
|
+
value = get_fact_vm(facts);
|
27
24
|
}
|
28
25
|
|
29
26
|
return value;
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#include <internal/facts/linux/memory_resolver.hpp>
|
15
15
|
#include <internal/facts/glib/load_average_resolver.hpp>
|
16
16
|
#include <internal/facts/posix/xen_resolver.hpp>
|
17
|
+
#include <internal/facts/linux/fips_resolver.hpp>
|
17
18
|
|
18
19
|
|
19
20
|
using namespace std;
|
@@ -37,6 +38,7 @@ namespace facter { namespace facts {
|
|
37
38
|
add(make_shared<linux::memory_resolver>());
|
38
39
|
add(make_shared<glib::load_average_resolver>());
|
39
40
|
add(make_shared<posix::xen_resolver>());
|
41
|
+
add(make_shared<linux::fips_resolver>());
|
40
42
|
}
|
41
43
|
|
42
44
|
}} // namespace facter::facts
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#include <internal/facts/linux/fips_resolver.hpp>
|
2
|
+
#include <leatherman/file_util/file.hpp>
|
3
|
+
#include <boost/algorithm/string.hpp>
|
4
|
+
#include <boost/lexical_cast.hpp>
|
5
|
+
|
6
|
+
using namespace std;
|
7
|
+
|
8
|
+
using boost::lexical_cast;
|
9
|
+
using boost::bad_lexical_cast;
|
10
|
+
|
11
|
+
namespace lth_file = leatherman::file_util;
|
12
|
+
|
13
|
+
namespace facter { namespace facts { namespace linux {
|
14
|
+
|
15
|
+
fips_resolver::data fips_resolver::collect_data(collection& facts)
|
16
|
+
{
|
17
|
+
data result;
|
18
|
+
|
19
|
+
// Set a safe default
|
20
|
+
result.is_fips_mode_enabled = false;
|
21
|
+
|
22
|
+
lth_file::each_line("/proc/sys/crypto/fips_enabled", [&](string& line) {
|
23
|
+
boost::trim(line);
|
24
|
+
result.is_fips_mode_enabled = line != "0";
|
25
|
+
|
26
|
+
return true;
|
27
|
+
});
|
28
|
+
return result;
|
29
|
+
}
|
30
|
+
|
31
|
+
}}} // namespace facter::facts::linux
|
@@ -67,21 +67,12 @@ namespace facter { namespace facts { namespace linux {
|
|
67
67
|
return nullptr;
|
68
68
|
}
|
69
69
|
sockaddr_ll const* link_addr = reinterpret_cast<sockaddr_ll const*>(addr);
|
70
|
-
if (link_addr->sll_halen != 6
|
70
|
+
if (link_addr->sll_halen != 6) {
|
71
71
|
return nullptr;
|
72
72
|
}
|
73
73
|
return reinterpret_cast<uint8_t const*>(link_addr->sll_addr);
|
74
74
|
}
|
75
75
|
|
76
|
-
uint8_t networking_resolver::get_link_address_length(sockaddr const* addr) const
|
77
|
-
{
|
78
|
-
if (!is_link_address(addr)) {
|
79
|
-
return 0;
|
80
|
-
}
|
81
|
-
sockaddr_ll const* link_addr = reinterpret_cast<sockaddr_ll const*>(addr);
|
82
|
-
return link_addr->sll_halen;
|
83
|
-
}
|
84
|
-
|
85
76
|
boost::optional<uint64_t> networking_resolver::get_link_mtu(string const& interface, void* data) const
|
86
77
|
{
|
87
78
|
// Unfortunately in Linux, the data points at interface statistics
|
@@ -27,21 +27,12 @@ namespace facter { namespace facts { namespace openbsd {
|
|
27
27
|
return nullptr;
|
28
28
|
}
|
29
29
|
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
30
|
-
if (link_addr->sdl_alen != 6
|
30
|
+
if (link_addr->sdl_alen != 6) {
|
31
31
|
return nullptr;
|
32
32
|
}
|
33
33
|
return reinterpret_cast<uint8_t const*>(LLADDR(link_addr));
|
34
34
|
}
|
35
35
|
|
36
|
-
uint8_t networking_resolver::get_link_address_length(sockaddr const* addr) const
|
37
|
-
{
|
38
|
-
if (!is_link_address(addr)) {
|
39
|
-
return 0;
|
40
|
-
}
|
41
|
-
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
42
|
-
return link_addr->sdl_alen;
|
43
|
-
}
|
44
|
-
|
45
36
|
boost::optional<uint64_t> networking_resolver::get_link_mtu(string const& interface, void* data) const
|
46
37
|
{
|
47
38
|
ifreq ifr;
|
@@ -23,21 +23,12 @@ namespace facter { namespace facts { namespace osx {
|
|
23
23
|
return nullptr;
|
24
24
|
}
|
25
25
|
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
26
|
-
if (link_addr->sdl_alen != 6
|
26
|
+
if (link_addr->sdl_alen != 6) {
|
27
27
|
return nullptr;
|
28
28
|
}
|
29
29
|
return reinterpret_cast<uint8_t const*>(LLADDR(link_addr));
|
30
30
|
}
|
31
31
|
|
32
|
-
uint8_t networking_resolver::get_link_address_length(sockaddr const* addr) const
|
33
|
-
{
|
34
|
-
if (!is_link_address(addr)) {
|
35
|
-
return 0;
|
36
|
-
}
|
37
|
-
sockaddr_dl const* link_addr = reinterpret_cast<sockaddr_dl const*>(addr);
|
38
|
-
return link_addr->sdl_alen;
|
39
|
-
}
|
40
|
-
|
41
32
|
boost::optional<uint64_t> networking_resolver::get_link_mtu(string const& interface, void* data) const
|
42
33
|
{
|
43
34
|
if (!data) {
|
@@ -49,9 +49,8 @@ namespace facter { namespace facts { namespace posix {
|
|
49
49
|
return buffer;
|
50
50
|
} else if (is_link_address(addr)) {
|
51
51
|
auto link_addr = get_link_address_bytes(addr);
|
52
|
-
uint8_t link_addr_len = get_link_address_length(addr);
|
53
52
|
if (link_addr) {
|
54
|
-
return macaddress_to_string(reinterpret_cast<uint8_t const*>(link_addr)
|
53
|
+
return macaddress_to_string(reinterpret_cast<uint8_t const*>(link_addr));
|
55
54
|
}
|
56
55
|
}
|
57
56
|
|
@@ -69,7 +68,7 @@ namespace facter { namespace facts { namespace posix {
|
|
69
68
|
}
|
70
69
|
// Get the hostname (+1 to ensure a null is returned on platforms where maximum truncation may occur)
|
71
70
|
vector<char> name(size + 1);
|
72
|
-
if (gethostname(name.data(), size) != 0) {
|
71
|
+
if (gethostname(name.data(), size + 1) != 0) {
|
73
72
|
LOG_WARNING("gethostname failed: {1} ({2}): hostname is unavailable.", strerror(errno), errno);
|
74
73
|
} else {
|
75
74
|
// Check for fully-qualified hostname
|
@@ -72,7 +72,7 @@ namespace facter { namespace facts { namespace posix {
|
|
72
72
|
return;
|
73
73
|
}
|
74
74
|
|
75
|
-
// The SSH file format
|
75
|
+
// The SSH public key file format is <algo> <key> <comment>
|
76
76
|
vector<boost::iterator_range<string::iterator>> parts;
|
77
77
|
boost::split(parts, contents, boost::is_any_of(" "), boost::token_compress_on);
|
78
78
|
if (parts.size() < 2) {
|
@@ -80,7 +80,8 @@ namespace facter { namespace facts { namespace posix {
|
|
80
80
|
return;
|
81
81
|
}
|
82
82
|
|
83
|
-
// Assign the key
|
83
|
+
// Assign the key and its type
|
84
|
+
key.type.assign(parts[0].begin(), parts[0].end());
|
84
85
|
key.key.assign(parts[1].begin(), parts[1].end());
|
85
86
|
|
86
87
|
// Only fingerprint if we are using OpenSSL
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#include <internal/facts/resolvers/fips_resolver.hpp>
|
2
|
+
#include <facter/facts/collection.hpp>
|
3
|
+
#include <facter/facts/fact.hpp>
|
4
|
+
#include <facter/facts/map_value.hpp>
|
5
|
+
#include <facter/facts/scalar_value.hpp>
|
6
|
+
|
7
|
+
using namespace std;
|
8
|
+
using namespace facter::facts;
|
9
|
+
|
10
|
+
namespace facter { namespace facts { namespace resolvers {
|
11
|
+
|
12
|
+
fips_resolver::fips_resolver() :
|
13
|
+
resolver("fips", {fact::fips_enabled})
|
14
|
+
{
|
15
|
+
}
|
16
|
+
|
17
|
+
void fips_resolver::resolve(collection& facts)
|
18
|
+
{
|
19
|
+
auto data = collect_data(facts);
|
20
|
+
facts.add(fact::fips_enabled, make_value<boolean_value>(data.is_fips_mode_enabled));
|
21
|
+
}
|
22
|
+
|
23
|
+
}}} // namespace facter::facts::resolvers
|
@@ -151,15 +151,15 @@ namespace facter { namespace facts { namespace resolvers {
|
|
151
151
|
}
|
152
152
|
}
|
153
153
|
|
154
|
-
string networking_resolver::macaddress_to_string(uint8_t const* bytes
|
154
|
+
string networking_resolver::macaddress_to_string(uint8_t const* bytes)
|
155
155
|
{
|
156
|
-
if (!bytes
|
156
|
+
if (!bytes) {
|
157
157
|
return {};
|
158
158
|
}
|
159
159
|
|
160
160
|
// Ignore MAC address "0"
|
161
161
|
bool nonzero = false;
|
162
|
-
for (size_t i = 0; i <
|
162
|
+
for (size_t i = 0; i < 6; ++i) {
|
163
163
|
if (bytes[i] != 0) {
|
164
164
|
nonzero = true;
|
165
165
|
break;
|
@@ -169,26 +169,10 @@ namespace facter { namespace facts { namespace resolvers {
|
|
169
169
|
return {};
|
170
170
|
}
|
171
171
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
static_cast<int>(bytes[4]) % static_cast<int>(bytes[5])).str();
|
177
|
-
} else if (byte_count == 20) {
|
178
|
-
return (boost::format("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x") %
|
179
|
-
static_cast<int>(bytes[0]) % static_cast<int>(bytes[1]) %
|
180
|
-
static_cast<int>(bytes[2]) % static_cast<int>(bytes[3]) %
|
181
|
-
static_cast<int>(bytes[4]) % static_cast<int>(bytes[5]) %
|
182
|
-
static_cast<int>(bytes[6]) % static_cast<int>(bytes[7]) %
|
183
|
-
static_cast<int>(bytes[8]) % static_cast<int>(bytes[9]) %
|
184
|
-
static_cast<int>(bytes[10]) % static_cast<int>(bytes[11]) %
|
185
|
-
static_cast<int>(bytes[12]) % static_cast<int>(bytes[13]) %
|
186
|
-
static_cast<int>(bytes[14]) % static_cast<int>(bytes[15]) %
|
187
|
-
static_cast<int>(bytes[16]) % static_cast<int>(bytes[17]) %
|
188
|
-
static_cast<int>(bytes[18]) % static_cast<int>(bytes[19])).str();
|
189
|
-
} else {
|
190
|
-
return {};
|
191
|
-
}
|
172
|
+
return (boost::format("%02x:%02x:%02x:%02x:%02x:%02x") %
|
173
|
+
static_cast<int>(bytes[0]) % static_cast<int>(bytes[1]) %
|
174
|
+
static_cast<int>(bytes[2]) % static_cast<int>(bytes[3]) %
|
175
|
+
static_cast<int>(bytes[4]) % static_cast<int>(bytes[5])).str();
|
192
176
|
}
|
193
177
|
|
194
178
|
bool networking_resolver::ignored_ipv4_address(string const& addr)
|
@@ -50,6 +50,7 @@ namespace facter { namespace facts { namespace resolvers {
|
|
50
50
|
|
51
51
|
facts.add(string(key_fact_name), make_value<string_value>(key.key, true));
|
52
52
|
key_value->add("key", make_value<string_value>(move(key.key)));
|
53
|
+
key_value->add("type", make_value<string_value>(move(key.type)));
|
53
54
|
|
54
55
|
string fingerprint;
|
55
56
|
if (!key.digest.sha1.empty()) {
|
@@ -171,11 +171,6 @@ namespace facter { namespace facts { namespace solaris {
|
|
171
171
|
return nullptr;
|
172
172
|
}
|
173
173
|
|
174
|
-
uint8_t networking_resolver::get_link_address_length(const sockaddr * addr) const
|
175
|
-
{
|
176
|
-
return 0;
|
177
|
-
}
|
178
|
-
|
179
174
|
string networking_resolver::find_dhcp_server(string const& interface) const
|
180
175
|
{
|
181
176
|
auto exec = execute("dhcpinfo", { "-i", interface, "ServerID" });
|
@@ -27,15 +27,19 @@ struct test_ssh_resolver : ssh_resolver
|
|
27
27
|
{
|
28
28
|
data result;
|
29
29
|
result.dsa.key = "dsa:key";
|
30
|
+
result.dsa.type = "dsa:type";
|
30
31
|
result.dsa.digest.sha1 = "dsa:sha1";
|
31
32
|
result.dsa.digest.sha256 = "dsa:sha256";
|
32
33
|
result.ecdsa.key = "ecdsa:key";
|
34
|
+
result.ecdsa.type = "ecdsa:type";
|
33
35
|
result.ecdsa.digest.sha1 = "ecdsa:sha1";
|
34
36
|
result.ecdsa.digest.sha256 = "ecdsa:sha256";
|
35
37
|
result.ed25519.key = "ed25519:key";
|
38
|
+
result.ed25519.type = "ed25519:type";
|
36
39
|
result.ed25519.digest.sha1 = "ed25519:sha1";
|
37
40
|
result.ed25519.digest.sha256 = "ed25519:sha256";
|
38
41
|
result.rsa.key = "rsa:key";
|
42
|
+
result.rsa.type = "rsa:type";
|
39
43
|
result.rsa.digest.sha1 = "rsa:sha1";
|
40
44
|
result.rsa.digest.sha256 = "rsa:sha256";
|
41
45
|
return result;
|
@@ -66,10 +70,13 @@ SCENARIO("using the ssh resolver") {
|
|
66
70
|
for (auto const& algorithm : algorithms) {
|
67
71
|
auto entry = ssh->get<map_value>(algorithm);
|
68
72
|
REQUIRE(entry);
|
69
|
-
REQUIRE(entry->size() ==
|
73
|
+
REQUIRE(entry->size() == 3u);
|
70
74
|
auto key = entry->get<string_value>("key");
|
71
75
|
REQUIRE(key);
|
72
76
|
REQUIRE(key->value() == algorithm + ":key");
|
77
|
+
auto type = entry->get<string_value>("type");
|
78
|
+
REQUIRE(type);
|
79
|
+
REQUIRE(type->value() == algorithm + ":type");
|
73
80
|
auto fingerprints = entry->get<map_value>("fingerprints");
|
74
81
|
REQUIRE(fingerprints);
|
75
82
|
REQUIRE(fingerprints->size() == 2u);
|
@@ -17,6 +17,7 @@
|
|
17
17
|
#include <internal/facts/resolvers/dmi_resolver.hpp>
|
18
18
|
#include <internal/facts/resolvers/ec2_resolver.hpp>
|
19
19
|
#include <internal/facts/resolvers/filesystem_resolver.hpp>
|
20
|
+
#include <internal/facts/resolvers/fips_resolver.hpp>
|
20
21
|
#include <internal/facts/resolvers/gce_resolver.hpp>
|
21
22
|
#include <internal/facts/resolvers/hypervisors_resolver.hpp>
|
22
23
|
#include <internal/facts/resolvers/identity_resolver.hpp>
|
@@ -139,6 +140,17 @@ struct filesystem_resolver : resolvers::filesystem_resolver
|
|
139
140
|
}
|
140
141
|
};
|
141
142
|
|
143
|
+
struct fips_resolver : resolvers::fips_resolver
|
144
|
+
{
|
145
|
+
protected:
|
146
|
+
virtual data collect_data(collection& facts) override
|
147
|
+
{
|
148
|
+
data result;
|
149
|
+
result.is_fips_mode_enabled = false;
|
150
|
+
return result;
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
142
154
|
using hypervisor_data = std::unordered_map<std::string, std::unordered_map<std::string, boost::variant<std::string, bool, int>>>;
|
143
155
|
|
144
156
|
struct hypervisors_resolver_test : resolvers::hypervisors_resolver_base
|
@@ -310,15 +322,19 @@ protected:
|
|
310
322
|
{
|
311
323
|
data result;
|
312
324
|
result.dsa.key = "dsa:key";
|
325
|
+
result.dsa.type = "dsa:type";
|
313
326
|
result.dsa.digest.sha1 = "dsa:sha1";
|
314
327
|
result.dsa.digest.sha256 = "dsa:sha256";
|
315
328
|
result.ecdsa.key = "ecdsa:key";
|
329
|
+
result.ecdsa.type = "ecdsa:type";
|
316
330
|
result.ecdsa.digest.sha1 = "ecdsa:sha1";
|
317
331
|
result.ecdsa.digest.sha256 = "ecdsa:sha256";
|
318
332
|
result.ed25519.key = "ed25519:key";
|
333
|
+
result.ed25519.type = "ed25519:type";
|
319
334
|
result.ed25519.digest.sha1 = "ed25519:sha1";
|
320
335
|
result.ed25519.digest.sha256 = "ed25519:sha256";
|
321
336
|
result.rsa.key = "rsa:key";
|
337
|
+
result.rsa.type = "rsa:type";
|
322
338
|
result.rsa.digest.sha1 = "rsa:sha1";
|
323
339
|
result.rsa.digest.sha256 = "rsa:sha256";
|
324
340
|
return result;
|
@@ -469,6 +485,7 @@ void add_all_facts(collection& facts)
|
|
469
485
|
facts.add(make_shared<disk_resolver>());
|
470
486
|
facts.add(make_shared<dmi_resolver>());
|
471
487
|
facts.add(make_shared<filesystem_resolver>());
|
488
|
+
facts.add(make_shared<fips_resolver>());
|
472
489
|
// TODO: refactor the EC2 resolver to use the "collect_data" pattern
|
473
490
|
facts.add(make_shared<ec2_resolver>());
|
474
491
|
// TODO: refactor the GCE resolver to use the "collect_data" pattern
|