Upgrade to Pro — share decks privately, control downloads, hide ads and more …

introducing-vault-half-assed

 introducing-vault-half-assed

2015-05-14 の社内勉強会 (hbstyle) で Hashicorp の Vault についてめちゃくちゃ適当に喋ったやつです

rrreeeyyy

May 14, 2015
Tweet

More Decks by rrreeeyyy

Other Decks in Technology

Transcript

  1. ओʹ؅ཧͰ͖Δ৘ใ • ී௨ͷػີ৘ใͷ؅ཧ • Password/Token.౳ͷ.Plane.Text.Λ҉߸Խͯ͠อଘͰ͖Δ • AWS/Database/Consul.౳ͷೝূ৘ใͷ؅ཧ • IAM.User/MySQL.User/PostgreSQL.User.... •

    ಛఆͷݖݶͷΈΛ࣋ͬͨϢʔβΛ࡞੒Ͱ͖Δ • ಛఆͷظؒͷΈ࢖༻Ͱ͖ΔϢʔβΛ࡞੒Ͱ͖Δ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 3
  2. ػີ৘ใͷಡΈग़͠ • ໊લۭؒΛϕʔεʹͨ͠"Token"base"ACL • secret/foo"΁ͷΞΫηεΛڐՄ͢Δ • secret/bar"΁ͷΞΫηε͸ڐՄ͠ͳ͍ • Github/LDAP"౳ͱ࿈ܞͨ͠"Token"ൃߦ •

    Github"Ͱಛఆͷ૊৫ʹॴଐ͍ͯ͠Ε͹"Token"ൃߦͳͲ • ػີ৘ใʹର͢Δ؂ࠪϩάͷൃߦ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 4
  3. Πϯετʔϧ • Go$ͳͷͰҎԼͷΑ͏ͳྫʹै͑͹$OK curl -L -O \ "https://dl.bintray.com/mitchellh/vault/vault_0.1.2_darwin_amd64.zip" unzip vault_0.1.2_darwin_amd64.zip

    mv vault /usr/bin vault -version # Vault v0.1.2 • ͱΓ͋͑ͣࢼ͢ʹ͸"vault server -dev"ͱ͢Ε͹ىಈ͢Δ • (ຊ൪αʔόͰ͸࢖Θͳ͍͜ͱ) hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 5
  4. ઃఆϑΝΠϧ • h#ps:/ /www.vaultproject.io/docs/config/index.html // ௨ৗͷػີ৘ใͷอଘઌ "file", "consul", "inmem", "zookeeper"

    ͕બ΂Δ backend "file" { // file Λࢦఆͨ͠৔߹͜ͷσΟϨΫτϦʹ௨ৗͷػີ৘ใ͕҉߸Խ͞Εͯอଘ͞ΕΔ path = "/etc/vault/data" } // Listen ͢Δϓϩτίϧ/ΞυϨε/ϙʔτ listener "tcp" { address = "127.0.0.1:8200" tls_disable = 1 } • vault server -config=vault.conf"Ͱ"vault"Λىಈ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 6
  5. ॳظηοτΞοϓ • vault init"ͰηοτΞοϓ • ͜ͷࡍɺػີ৘ใͷ෮߸ʹඞཁͳ伴͕ग़ྗ͞ΕΔ • σϑΥϧτͰ"Key"1ʙ5"͕ग़ྗ͞ΕΔ • ෮߸ʹ͸ͲΕ͔"3"ͭͷ"Key"͕͋Ε͹ྑ͍

    • ͦΕͧΕͷ伴͸όϥόϥͷ৔ॴʹอଘ͓ͯ͘͠ͱྑ͍ • root"ͷ"token"΋ग़ྗ͞ΕΔͷͰͦΕ΋ϝϞ͓ͯ͘͠ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 7
  6. ػີ৘ใͷ؅ཧ!(Plane!Text) • ઌड़ͷ௨Γɺ஋ΛಡΈॻ͖͢ΔͨΊʹ͸"unseal"͕ඞཁ • vault unseal"ͰඞཁྔͷΩʔΛೖྗ͍ͯ͘͠ • ඞཁྔೖΕΔͱ"Sealed: false"ʹͳΔ •

    vault write secret/foo bar=buz"Ͱ஋Λॻ͖ࠐΊΔ • vault read secret/foo"Ͱ֬ೝ • ஋͸͍ͭ͘Ͱ΋ॻ͖ࠐΊΔ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 10
  7. ػີ৘ใͷ؅ཧ!(༷ʑͳೝূ৘ใ) • AWS%IAM%User%΍%MySQL%౳ͷϢʔβΛ࡞੒Ͱ͖Δ • vault mount aws%ͱ͢Δͱ%AWS%༻ͷ໊લۭ͕ؒग़དྷΔ • vault mounts%Ͱ֬ೝग़དྷΔ

    • ࠷ॳʹ%vault write aws/config/root%ͰઃఆΛߦ͏ • access_key%ͱ%secret_key%(IAM%؅ཧ༻) hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 11
  8. ػີ৘ใͷ؅ཧ!(༷ʑͳೝূ৘ใ) • IAM%ϙϦγʔΛఆٛͨ͠ઃఆϑΝΠϧΛ༻ҙ͠஋Λॻ͖ࠐΉ • vault write aws/roles/deploy \ [email protected]

    ఆٛͨ͠ϙϦγʔʹରԠͨ͠%IAM%User%͕࡞੒͞ΕΔ • ಛఆͷ͕࣌ؒܦա͢Δͱ%expire%͢Δ౳ͷઃఆ΋Ͱ͖Δ hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 12
  9. ࢀߟจݙ • h#ps:/ /www.vaultproject.io/ • h#ps:/ /www.vaultproject.io/docs/index.html • h#p:/ /pocketstudio.jp/log3/2015/04/29/vault/

    • h#p:/ /pocketstudio.jp/log3/2015/04/30/introducBontovault/ • h#p:/ /pocketstudio.jp/log3/2015/05/01/vaultCgeDngCstarted/ • h#p:/ /kiririmode.hatenablog.jp/entry/20150429/1430279218 hbstyle((2015/05/14)(1(Yoshikawa(Ryota(((@rrreeeyyy() 14