{"id":499715,"date":"2026-10-22T10:20:51","date_gmt":"2026-10-22T07:20:51","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=499715"},"modified":"2026-10-22T10:20:51","modified_gmt":"2026-10-22T07:20:51","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=499715","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 immutable\u2011\u043b\u043e\u0433\u0433\u0435\u0440 \u043d\u0430\u00a0Python: \u043a\u0430\u043a\u00a0\u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u00a0edge\u2011\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0431\u0435\u0437\u00a0\u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0438 SIEM"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <\/p>\n<p>\u042f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f\u00a0\u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0445 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u00a0\u044d\u043a\u0441\u0442\u0440\u0435\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445: \u0431\u0435\u0437\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u0431\u0435\u0437\u00a0\u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0438 \u0431\u0435\u0437\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437\u00a0\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u00a0\u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043b\u043e\u0433\u043e\u0432. \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u0430\u043b\u043e \u0432\u00a0\u0430\u0432\u0430\u0440\u0438\u044e \u0438\u043b\u0438\u00a0\u0431\u044b\u043b\u043e \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <code>system.log<\/code> \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c: \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u043b\u0438\u00a0\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439. <\/p>\n<p>\u041a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 SIEM\u2011\u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0432\u0440\u043e\u0434\u0435 ELK) \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0435\u043b\u044b \u0434\u043b\u044f\u00a0edge\u2011\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c\u044e. \u041e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438\u0437\u2011\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u0432\u044f\u0437\u0438. <\/p>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u00a0\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439, \u043d\u0435\u00a0\u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441\u00a0\u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c), \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u00a0\u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u043b\u043a\u0438.<\/p>\n<h4>\u041a\u0430\u043a\u00a0\u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430)<\/h4>\n<p>\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430, \u043d\u043e\u00a0\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430. \u041a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u00a0\u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0445\u0435\u0448 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u043d\u043e\u00a0\u0438 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u0435\u0448\u0430 <em>\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439<\/em> \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>[2023-10-27 14:32:01] [CRITICAL] [SAFETY] Emergency shutdown triggered | PREV: a1b2c3d4... | SIG: e5f6g7h8...<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 (<code>SIG<\/code>) \u0434\u043b\u044f\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"python\">hash_input = f\"[{timestamp}] [{level}] [{module}] {message}{prev_hash}\"current_hash = hashlib.sha256(hash_input.encode('utf-8')).hexdigest()[:16]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0436\u0435\u0441\u0442\u043a\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c 1: <code>SIG: hash1<\/code> (\u0433\u0434\u0435 <code>PREV<\/code> = \u00abGENESIS\u00bb)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c 2: <code>SIG: hash2<\/code> (\u0433\u0434\u0435 <code>PREV<\/code> = <code>hash1<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c 3: <code>SIG: hash3<\/code> (\u0433\u0434\u0435 <code>PREV<\/code> = <code>hash2<\/code>)<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a (\u0438\u043b\u0438 \u0441\u0431\u043e\u0439\u043d\u044b\u0439 \u0441\u0435\u043a\u0442\u043e\u0440 \u0434\u0438\u0441\u043a\u0430) \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u0432\u043e 2-\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0435\u0451 \u0445\u0435\u0448 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f. \u042d\u0442\u043e \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a\u00a0\u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e <code>PREV<\/code> \u0432 3-\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0438 \u0432\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u00a0Python<\/h4>\n<p>\u042f \u043d\u0430\u0437\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <strong>KERN Witness<\/strong>. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c Python (\u0431\u0435\u0437 <code>pip install<\/code> \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a), \u0447\u0442\u043e\u00a0\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f\u00a0\u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u0432\u0440\u043e\u0434\u0435 Raspberry Pi \u0438\u043b\u0438\u00a0ESP32\u00a0(\u0447\u0435\u0440\u0435\u0437 MicroPython).<\/p>\n<p>\u0412\u043e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"python\">def log(self, level: str, module: str, message: str) -&gt; str:    timestamp = datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")    raw_string = f\"[{timestamp}] [{level}] [{module}] {message}\"        # \u0425\u0435\u0448 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0445\u0435\u0448 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439    hash_input = f\"{raw_string}{self.last_hash}\"    current_hash = hashlib.sha256(hash_input.encode('utf-8')).hexdigest()[:16]        final_entry = f\"{raw_string} | PREV: {self.last_hash} | SIG: {current_hash}\\n\"        with open(self.filepath, \"a\", encoding=\"utf-8\") as f:        f.write(final_entry)        self.last_hash = current_hash    return current_hash<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p><em>\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441:<\/em> \u041f\u0440\u0438\u00a0\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <code>line.rsplit(\" | \", 2)<\/code>. \u042d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a\u00a0\u0441\u0430\u043c\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<code>message<\/code>) \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b <code>|<\/code>. \u041c\u0435\u0442\u043e\u0434 <code>rsplit<\/code> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e\u00a0\u043c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0440\u043e\u0432\u043d\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 <em>\u0441\u043f\u0440\u0430\u0432\u0430<\/em>, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044f <code>PREV<\/code> \u0438 <code>SIG<\/code>, \u043d\u0435\u00a0\u043b\u043e\u043c\u0430\u044f \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.\u00bb<\/p>\n<h4>\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b (\u0422\u0435\u0441\u0442\u044b)<\/h4>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u00a0\u0441\u0435\u0431\u044f \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0435\u0433\u043e \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c. <\/p>\n<p><strong>\u0422\u0435\u0441\u0442 \u043d\u0430\u00a0\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438:<\/strong><br \/> \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437\u00a0\u0444\u0430\u0439\u043b\u0430 \u0441\u00a0\u0442\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438, \u043c\u0435\u0442\u043e\u0434 <code>verify()<\/code> \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u0440\u0430\u0437\u0440\u044b\u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438:<\/p>\n<pre><code class=\"python\"># \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430del lines[1] is_valid, issues = witness.verify()# is_valid \u0431\u0443\u0434\u0435\u0442 False# issues \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c: \"\u0421\u0442\u0440\u043e\u043a\u0430 2: \u0440\u0430\u0437\u0440\u044b\u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438! \u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f PREV: hash1, \u043d\u0430\u0439\u0434\u0435\u043d\u043e: hash3\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h4>\u0427\u0435\u0441\u0442\u043d\u043e \u043e\u0431\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445<\/h4>\n<p>\u041a\u0430\u043a\u00a0\u0438\u043d\u0436\u0435\u043d\u0435\u0440, \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0447\u0435\u0442\u043a\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. KERN Witness \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 <strong>\u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c<\/strong>, \u043d\u043e\u00a0\u043d\u0435\u00a0\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p><strong>\u042d\u0442\u043e \u043d\u0435\u00a0\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/strong> \u0417\u0430\u043f\u0438\u0441\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435. \u0414\u043b\u044f\u00a0\u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u043a\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, LUKS).<\/p>\n<\/li>\n<li>\n<p><strong>\u042d\u0442\u043e \u043d\u0435\u00a0\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/strong> \u0417\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u0441\u00a0\u043f\u0440\u0430\u0432\u0430\u043c\u0438 root \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430. \u0426\u0435\u043f\u043e\u0447\u043a\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u043e\u0439, \u043d\u043e\u00a0\u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. <em>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/em> \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0444\u0430\u0439\u043b\u0443 (<code>chmod 400<\/code> \u0438\u043b\u0438 <code>600<\/code>) \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430\u00a0append\u2011only \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u042d\u0442\u043e \u043d\u0435\u00a0\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f.<\/strong> \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u044f\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043d\u0435\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. <em>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/em> \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0445\u0435\u0448\u0435\u0439 \u043d\u0430\u00a0\u0432\u043d\u0435\u0448\u043d\u0438\u0439, \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0443\u0437\u0435\u043b.<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 Open Source<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u044b \u043f\u043e\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u0447\u043d\u043e\u0439, \u043e\u0444\u043b\u0430\u0439\u043d\u2011\u043f\u0435\u0440\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0438 (KERN SYSTEMS), \u0433\u0434\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043a\u00a0\u0434\u0430\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c\u0438.<\/p>\n<p>\u042f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u00a0GitHub \u043f\u043e\u0434\u00a0\u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 <strong>AGPL-3.0<\/strong> \u0438 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435, code review \u0438\u043b\u0438\u00a0\u0438\u0434\u0435\u044f\u043c \u043f\u043e\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u00a0\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430.<\/p>\n<p>\ud83d\udd17 <strong>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:<\/strong> <a href=\"https:\/\/github.com\/0ntwee\/kern-witness\" rel=\"noopener nofollow\">https:\/\/github.com\/0ntwee\/kern\u2011witness<\/a><\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e\u00a0\u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u0413\u043e\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0\u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1097686\/\">https:\/\/habr.com\/ru\/articles\/1097686\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u042f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f\u00a0\u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0445 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u00a0\u044d\u043a\u0441\u0442\u0440\u0435\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445: \u0431\u0435\u0437\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u0431\u0435\u0437\u00a0\u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0438 \u0431\u0435\u0437\u00a0\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u041e\u0434\u043d\u0430 \u0438\u0437\u00a0\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u00a0\u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043b\u043e\u0433\u043e\u0432. \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u043f\u0430\u043b\u043e \u0432\u00a0\u0430\u0432\u0430\u0440\u0438\u044e \u0438\u043b\u0438\u00a0\u0431\u044b\u043b\u043e \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b system.log \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c: \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u043b\u0438\u00a0\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 SIEM\u2011\u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0432\u0440\u043e\u0434\u0435 ELK) \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0435\u043b\u044b \u0434\u043b\u044f\u00a0edge\u2011\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c\u044e. \u041e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438\u0437\u2011\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u0432\u044f\u0437\u0438. \u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u00a0\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439, \u043d\u0435\u00a0\u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441\u00a0\u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c), \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u00a0\u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u043b\u043a\u0438.\u041a\u0430\u043a\u00a0\u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430)\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430, \u043d\u043e\u00a0\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430. \u041a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u00a0\u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0445\u0435\u0448 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u043d\u043e\u00a0\u0438 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u0435\u0448\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.\u0424\u043e\u0440\u043c\u0430\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:[2023-10-27 14:32:01] [CRITICAL] [SAFETY] Emergency shutdown triggered | PREV: a1b2c3d4&#8230; | SIG: e5f6g7h8&#8230;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 (SIG) \u0434\u043b\u044f\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438:hash_input = f&#187;[{timestamp}] [{level}] [{module}] {message}{prev_hash}&#187;current_hash = hashlib.sha256(hash_input.encode(&#8216;utf-8&#8217;)).hexdigest()[:16]\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0436\u0435\u0441\u0442\u043a\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443:\u0417\u0430\u043f\u0438\u0441\u044c 1: SIG: hash1 (\u0433\u0434\u0435 PREV = \u00abGENESIS\u00bb)\u0417\u0430\u043f\u0438\u0441\u044c 2: SIG: hash2 (\u0433\u0434\u0435 PREV = hash1)\u0417\u0430\u043f\u0438\u0441\u044c 3: SIG: hash3 (\u0433\u0434\u0435 PREV = hash2)\u0415\u0441\u043b\u0438 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a (\u0438\u043b\u0438 \u0441\u0431\u043e\u0439\u043d\u044b\u0439 \u0441\u0435\u043a\u0442\u043e\u0440 \u0434\u0438\u0441\u043a\u0430) \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0442\u0435\u043a\u0441\u0442 \u0432\u043e 2-\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0435\u0451 \u0445\u0435\u0448 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f. \u042d\u0442\u043e \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a\u00a0\u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e PREV \u0432 3-\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0438 \u0432\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0439 \u043f\u0440\u0438\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435.\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u00a0Python\u042f \u043d\u0430\u0437\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c KERN Witness. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c Python (\u0431\u0435\u0437 pip install \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a), \u0447\u0442\u043e\u00a0\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f\u00a0\u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u0432\u0440\u043e\u0434\u0435 Raspberry Pi \u0438\u043b\u0438\u00a0ESP32\u00a0(\u0447\u0435\u0440\u0435\u0437 MicroPython).\u0412\u043e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438:def log(self, level: str, module: str, message: str) -&gt; str:    timestamp = datetime.now().strftime(&#171;%Y-%m-%d %H:%M:%S&#187;)    raw_string = f&#187;[{timestamp}] [{level}] [{module}] {message}&#187;        # \u0425\u0435\u0448 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0445\u0435\u0448 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439    hash_input = f&#187;{raw_string}{self.last_hash}&#187;    current_hash = hashlib.sha256(hash_input.encode(&#8216;utf-8&#8217;)).hexdigest()[:16]        final_entry = f&#187;{raw_string} | PREV: {self.last_hash} | SIG: {current_hash}\\n&#187;        with open(self.filepath, &#171;a&#187;, encoding=&#187;utf-8&#8243;) as f:        f.write(final_entry)        self.last_hash = current_hash    return current_hash\u0418\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441: \u041f\u0440\u0438\u00a0\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e line.rsplit(&#187; | &#171;, 2). \u042d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a\u00a0\u0441\u0430\u043c\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (message) \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b |. \u041c\u0435\u0442\u043e\u0434 rsplit \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e\u00a0\u043c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0440\u043e\u0432\u043d\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0441\u043f\u0440\u0430\u0432\u0430, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044f PREV \u0438 SIG, \u043d\u0435\u00a0\u043b\u043e\u043c\u0430\u044f \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.\u00bb\u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b (\u0422\u0435\u0441\u0442\u044b)\u041c\u043e\u0434\u0443\u043b\u044c \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u00a0\u0441\u0435\u0431\u044f \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0435\u0433\u043e \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c. \u0422\u0435\u0441\u0442 \u043d\u0430\u00a0\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438: \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437\u00a0\u0444\u0430\u0439\u043b\u0430 \u0441\u00a0\u0442\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438, \u043c\u0435\u0442\u043e\u0434 verify() \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u0440\u0430\u0437\u0440\u044b\u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438:# \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430del lines[1] is_valid, issues = witness.verify()# is_valid \u0431\u0443\u0434\u0435\u0442 False# issues \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c: &#171;\u0421\u0442\u0440\u043e\u043a\u0430 2: \u0440\u0430\u0437\u0440\u044b\u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0438! \u041e\u0436\u0438\u0434\u0430\u043b\u0441\u044f PREV: hash1, \u043d\u0430\u0439\u0434\u0435\u043d\u043e: hash3&#8243;\u0427\u0435\u0441\u0442\u043d\u043e \u043e\u0431\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445\u041a\u0430\u043a\u00a0\u0438\u043d\u0436\u0435\u043d\u0435\u0440, \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0447\u0435\u0442\u043a\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. KERN Witness \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c, \u043d\u043e\u00a0\u043d\u0435\u00a0\u0440\u0435\u0448\u0430\u0435\u0442 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438:\u042d\u0442\u043e \u043d\u0435\u00a0\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0417\u0430\u043f\u0438\u0441\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u00a0\u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435. \u0414\u043b\u044f\u00a0\u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u043a\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, LUKS).\u042d\u0442\u043e \u043d\u0435\u00a0\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0417\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u0441\u00a0\u043f\u0440\u0430\u0432\u0430\u043c\u0438 root \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u00a0\u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430. \u0426\u0435\u043f\u043e\u0447\u043a\u0430 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u043e\u0439, \u043d\u043e\u00a0\u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0444\u0430\u0439\u043b\u0443 (chmod 400 \u0438\u043b\u0438 600) \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430\u00a0append\u2011only \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.\u042d\u0442\u043e \u043d\u0435\u00a0\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u044f\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043d\u0435\u00a0\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0445\u0435\u0448\u0435\u0439 \u043d\u0430\u00a0\u0432\u043d\u0435\u0448\u043d\u0438\u0439, \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0443\u0437\u0435\u043b.\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 Open Source\u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e \u043c\u043e\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u044b \u043f\u043e\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u0447\u043d\u043e\u0439, \u043e\u0444\u043b\u0430\u0439\u043d\u2011\u043f\u0435\u0440\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0438 (KERN SYSTEMS), \u0433\u0434\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043a\u00a0\u0434\u0430\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c\u0438.\u042f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u00a0GitHub \u043f\u043e\u0434\u00a0\u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 AGPL-3.0 \u0438 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435, code review \u0438\u043b\u0438\u00a0\u0438\u0434\u0435\u044f\u043c \u043f\u043e\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u00a0\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430.\ud83d\udd17 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: https:\/\/github.com\/0ntwee\/kern\u2011witness\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e\u00a0\u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u0413\u043e\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0\u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1097686\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-499715","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/499715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=499715"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/499715\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=499715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=499715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=499715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}