#!/usr/bin/python
-
+import hashlib
import json
import os
import string
@property
def public_id(self):
- return "0"*40
+ """
+ This returns a globally (hopefully) ID to identify the host
+ later (by request) in the database.
+ """
+ return hashlib.sha1(self._unique_id).hexdigest()
@property
def private_id(self):
- return "1"*40
-
+ """
+ The private ID is built out of the _unique_id and used to
+ permit a host to do changes on the database.
+
+ No one could ever guess this without access to the host.
+ """
+ return hashlib.sha1("%s" % reversed(self._unique_id)).hexdigest()
+
+ @property
+ def _unique_id(self):
+ """
+ This is a helper ID which is generated out of some hardware information
+ that is considered to be constant over a PC's lifetime.
+
+ None of the data here is ever sent to the server.
+ """
+ return "123456789" # XXX just a dummy
+
@property
def language(self):
with open("/var/ipfire/main/settings", "r") as f: