| Server IP : 157.230.181.24 / Your IP : 216.73.217.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/landscape/lib/ |
Upload File : |
import logging
import uuid
# exclude _get_machine_id
__all__ = [
"get_namespaced_machine_id",
"LANDSCAPE_CLIENT_APP_UUID",
"MACHINE_ID_FILE",
"MACHINE_ID_SIZE",
]
# Used to build a namespaced-uuid from the machine ids of client instances.
# It was generated using `uuidgen -r`
# This value should never change. Ever.
LANDSCAPE_CLIENT_APP_UUID = uuid.UUID("534a0cda-35a7-4f8a-a5cb-d8d9bb24a790")
# https://manpages.ubuntu.com/manpages/bionic/man5/machine-id.5.html
# We expect 32 ASCII characters, so we won't read in any more than
# the expected 32 bytes.
MACHINE_ID_FILE = "/etc/machine-id"
MACHINE_ID_SIZE = 32
def _get_machine_id() -> str:
with open(MACHINE_ID_FILE, "r") as f:
machine_id = f.read(MACHINE_ID_SIZE)
return machine_id
def get_namespaced_machine_id() -> str | None:
try:
machine_id = _get_machine_id()
except Exception as e:
logging.warning(str(e))
return
if not machine_id:
return
return str(uuid.uuid5(LANDSCAPE_CLIENT_APP_UUID, machine_id))