{"id":288656,"date":"2018-08-28T22:40:02","date_gmt":"2018-08-28T18:40:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288656"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288656","title":{"rendered":"\u0427\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 .ssh\/known_hosts"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/421477\/\" class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t3\/or\/pw\/t3orpw03cujdqdjjajfr8vou66i.jpeg\"><\/div>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 ssh \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, ssh \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0430\u043a \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 ssh). \u0412 OpenSSH \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 known_hosts. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0442\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f.<br \/>  <a name=\"habracut\"><\/a><i>\u0412\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Linux (Debian\/Mint\/Ubuntu). \u0417\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u041e\u0421 \u043d\u0435 \u0440\u0443\u0447\u0430\u044e\u0441\u044c.<\/i><br \/>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043a ssh \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435:  <\/p>\n<blockquote><p>The authenticity of host &#8216;192.168.0.2 (192.168.0.2)&#8217; can&#8217;t be established.<br \/>  RSA key fingerprint is SHA256:kd9mRkEGLo+RBBNpxKp7mInocF3\/Yl\/0fXRsGJ2JfYg.<br \/>  Are you sure you want to continue connecting (yes\/no)?<\/p><\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u044c\u0441\u044f, \u0442\u043e \u0432 \u0444\u0430\u0439\u043b ~\/.ssh\/known_hosts \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:  <\/p>\n<blockquote><p>|1|CuXixZ+EWfgz40wpkMugPHPalyk=|KNoVhur7z5NAZmNndtwWq0kN1SQ= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeiF4OOOUhWvOYrh\/e4q91+iz+i9S0s3M2LPq+GAhRlhKt5vKyEVd6x6m26cc98Y+SQXnCB9GWeVYk8jlFHEXnY4YWeWLDwXIhHBJYt5yz3j5Wkg95x+mPvO9FLSBk\/Al2GbH5q6F+hZIlLmO6ciISmX4TtcG1sw4SwoTADrrhdM0OJd+c5CU8iqCbc6PznYbLZXCvqPZTWeSbTLUcUu1Ti+7xGwT8DF+tIyLFcU+zxd0QnwJIbNvewkHs0LsMOWFVPz\/Nd0XiVXimX+ugCDBZ\/4q8NUwH9SGzCMAvnnr+D1I8X2vhSuRsTsQXL5P3vf8elDxPdDrMJzNtlBCbLWzV<\/p><\/blockquote>\n<p>\u0422\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u0440\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430: \u0445\u044d\u0448 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0430\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438\u0445 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"http:\/\/manpages.ubuntu.com\/manpages\/bionic\/en\/man8\/sshd.8.html#ssh_known_hosts%20file%20format\">\u043c\u0430\u043d\u0443\u0430\u043b\u0443 \u043a \u0423\u0431\u0443\u043d\u0442\u0435<\/a> \u0442\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0435\u0449\u0451 2 \u043f\u043e\u043b\u044f, \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>\u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043c\u0435\u0442\u043a\u0430 &#171;@cert-authority&#187; \u0438\u043b\u0438 \u201c@revoked\u201d, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0426\u0410 \u0438\u043b\u0438 \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 \u0431\u044b\u043b \u043e\u0442\u043e\u0437\u0432\u0430\u043d \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d.<\/li>\n<li>\u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0418\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0445\u044d\u0448 \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0445\u043e\u0441\u0442\u0430) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<blockquote><p>|1|CuXixZ+EWfgz40wpkMugPHPalyk=|KNoVhur7z5NAZmNndtwWq0kN1SQ=<\/p><\/blockquote>\n<p> \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0438 \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u043b\u0438 \u043c\u0430\u0441\u043a\u0430, \u0437\u0430\u0434\u0430\u044e\u0449\u0430\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0438\u043c\u0451\u043d. \u041d\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043e\u0435 \u0438\u043c\u044f. \u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 3 \u0447\u0430\u0441\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c &#171;|&#187;. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u00ab1\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 HMAC-SHA1 (\u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b). \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0441\u043e\u043b\u044c (\u043a\u043b\u044e\u0447 \u0434\u043b\u044f HMAC). \u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u044d\u0448 (\u0432\u044b\u0432\u043e\u0434 HMAC). <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from base64 import b64decode import hmac  salt = b64decode(\"CuXixZ+EWfgz40wpkMugPHPalyk=\") host = b'192.168.0.2' hash = hmac.HMAC(salt, host, 'sha1').digest() print(b64encode(hash).decode()) <\/code><\/pre>\n<p>  &gt; &#8216;KNoVhur7z5NAZmNndtwWq0kN1SQ=&#8217;  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0410\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h4>\n<p>  \u0412 <a href=\"https:\/\/tools.ietf.org\/html\/rfc4253\">RFC-4253<\/a> \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b 4 \u0430\u0441\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430: ssh-dss (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439), ssh-rsa (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439), pgp-sign-rsa (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439), pgp-sign-dss (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439). \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 Linux \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0432\u0438\u0434\u043e\u0432 \u0438 \u0434\u043b\u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0432 RFC \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043d\u0430 \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u0440\u0438\u0432\u044b\u0445. \u041f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0446\u0438\u0435\u0439 HostKeyAlgorithms.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 (\u043d\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0435\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u0445\u043e\u0434\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430, \u0430 \u0437\u043d\u0430\u0435\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430 ssh-rsa. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:  <\/p>\n<blockquote><p>ssh root@192.168.0.2 -o HostKeyAlgorithms=ssh-rsa<\/p><\/blockquote>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0449\u0451 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e FingerprintHash. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e md5 \u043e\u0442 ssh-rsa \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a:  <\/p>\n<blockquote><p>ssh root@192.168.0.2 -o HostKeyAlgorithms=ssh-rsa -o FingerprintHash=md5<\/p><\/blockquote>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447<\/h4>\n<p>  \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0432 known_hosts \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0444\u0430\u0439\u043b\u0435 \/etc\/ssh\/ssh_host_rsa_key.pub \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 (\u0432\u043c\u0435\u0441\u0442\u043e rsa \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430). \u0415\u0441\u043b\u0438 \u0441\u043d\u044f\u0442\u044c Base64 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u0440\u0430\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043a\u043b\u044e\u0447\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0410 \u0447\u0435\u0433\u043e \u0431\u044b \u0438 \u043d\u0435 \u0441\u043d\u044f\u0442\u044c Base64<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">b'\\x00\\x00\\x00\\x07ssh-rsa\\x00\\x00\\x00\\x03\\x01\\x00\\x01\\x00\\x00\\x01\\x01\\x00\\x9e\\x88^\\x0e8\\xe5!Z\\xf3\\x98\\xae\\x1f\\xde\\xe2\\xafu\\xfa,\\xfe\\x8b\\xd4\\xb4\\xb3s6,\\xfa\\xbe\\x18\\x08Q\\x96\\x12\\xad\\xe6\\xf2\\xb2\\x11Wz\\xc7\\xa9\\xb6\\xe9\\xc7=\\xf1\\x8f\\x92Ay\\xc2\\x07\\xd1\\x96yV$\\xf29E\\x1cE\\xe7c\\x86\\x16yb\\xc3\\xc1r!\\x1c\\x12X\\xb7\\x9c\\xb3\\xde&gt;V\\x92\\x0fy\\xc7\\xe9\\x8f\\xbc\\xefE- d\\xfc\\tv\\x19\\xb1\\xf9\\xab\\xa1~\\x85\\x92%.c\\xbar\"\\x12\\x99~\\x13\\xb5\\xc1\\xb5\\xb3\\x0e\\x12\\xc2\\x84\\xc0\\x0e\\xba\\xe1t\\xcd\\x0e%\\xdf\\x9c\\xe4%&lt;\\x8a\\xa0\\x9bs\\xa3\\xf3\\x9d\\x86\\xcbep\\xaf\\xa8\\xf6SY\\xe4\\x9bL\\xb5\\x1cR\\xedS\\x8b\\xee\\xf1\\x1b\\x04\\xfc\\x0c_\\xad#\"\\xc5qO\\xb3\\xc5\\xdd\\x10\\x9f\\x02Hl\\xdb\\xde\\xc2A\\xec\\xd0\\xbb\\x0c9aU??\\xcdwE\\xe2Ux\\xa6_\\xeb\\xa0\\x080Y\\xff\\x8a\\xbc5L\\x07\\xf5!\\xb3\\x08\\xc0\/\\x9ez\\xfe\\x0fR&lt;_k\\xe1J\\xe4lN\\xc4\\x17\/\\x93\\xf7\\xbd\\xff\\x1e\\x94&lt;Ot:\\xcc\\'3m\\x94\\x10\\x9b-l\\xd5'<\/code><\/pre>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0438\u0434\u0443\u0442 4 \u0431\u0430\u0439\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u043b\u0438\u043d\u0430 \u043f\u043e\u043b\u044f, \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c\u043e \u043f\u043e\u043b\u0435 \u0438 \u0442.\u0434. \u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043a\u043b\u044e\u0447\u0435 3 \u043f\u043e\u043b\u044f:  <\/p>\n<pre><code class=\"python\">b'ssh-rsa' - \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435  b'\\x01\\x00\\x01' - \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u0430\u044f \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442\u0430 b'\\x00\\x9e\\x88^\\x0e8\\xe5!Z\\xf3\\x98\\xae\\x1f\\xde\\xe2\\xafu\\xfa,\\xfe\\x8b\\xd4\\xb4\\xb3s6,\\xfa\\xbe\\x18\\x08Q\\x96\\x12\\xad\\xe6\\xf2\\xb2\\x11Wz\\xc7\\xa9\\xb6\\xe9\\xc7=\\xf1\\x8f\\x92Ay\\xc2\\x07\\xd1\\x96yV$\\xf29E\\x1cE\\xe7c\\x86\\x16yb\\xc3\\xc1r!\\x1c\\x12X\\xb7\\x9c\\xb3\\xde&gt;V\\x92\\x0fy\\xc7\\xe9\\x8f\\xbc\\xefE- d\\xfc\\tv\\x19\\xb1\\xf9\\xab\\xa1~\\x85\\x92%.c\\xbar\"\\x12\\x99~\\x13\\xb5\\xc1\\xb5\\xb3\\x0e\\x12\\xc2\\x84\\xc0\\x0e\\xba\\xe1t\\xcd\\x0e%\\xdf\\x9c\\xe4%&lt;\\x8a\\xa0\\x9bs\\xa3\\xf3\\x9d\\x86\\xcbep\\xaf\\xa8\\xf6SY\\xe4\\x9bL\\xb5\\x1cR\\xedS\\x8b\\xee\\xf1\\x1b\\x04\\xfc\\x0c_\\xad#\"\\xc5qO\\xb3\\xc5\\xdd\\x10\\x9f\\x02Hl\\xdb\\xde\\xc2A\\xec\\xd0\\xbb\\x0c9aU??\\xcdwE\\xe2Ux\\xa6_\\xeb\\xa0\\x080Y\\xff\\x8a\\xbc5L\\x07\\xf5!\\xb3\\x08\\xc0\/\\x9ez\\xfe\\x0fR&lt;_k\\xe1J\\xe4lN\\xc4\\x17\/\\x93\\xf7\\xbd\\xff\\x1e\\x94&lt;Ot:\\xcc\\'3m\\x94\\x10\\x9b-l\\xd5' - \u043c\u043e\u0434\u0443\u043b\u044c N (0x101 * 8 = 2048 \u0431\u0438\u0442)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430 (Fingerprint)<\/h4>\n<p>  \u041e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u2014 \u044d\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0445\u044d\u0448 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 SHA256) \u043e\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0438 \u0438\u0437 \/etc\/ssh\/ssh_host_rsa_key.pub, \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 base64 \u0434\u043b\u044f \u0445\u044d\u0448 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 SHA \u0438\u043b\u0438 \u0432 hex \u0434\u043b\u044f MD5.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0447\u0438\u0442\u0430\u0435\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from hashlib import sha256 from base64 import b64decode, b64encode pub_key_bin = b64decode(\"AAAAB3NzaC1yc2EAAAADAQABAAABAQCeiF4OOOUhWvOYrh\/e4q91+iz+i9S0s3M2LPq+GAhRlhKt5vKyEVd6x6m26cc98Y+SQXnCB9GWeVYk8jlFHEXnY4YWeWLDwXIhHBJYt5yz3j5Wkg95x+mPvO9FLSBk\/Al2GbH5q6F+hZIlLmO6ciISmX4TtcG1sw4SwoTADrrhdM0OJd+c5CU8iqCbc6PznYbLZXCvqPZTWeSbTLUcUu1Ti+7xGwT8DF+tIyLFcU+zxd0QnwJIbNvewkHs0LsMOWFVPz\/Nd0XiVXimX+ugCDBZ\/4q8NUwH9SGzCMAvnnr+D1I8X2vhSuRsTsQXL5P3vf8elDxPdDrMJzNtlBCbLWzV\") hash = sha256(pub_key_bin).digest() fingerprint = b64encode(hash) print(fingerprint)  &gt; b'kd9mRkEGLo+RBBNpxKp7mInocF3\/Yl\/0fXRsGJ2JfYg=' <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0445\u044d\u0448 \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043a\u043e\u043c, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 (\u0446\u0438\u0442\u0430\u0442\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438), \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 &#171;=&#187; \u0432 \u043a\u043e\u043d\u0446\u0435.  <\/div>\n<\/div>\n<p>  <a href=\"https:\/\/github.com\/Nokta-strigo\/known_hosts_parser\">\u0422\u0443\u0442<\/a> \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 known_hosts, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432.<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/421477\/\"> https:\/\/habr.com\/post\/421477\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/421477\/\" class=\"post__text post__text-html js-mediator-article\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t3\/or\/pw\/t3orpw03cujdqdjjajfr8vou66i.jpeg\"><\/div>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 ssh \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, ssh \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0430\u043a \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 ssh). \u0412 OpenSSH \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 known_hosts. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438 \u043a\u0430\u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0442\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288656","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288656","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=288656"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288656\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}