diff --git a/dissect/target/plugins/os/unix/_os.py b/dissect/target/plugins/os/unix/_os.py index 5b2d46cf0..7b475deab 100644 --- a/dissect/target/plugins/os/unix/_os.py +++ b/dissect/target/plugins/os/unix/_os.py @@ -182,7 +182,7 @@ def _parse_hostname_string(self, paths: list[str] | None = None) -> dict[str, st paths (list): list of paths """ redhat_legacy_path = "/etc/sysconfig/network" - paths = paths or ["/etc/hostname", "/etc/HOSTNAME", redhat_legacy_path] + paths = paths or ["/etc/hostname", "/etc/HOSTNAME", "/proc/sys/kernel/hostname", redhat_legacy_path] hostname_dict = {"hostname": None, "domain": None} for path in paths: diff --git a/tests/plugins/os/unix/test__os.py b/tests/plugins/os/unix/test__os.py index 4093c5d9b..ffb3c917e 100644 --- a/tests/plugins/os/unix/test__os.py +++ b/tests/plugins/os/unix/test__os.py @@ -112,6 +112,7 @@ def test_mount_volume_name_regression(fs_unix: VirtualFilesystem) -> None: ("/not_a_valid_hostname_path", None, None, ""), ("/etc/hostname", None, None, ""), ("/etc/sysconfig/network", None, None, ""), + ("/proc/sys/kernel/hostname", "myhost", None, "myhost"), ], ) def test_parse_hostname_string(