{"id":364748,"date":"2024-05-21T02:23:35","date_gmt":"2024-05-21T02:23:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364748"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364748","title":{"rendered":"<span>\u041e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e ssh \u0447\u0435\u0440\u0435\u0437 HashiCorp Vault<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>HashiCorp Vault \u0438\u043c\u0435\u0435\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u0435 SSH secrets engine, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u0430\u0448\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u043f\u043e ssh, \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0438 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u041f\u0440\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 (OTP) \u2013 \u043c\u044b \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? <\/h3>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0c9\/b51\/4f4\/0c9b514f4c26f9c382b37e979c29dc41.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b\" width=\"964\" height=\"412\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c9\/b51\/4f4\/0c9b514f4c26f9c382b37e979c29dc41.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 OTP \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0445\u043e\u0441\u0442\u0430, \u0434\u0430\u043b\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u043c <code>ssh username@host<\/code> \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 vault, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f cli, API \u0438\u043b\u0438 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0430\u0448\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0430\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0451\u0440\u0433\u0430\u0442\u044c vault API \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c OTP.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 SSH-\u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 PAM (Pluggable Authentication Modules) \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u042d\u0442\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/github.com\/hashicorp\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">vault-ssh-helper<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u0432 \u0432\u0430\u0448 Vault-\u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043e\u043a, \u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u0442\u043e\u043a\u0435\u043d \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u044d\u0442\u0430\u043f\u043e\u0432: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Vault \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c host&#8217;\u0435.<\/p>\n<blockquote>\n<p>\u041a\u0430\u043a \u0432\u0441\u0451 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u00a0<a href=\"https:\/\/developer.hashicorp.com\/vault\/tutorials\/secrets-management\/ssh-otp\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0442 HashiCorp<\/a>. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0438\u0436\u0435 \u044d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0435\u0451 \u043f\u0435\u0440\u0435\u0432\u043e\u0434. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043a \u043d\u044e\u0430\u043d\u0441\u0430\u043c.<\/p>\n<\/blockquote>\n<h3>\u041c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 Vault&#8217;\u0430<\/h3>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c SSH secrets engine.<\/p>\n<pre><code class=\"bash\">vault secrets enable ssh<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 OTP \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432\u00a0<code>cidr_list<\/code>\u00a0\u0437\u0430\u0434\u0430\u0451\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0438.<\/p>\n<blockquote>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/blockquote>\n<pre><code class=\"bash\">vault write ssh\/roles\/otp_role \\     key_type=otp \\     default_user=worker \\     allowed_users=worker, worker2 \\     cidr_list=10.10.10.10\/32<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c policy \u043a \u043d\u0430\u0448\u0435\u0439 \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c access-token, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u044d\u0442\u043e\u0439 policy.<\/p>\n<pre><code class=\"bash\">tee test.hcl &lt;&lt;EOF path \"ssh\/creds\/otp_role\" {   capabilities = [\"update\"] } EOF<\/code><\/pre>\n<pre><code class=\"bash\">vault policy write otp-polcy .\/test.hcl<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c token \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u0443 vault \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f.<\/p>\n<pre><code class=\"bash\">vault token create -policy=otp-polcy  Key                  Value ---                  ----- token                hvs.CAESIG1_CrngaECzf6yvTDBgUZz2Lt-mYfdZXogrsiV0ulH1Gh4KHGh2cy4bPmFmN24xNVM5cnBqbFNLTUdpd1JDcTM token_accessor       n76E8Bc8P9SyPLpVZa2EoWGq token_duration       768h token_renewable      true token_policies       [\"default\" \"otp-polcy\"] identity_policies    [] policies             [\"default\" \"otp-polcy\"]<\/code><\/pre>\n<h3>\u041c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0443\u0436\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/h3>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e vaul-ssh-helper \u0441\u00a0<a href=\"https:\/\/releases.hashicorp.com\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438<\/a>, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u00a0<a href=\"https:\/\/github.com\/hashicorp\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<pre><code class=\"bash\">wget https:\/\/releases.hashicorp.com\/vault-ssh-helper\/0.2.1\/vault-ssh-helper_0.2.1_linux_amd64.zip<\/code><\/pre>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e\u00a0<code>\/usr\/local\/bin<\/code>.<\/p>\n<pre><code class=\"bash\">unzip -q vault-ssh-helper_0.2.1_linux_amd64.zip -d \/usr\/local\/bin<\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c root&#8217;\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 0755 (rwxr-xr-x).<\/p>\n<pre><code class=\"bash\">sudo chown root:root \/usr\/local\/bin\/vault-ssh-helper<\/code><\/pre>\n<pre><code class=\"bash\">sudo chmod 0755 \/usr\/local\/bin\/vault-ssh-helper<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 vault-ssh-helper \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438\u00a0<code>\/etc\/vault-ssh-helper.d<\/code>.<\/p>\n<pre><code class=\"bash\">sudo mkdir \/etc\/vault-ssh-helper.d<\/code><\/pre>\n<pre><code class=\"bash\">sudo tee \/etc\/vault-ssh-helper.d\/config.hcl &lt;&lt;EOF vault_addr = \"VAULT_ADDR\" tls_skip_verify = false ca_path = \"CA_CRT_PATH\" ssh_mount_point = \"ssh\" allowed_roles = \"*\" EOF<\/code><\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f PAM sshd (<code>\/etc\/pam.d\/sshd<\/code>).<\/p>\n<pre><code class=\"bash\"># \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044d\u043a\u0430\u043f\u0438\u043c \u0435\u0451 sudo cp \/etc\/pam.d\/sshd \/etc\/pam.d\/sshd.orig<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <code>include common-auth<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0435: \u0432 \u043d\u0438\u0445 \u0434\u043b\u044f vault-ssh-helper \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 helper&#8217;\u0430 \u0438 \u0444\u0430\u0439\u043b, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043b\u043e\u0433\u0438.<\/p>\n<pre><code>auth requisite pam_exec.so quiet expose_authtok log=\/var\/log\/vault-ssh.log \/usr\/local\/bin\/vault-ssh-helper -config=\/etc\/vault-ssh-helper.d\/config.hcl auth optional pam_unix.so not_set_pass use_first_pass nodelay<\/code><\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e sshd (<code>\/etc\/ssh\/sshd_config<\/code>).<\/p>\n<pre><code class=\"bash\"># \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044d\u043a\u0430\u043f\u0438\u043c \u0435\u0451 sudo cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.orig<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 (\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0444\u0430\u0439\u043b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b).<\/p>\n<pre><code>KbdInteractiveAuthentication yes UsePAM yes PasswordAuthentication no<\/code><\/pre>\n<blockquote>\n<p>\u0421\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Ubuntu \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u00a0<code>ChallengeResponseAuthentication<\/code>\u00a0\u0432\u043c\u0435\u0441\u0442\u043e\u00a0<code>KbdInteractiveAuthentication<\/code>.<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e ssh \u043a\u043b\u044e\u0447\u0443 \u0443 root&#8217;\u0430.<\/p>\n<\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c sshd.<\/p>\n<pre><code class=\"bash\">sudo systemctl restart sshd<\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h3>\n<p>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u0432 vault \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435.<\/p>\n<pre><code class=\"bash\">vault login $TOKEN<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c OTP \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e ip-\u0430\u0434\u0440\u0435\u0441\u0430 (\u044e\u0437\u0435\u0440\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439).<\/p>\n<pre><code class=\"bash\">vault write ssh\/creds\/otp_key_role ip=$IP_ADDRESS  Key                Value ---                ----- lease_id           ssh\/creds\/otp_key_role\/yZaiE4bRiVUVvc6LetQDtDmS lease_duration     768h lease_renewable    false ip                 10.10.10.10 key                edcf6837-902f-43c6-9e54-c8c26ab80ff3 key_type           otp port               22 username           username<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u0451\u043c.<\/p>\n<pre><code class=\"bash\">ssh username@10.10.10.10<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u044e\u0430\u043d\u0441\u044b<\/h3>\n<blockquote>\n<p><strong>\u0427\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b<\/strong><\/p>\n<p><strong>\u0420\u043e\u043b\u044c \u0432 ssh secret engine<\/strong> \u2013 \u044d\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 SSH-\u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 OTP \u043e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0441\u043f\u0438\u0441\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445 ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f OTP \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e.<\/p>\n<p><strong>Lease \u0432 Vault<\/strong>\u00a0\u2013 \u044d\u0442\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434., \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u043c \u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u043c.<\/p>\n<\/blockquote>\n<h4>#1 \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0439<\/h4>\n<p>\u0418\u043c\u0435\u044f \u0442\u043e\u043a\u0435\u043d \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u043d\u0443\u0436\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 ssh engine, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0432\u0441\u0435\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0440\u043e\u043b\u0438. \u0418 \u0436\u0438\u0432\u0443\u0442 \u043e\u043d\u0438 \u043e\u043a\u043e\u043b\u043e \u043c\u0435\u0441\u044f\u0446\u0430. <strong>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0440\u043e\u043b\u0438 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/strong>.<\/p>\n<h4>#2 \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u0438<\/h4>\n<p>\u041f\u043e\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0435\u043d lease \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0433\u043e \u0432\u044b\u0434\u0430\u043b\u0438, \u0438\u043b\u0438 \u043d\u0435\u0442 \u2013 \u043a\u043b\u044e\u0447 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c.<\/p>\n<h4>#3 \u0423\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e<\/h4>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0430\u043d\u043e \u043d\u0430 \u0440\u043e\u043b\u044c \u043a\u043b\u044e\u0447\u0435\u0439, \u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438 lease&#8217;\u043e\u0432, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a \u043a\u043b\u044e\u0447\u0430\u043c.<\/p>\n<pre><code class=\"bash\">curl -s -X LIST -H \"X-Vault-Token: ${VAULT_TOKEN}\" ${VAULT_ADDR}\/v1\/sys\/leases\/lookup\/ssh\/creds\/$ROLE_NAME<\/code><\/pre>\n<p>\u041d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 lease \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0430 \u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0442, \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435.<\/p>\n<h4>#4 \u0418\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043e\u0437\u0432\u0430\u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u043d\u0435\u043c\u0443 lease<\/h4>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u044e\u0447\u0438 \u0436\u0438\u0432\u0443\u0442 \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0445 \u0443\u0431\u0438\u0442\u044c, \u044d\u0442\u043e \u043e\u0442\u043e\u0437\u0432\u0430\u0442\u044c lease.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u043e:<\/p>\n<pre><code class=\"bash\">vault lease revoke ssh\/creds\/otp-role\/lease-id<\/code><\/pre>\n<p>\u0410 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0440\u0443\u0431\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 lease&#8217;\u044b \u0432\u0441\u0435\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0440\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">vault lease revoke -prefix ssh\/creds\/otp-role<\/code><\/pre>\n<h4>#5 \u041f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u043b\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f access-token&#8217;\u043e\u0432 \u0432 HashiCorp Vault \u043d\u0435 \u0432\u0435\u0434\u0443\u0442\u0441\u044f<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 access-token&#8217;\u044b, \u043a\u043e\u0433\u0434\u0430 \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043b\u043e\u0433\u043e\u0432 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a API.<\/p>\n<pre><code class=\"bash\">vault audit enable file file_path=\u041f\u0423\u0422\u042c_\u0414\u041e_\u0424\u0410\u0419\u041b\u0410_\u041a\u0423\u0414\u0410_\u0411\u0423\u0414\u0423\u0422_\u0421\u041e\u0425\u0420\u0410\u041d\u042f\u0422\u042c\u0421\u042f_\u041b\u041e\u0413\u0418<\/code><\/pre>\n<blockquote>\n<p>\u0424\u0430\u0439\u043b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0436\u0438\u0440\u043d\u044b\u043c.<\/p>\n<\/blockquote>\n<p>\u0412\u0441\u0435 token&#8217;\u044b \u0438 \u0438\u0445 accessor&#8217;\u044b \u0432 \u043b\u043e\u0433\u0430\u0445 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u044b. \u0427\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u043c token&#8217;\u0430, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0442\u0443 \u0436\u0435 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 audit. \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0445\u0435\u0448\u0443 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0435.<\/p>\n<pre><code class=\"bash\">vault write sys\/audit-hash\/file input=\"&lt;TOKEN ACCESSOR>\"<\/code><\/pre>\n<h3>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 OTP<\/h3>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Vault API \u0438 \u0433\u0438\u0431\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 ACL. \u041f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 token \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 policy, \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0430\u043c \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 OTP \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 Ansible<\/h4>\n<p>\u0421\u0430\u043c\u044b\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2013 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c Ansible Playbook, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439 OTP \u0443 vault \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u043e\u0434\u0443\u043b\u0435\u043c\u00a0<code>community.hashi_vault.vault_write<\/code>.<\/p>\n<pre><code class=\"yaml\">- name: Play   hosts: localhost   gather_facts: false   tasks:     - name: Get OTP       community.hashi_vault.vault_write:         auth_method: token         url: https:\/\/vault.service         token: YOUR_TOKEN         path: ssh\/creds\/otp_role         data:           ip: HOST_IP       register: ssh     - name: Setting ssh vars       ansible.builtin.set_fact:         hashi_host_ip: '{{ ssh.data.data.ip }}'         hashi_host_username: '{{ ssh.data.data.username }}'         hashi_host_port: '{{ ssh.data.data.port }}'         hashi_host_key: '{{ ssh.data.data.key }}'     - name: DBG       ansible.builtin.debug:         msg:           - 'ip: {{ hashi_host_ip }}'           - 'port: {{ hashi_host_port }}'           - 'username: {{ hashi_host_username }}'           - 'password: {{ hashi_host_key }}'<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c API \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h4>\n<pre><code class=\"bash\">curl --location 'https:\/\/vault.service\/v1\/ssh\/creds\/otp_role' \\ --header 'X-Vault-Token: TOKEN' \\ --header 'Content-Type: application\/json' \\ --data '{     \"ip\": \"10.10.10.10\" }' | jq '.data'<\/code><\/pre>\n<hr\/>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435! \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/785052\/\"> https:\/\/habr.com\/ru\/articles\/785052\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>HashiCorp Vault \u0438\u043c\u0435\u0435\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u0435 SSH secrets engine, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u0430\u0448\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u043f\u043e ssh, \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0438 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u041f\u0440\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 (OTP) \u2013 \u043c\u044b \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? <\/h3>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 OTP \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0445\u043e\u0441\u0442\u0430, \u0434\u0430\u043b\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u043c <code>ssh username@host<\/code> \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 vault, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f cli, API \u0438\u043b\u0438 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u0430\u0448\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0430\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u0451\u0440\u0433\u0430\u0442\u044c vault API \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c OTP.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 SSH-\u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 PAM (Pluggable Authentication Modules) \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u042d\u0442\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/github.com\/hashicorp\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">vault-ssh-helper<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u0432 \u0432\u0430\u0448 Vault-\u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043e\u043a, \u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u0442\u043e\u043a\u0435\u043d \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<details class=\"spoiler\">\n<summary>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u044d\u0442\u0430\u043f\u043e\u0432: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Vault \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c host&#8217;\u0435.<\/p>\n<blockquote>\n<p>\u041a\u0430\u043a \u0432\u0441\u0451 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u00a0<a href=\"https:\/\/developer.hashicorp.com\/vault\/tutorials\/secrets-management\/ssh-otp\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0442 HashiCorp<\/a>. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0438\u0436\u0435 \u044d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0435\u0451 \u043f\u0435\u0440\u0435\u0432\u043e\u0434. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043a \u043d\u044e\u0430\u043d\u0441\u0430\u043c.<\/p>\n<\/blockquote>\n<h3>\u041c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 Vault&#8217;\u0430<\/h3>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c SSH secrets engine.<\/p>\n<pre><code class=\"bash\">vault secrets enable ssh<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 OTP \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432\u00a0<code>cidr_list<\/code>\u00a0\u0437\u0430\u0434\u0430\u0451\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0438.<\/p>\n<blockquote>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/blockquote>\n<pre><code class=\"bash\">vault write ssh\/roles\/otp_role \\     key_type=otp \\     default_user=worker \\     allowed_users=worker, worker2 \\     cidr_list=10.10.10.10\/32<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c policy \u043a \u043d\u0430\u0448\u0435\u0439 \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c access-token, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u044d\u0442\u043e\u0439 policy.<\/p>\n<pre><code class=\"bash\">tee test.hcl &lt;&lt;EOF path \"ssh\/creds\/otp_role\" {   capabilities = [\"update\"] } EOF<\/code><\/pre>\n<pre><code class=\"bash\">vault policy write otp-polcy .\/test.hcl<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c token \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u0443 vault \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f.<\/p>\n<pre><code class=\"bash\">vault token create -policy=otp-polcy  Key                  Value ---                  ----- token                hvs.CAESIG1_CrngaECzf6yvTDBgUZz2Lt-mYfdZXogrsiV0ulH1Gh4KHGh2cy4bPmFmN24xNVM5cnBqbFNLTUdpd1JDcTM token_accessor       n76E8Bc8P9SyPLpVZa2EoWGq token_duration       768h token_renewable      true token_policies       [\"default\" \"otp-polcy\"] identity_policies    [] policies             [\"default\" \"otp-polcy\"]<\/code><\/pre>\n<h3>\u041c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0443\u0436\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/h3>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e vaul-ssh-helper \u0441\u00a0<a href=\"https:\/\/releases.hashicorp.com\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438<\/a>, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u00a0<a href=\"https:\/\/github.com\/hashicorp\/vault-ssh-helper\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<pre><code class=\"bash\">wget https:\/\/releases.hashicorp.com\/vault-ssh-helper\/0.2.1\/vault-ssh-helper_0.2.1_linux_amd64.zip<\/code><\/pre>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e\u00a0<code>\/usr\/local\/bin<\/code>.<\/p>\n<pre><code class=\"bash\">unzip -q vault-ssh-helper_0.2.1_linux_amd64.zip -d \/usr\/local\/bin<\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c root&#8217;\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 0755 (rwxr-xr-x).<\/p>\n<pre><code class=\"bash\">sudo chown root:root \/usr\/local\/bin\/vault-ssh-helper<\/code><\/pre>\n<pre><code class=\"bash\">sudo chmod 0755 \/usr\/local\/bin\/vault-ssh-helper<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 vault-ssh-helper \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438\u00a0<code>\/etc\/vault-ssh-helper.d<\/code>.<\/p>\n<pre><code class=\"bash\">sudo mkdir \/etc\/vault-ssh-helper.d<\/code><\/pre>\n<pre><code class=\"bash\">sudo tee \/etc\/vault-ssh-helper.d\/config.hcl &lt;&lt;EOF vault_addr = \"VAULT_ADDR\" tls_skip_verify = false ca_path = \"CA_CRT_PATH\" ssh_mount_point = \"ssh\" allowed_roles = \"*\" EOF<\/code><\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f PAM sshd (<code>\/etc\/pam.d\/sshd<\/code>).<\/p>\n<pre><code class=\"bash\"># \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044d\u043a\u0430\u043f\u0438\u043c \u0435\u0451 sudo cp \/etc\/pam.d\/sshd \/etc\/pam.d\/sshd.orig<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <code>include common-auth<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0435: \u0432 \u043d\u0438\u0445 \u0434\u043b\u044f vault-ssh-helper \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 helper&#8217;\u0430 \u0438 \u0444\u0430\u0439\u043b, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043b\u043e\u0433\u0438.<\/p>\n<pre><code>auth requisite pam_exec.so quiet expose_authtok log=\/var\/log\/vault-ssh.log \/usr\/local\/bin\/vault-ssh-helper -config=\/etc\/vault-ssh-helper.d\/config.hcl auth optional pam_unix.so not_set_pass use_first_pass nodelay<\/code><\/pre>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e sshd (<code>\/etc\/ssh\/sshd_config<\/code>).<\/p>\n<pre><code class=\"bash\"># \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0431\u044d\u043a\u0430\u043f\u0438\u043c \u0435\u0451 sudo cp \/etc\/ssh\/sshd_config \/etc\/ssh\/sshd_config.orig<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 (\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0444\u0430\u0439\u043b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b).<\/p>\n<pre><code>KbdInteractiveAuthentication yes UsePAM yes PasswordAuthentication no<\/code><\/pre>\n<blockquote>\n<p>\u0421\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Ubuntu \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u00a0<code>ChallengeResponseAuthentication<\/code>\u00a0\u0432\u043c\u0435\u0441\u0442\u043e\u00a0<code>KbdInteractiveAuthentication<\/code>.<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e ssh \u043a\u043b\u044e\u0447\u0443 \u0443 root&#8217;\u0430.<\/p>\n<\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c sshd.<\/p>\n<pre><code class=\"bash\">sudo systemctl restart sshd<\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h3>\n<p>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u0432 vault \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435.<\/p>\n<pre><code class=\"bash\">vault login $TOKEN<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c OTP \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e ip-\u0430\u0434\u0440\u0435\u0441\u0430 (\u044e\u0437\u0435\u0440\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439).<\/p>\n<pre><code class=\"bash\">vault write ssh\/creds\/otp_key_role ip=$IP_ADDRESS  Key                Value ---                ----- lease_id           ssh\/creds\/otp_key_role\/yZaiE4bRiVUVvc6LetQDtDmS lease_duration     768h lease_renewable    false ip                 10.10.10.10 key                edcf6837-902f-43c6-9e54-c8c26ab80ff3 key_type           otp port               22 username           username<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u0451\u043c.<\/p>\n<pre><code class=\"bash\">ssh username@10.10.10.10<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041d\u044e\u0430\u043d\u0441\u044b<\/h3>\n<blockquote>\n<p><strong>\u0427\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b<\/strong><\/p>\n<p><strong>\u0420\u043e\u043b\u044c \u0432 ssh secret engine<\/strong> \u2013 \u044d\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 SSH-\u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 OTP \u043e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0441\u043f\u0438\u0441\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445 ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f OTP \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e.<\/p>\n<p><strong>Lease \u0432 Vault<\/strong>\u00a0\u2013 \u044d\u0442\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434., \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u043c \u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u043c.<\/p>\n<\/blockquote>\n<h4>#1 \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0439<\/h4>\n<p>\u0418\u043c\u0435\u044f \u0442\u043e\u043a\u0435\u043d \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u043d\u0443\u0436\u043d\u043e\u0439 \u0440\u043e\u043b\u0438 ssh engine, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0432\u0441\u0435\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0440\u043e\u043b\u0438. \u0418 \u0436\u0438\u0432\u0443\u0442 \u043e\u043d\u0438 \u043e\u043a\u043e\u043b\u043e \u043c\u0435\u0441\u044f\u0446\u0430. <strong>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0440\u043e\u043b\u0438 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/strong>.<\/p>\n<h4>#2 \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u0438<\/h4>\n<p>\u041f\u043e\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0435\u043d lease \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0433\u043e \u0432\u044b\u0434\u0430\u043b\u0438, \u0438\u043b\u0438 \u043d\u0435\u0442 \u2013 \u043a\u043b\u044e\u0447 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c.<\/p>\n<h4>#3 \u0423\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e<\/h4>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0434\u0430\u043d\u043e \u043d\u0430 \u0440\u043e\u043b\u044c \u043a\u043b\u044e\u0447\u0435\u0439, \u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438 lease&#8217;\u043e\u0432, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a \u043a\u043b\u044e\u0447\u0430\u043c.<\/p>\n<pre><code class=\"bash\">curl -s -X LIST -H \"X-Vault-Token: ${VAULT_TOKEN}\" ${VAULT_ADDR}\/v1\/sys\/leases\/lookup\/ssh\/creds\/$ROLE_NAME<\/code><\/pre>\n<p>\u041d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 lease \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0430 \u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0442, \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435.<\/p>\n<h4>#4 \u0418\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043e\u0437\u0432\u0430\u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u043d\u0435\u043c\u0443 lease<\/h4>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u044e\u0447\u0438 \u0436\u0438\u0432\u0443\u0442 \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u0438, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0445 \u0443\u0431\u0438\u0442\u044c, \u044d\u0442\u043e \u043e\u0442\u043e\u0437\u0432\u0430\u0442\u044c lease.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u043e:<\/p>\n<pre><code class=\"bash\">vault lease revoke ssh\/creds\/otp-role\/lease-id<\/code><\/pre>\n<p>\u0410 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0440\u0443\u0431\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 lease&#8217;\u044b \u0432\u0441\u0435\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0440\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">vault lease revoke -prefix ssh\/creds\/otp-role<\/code><\/pre>\n<h4>#5 \u041f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u043b\u043e\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f access-token&#8217;\u043e\u0432 \u0432 HashiCorp Vault \u043d\u0435 \u0432\u0435\u0434\u0443\u0442\u0441\u044f<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 access-token&#8217;\u044b, \u043a\u043e\u0433\u0434\u0430 \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043b\u043e\u0433\u043e\u0432 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a API.<\/p>\n<pre><code class=\"bash\">vault audit enable file file_path=\u041f\u0423\u0422\u042c_\u0414\u041e_\u0424\u0410\u0419\u041b\u0410_\u041a\u0423\u0414\u0410_\u0411\u0423\u0414\u0423\u0422_\u0421\u041e\u0425\u0420\u0410\u041d\u042f\u0422\u042c\u0421\u042f_\u041b\u041e\u0413\u0418<\/code><\/pre>\n<blockquote>\n<p>\u0424\u0430\u0439\u043b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0436\u0438\u0440\u043d\u044b\u043c.<\/p>\n<\/blockquote>\n<p>\u0412\u0441\u0435 token&#8217;\u044b \u0438 \u0438\u0445 accessor&#8217;\u044b \u0432 \u043b\u043e\u0433\u0430\u0445 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u044b. \u0427\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u043c token&#8217;\u0430, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0442\u0443 \u0436\u0435 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 audit. \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0445\u0435\u0448\u0443 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0435.<\/p>\n<pre><code class=\"bash\">vault write sys\/audit-hash\/file input=\"&lt;TOKEN ACCESSOR>\"<\/code><\/pre>\n<h3>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 OTP<\/h3>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Vault API \u0438 \u0433\u0438\u0431\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 ACL. \u041f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 token \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 policy, \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0430\u043c \u0440\u043e\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 OTP \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 Ansible<\/h4>\n<p>\u0421\u0430\u043c\u044b\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2013 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c Ansible Playbook, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439 OTP \u0443 vault \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u043e\u0434\u0443\u043b\u0435\u043c\u00a0<code>community.hashi_vault.vault_write<\/code>.<\/p>\n<pre><code class=\"yaml\">- name: Play   hosts: localhost   gather_facts: false   tasks:     - name: Get OTP       community.hashi_vault.vault_write:         auth_method: token         url: https:\/\/vault.service         token: YOUR_TOKEN         path: ssh\/creds\/otp_role         data:           ip: HOST_IP       register: ssh     - name: Setting ssh vars       ansible.builtin.set_fact:         hashi_host_ip: '{{ ssh.data.data.ip }}'         hashi_host_username: '{{ ssh.data.data.username }}'         hashi_host_port: '{{ ssh.data.data.port }}'         hashi_host_key: '{{ ssh.data.data.key }}'     - name: DBG       ansible.builtin.debug:         msg:           - 'ip: {{ hashi_host_ip }}'           - 'port: {{ hashi_host_port }}'           - 'username: {{ hashi_host_username }}'           - 'password: {{ hashi_host_key }}'<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c API \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h4>\n<pre><code class=\"bash\">curl --location 'https:\/\/vault.service\/v1\/ssh\/creds\/otp_role' \\ --header 'X-Vault-Token: TOKEN' \\ --header 'Content-Type: application\/json' \\ --data '{     \"ip\": \"10.10.10.10\" }' | jq '.data'<\/code><\/pre>\n<hr\/>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435! \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/785052\/\"> https:\/\/habr.com\/ru\/articles\/785052\/<\/a><br \/><\/br><\/br><\/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-364748","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364748","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=364748"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364748\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}