text: (window.webpackJsonp=window.webpackJsonp||[]).push([[105],{713:function(s,a,t){"use strict";t.r(a);var n=t(5),e=Object(n.a)({},(function(){var s=this,a=s.$createElement,t=s._self._c||a;return t("ContentSlotsDistributor",{attrs:{"slot-key":s.$parent.slotKey}},[t("h1",{attrs:{id:"kmip-mongodb"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#kmip-mongodb"}},[s._v("#")]),s._v(" KMIP - MongoDB")]),s._v(" "),t("blockquote",[t("p",[s._v("Enterprise 기능")])]),s._v(" "),t("h2",{attrs:{id:"vault-dev-mode-run-option"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#vault-dev-mode-run-option"}},[s._v("#")]),s._v(" Vault - dev mode run (Option)")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("VAULT_UI")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("true vault server -dev-root-token-id"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("root -dev -log-level"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("trace\n\n"),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("export")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("VAULT_ADDR")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"http://127.0.0.1:8200"')]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("echo")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"export VAULT_ADDR='),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$VAULT_ADDR")]),s._v('"')]),s._v(" "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">>")]),s._v(" /root/.bashrc\nvault status\nvault login root\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br")])]),t("h2",{attrs:{id:"kmip-구성"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#kmip-구성"}},[s._v("#")]),s._v(" KMIP 구성")]),s._v(" "),t("p",[s._v("KMIP 활성화")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ vault secrets "),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("enable")]),s._v(" kmip\n\nSuccess"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),s._v(" Enabled the kmip secrets engine at: kmip/\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br")])]),t("p",[s._v("KMIP Listner 구성 (5696은 표준 기본 포트 입니다.)")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ vault "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("write")]),s._v(" kmip/config "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("listen_addrs")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("0.0")]),s._v(".0.0:5696 "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("tls_ca_key_type")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"rsa"')]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("tls_ca_key_bits")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("2048")]),s._v("\n  \nSuccess"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),s._v(" Data written to: kmip/config\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br")])]),t("p",[s._v("MongoDB에 전달할 KMIP CA 인증서를 저장")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ vault "),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("read")]),s._v(" -format json kmip/ca "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v(" jq -r .data.ca_pem "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" ca.pem\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br")])]),t("p",[s._v('샘플로 "HashiCup" 앱의 관리 개체에 대한 범위를 생성')]),s._v(" "),t("ul",[t("li",[s._v('범위는 KMIP 관리 객체를 여러 명명된 버킷으로 분할합니다. (여기서는 "HashiCup")')]),s._v(" "),t("li",[s._v('버킷 하위의 Role(역할)은 버킷 내에서 관리되며 다양한 허용 KMIP 작업을 할당할 수 있습니다. 여기서는 MongoDB가 수행할 수 있는 허용된 KMIP 작업을 지정하는 "payment" 역할도 생성합니다.')])]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ vault "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("write")]),s._v(" -f kmip/scope/hashicups\nSuccess"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),s._v(" Data written to: kmip/scope/hashicups\n\n$ vault "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("write")]),s._v(" kmip/scope/hashicups/role/payments "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("operation_all")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("true\nSuccess"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("!")]),s._v(" Data written to: kmip/scope/hashicups/role/payments\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br")])]),t("p",[s._v("리프 인증서와 개인 키 생성")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ vault "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("write")]),s._v(" -format"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("json "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  kmip/scope/hashicups/role/payments/credential/generate "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token assign-left variable"}},[s._v("format")]),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("=")]),s._v("pem "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" credential.json\n$ jq -r .data.certificate "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("<")]),s._v(" credential.json "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" cert.pem\n$ jq -r .data.private_key "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("<")]),s._v(" credential.json "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" key.pem\n$ "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("cat")]),s._v(" cert.pem key.pem "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" client.pem\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br")])]),t("h2",{attrs:{id:"mongodb-구성"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#mongodb-구성"}},[s._v("#")]),s._v(" MongoDB 구성")]),s._v(" "),t("p",[s._v("KMIP을 사용하기 위한 옵션과 함께 mongoDB를 시작")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ mongod --dbpath /var/lib/mongodb "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --logpath /var/log/mongodb/mongo.log "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --enableEncryption "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --kmipServerName localhost "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --kmipPort "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("5696")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --kmipServerCAFile ca.pem "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("\n  --kmipClientCertificateFile client.pem\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br")])]),t("p",[s._v("KMIP 적용 확인")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("cat")]),s._v(" /var/log/mongodb/mongo.log  "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("grep")]),s._v(" KMIP "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v(" jq\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"t"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n    "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"'),t("span",{pre:!0,attrs:{class:"token variable"}},[s._v("$date")]),s._v('"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"2021-07-20T02:03:34.031+00:00"')]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"s"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"I"')]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"c"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"STORAGE"')]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"id"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("24199")]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"ctx"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"initandlisten"')]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"msg"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"Created KMIP key"')]),s._v(",\n  "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"attr"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n    "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"keyId"')]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v(":")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"agZTSeeJyQjVOKJgn3xeGJ6Va8sXfRXP"')]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br"),t("span",{staticClass:"line-number"},[s._v("11")]),t("br"),t("span",{staticClass:"line-number"},[s._v("12")]),t("br"),t("span",{staticClass:"line-number"},[s._v("13")]),t("br"),t("span",{staticClass:"line-number"},[s._v("14")]),t("br")])]),t("h2",{attrs:{id:"test"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#test"}},[s._v("#")]),s._v(" TEST")]),s._v(" "),t("p",[s._v("샘플 데이터 삽입")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[s._v("$ mongo\n\nMongoDB Enterprise "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" db.examples.insertOne"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("{")]),s._v("\n    name: "),t("span",{pre:!0,attrs:{class:"token string"}},[s._v('"sue"')]),s._v(",\n    age: "),t("span",{pre:!0,attrs:{class:"token number"}},[s._v("26")]),s._v("\n  "),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v(")")]),s._v("\n\nMongoDB Enterprise "),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v(" "),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[s._v("exit")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br")])]),t("p",[s._v("결과 확인")]),s._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# Collection WiredTiger 파일에 기록된 정보")]),s._v("\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# KMIP 적용 전")]),s._v("\n$ "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("cat")]),s._v(" /var/lib/mongodb/collection-7*\nA�"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("#�\\�D���1_id`�1�g�~R=��namesueage:@4�D��8�����D��2")]),s._v("\n\n"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("# KMIP 적용 후")]),s._v("\n$ "),t("span",{pre:!0,attrs:{class:"token function"}},[s._v("cat")]),s._v(" /var/lib/mongodb/collection-7*\nA�"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("#�\\")]),s._v("\n     ��$�"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v("|")]),s._v("��H�"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("l�����"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("(")]),s._v("ں?����s�ɛocD��"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("\\")]),s._v("K�"),t("span",{pre:!0,attrs:{class:"token operator"}},[s._v(">")]),s._v("J������m��N��"),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("#����_�������К")]),s._v("\n�X���ϩ"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("}")]),s._v("_�z6��L�nQ���pQ�sO�"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[s._v("]")]),s._v("�0���h_�     "),t("span",{pre:!0,attrs:{class:"token comment"}},[s._v("#�Ȟ�߳2")]),s._v("\n")])]),s._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[s._v("1")]),t("br"),t("span",{staticClass:"line-number"},[s._v("2")]),t("br"),t("span",{staticClass:"line-number"},[s._v("3")]),t("br"),t("span",{staticClass:"line-number"},[s._v("4")]),t("br"),t("span",{staticClass:"line-number"},[s._v("5")]),t("br"),t("span",{staticClass:"line-number"},[s._v("6")]),t("br"),t("span",{staticClass:"line-number"},[s._v("7")]),t("br"),t("span",{staticClass:"line-number"},[s._v("8")]),t("br"),t("span",{staticClass:"line-number"},[s._v("9")]),t("br"),t("span",{staticClass:"line-number"},[s._v("10")]),t("br")])])])}),[],!1,null,null,null);a.default=e.exports}}]);