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

vuls

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 vuls

本番サーバの実運用 on GCP
RPM以外も取り込む実運用での工夫について

Avatar for Yusuke Hasegawa

Yusuke Hasegawa

September 26, 2016
Tweet

More Decks by Yusuke Hasegawa

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ facebook: yusuke.exzm ࢯ໊ ௕୩઒ ༞հ ܦྺ GMO, Yahoo Japan,

    Squere Enix etc…
 2010೥ʹgms(gloopsͷલ਎)΁ೖࣾ גࣜձࣾgrasysͷ୅දΛ΍Γͳ͕ΒΤϯδχΞ΍ͬͯ·͢ɻ ৬छ ΠϯϑϥΤϯδχΞ Google Developer Expert, GCPUG Admin publish Fusion-IOΛ2011೥ʹຊ൪ಋೖ͠Fusion-IOࣾʹऔΓ্͛ΒΕΔ SoftwareDesign2012.03هࣄ 2012೥DellͷCMग़ԋʢςϨϏ౦ژ ϫʔϧυϏδωεαςϥΠτʣ IcingaʢnagiosͷforkʣͷϢʔβʔίϛϡχςΟʹܝࡌ ຊ΋ॻ͖࢝Ί·ͨ͠
  2. جຊతͳߏ੒ ops product servers monitor Google Cloud Platform Compute Engine

    Firewall QPSU ssh opsͱ͍͏Πϯελϯε͕த৺ SSH౿Έ୆ ΦʔέετϨʔγϣϯ vulsͷ࣮ߦ΋͜͜Ͱ
  3. ؂ࢹ ΦʔέετϨʔγϣϯ ίʔσΟωʔλʔ ݴޠ XXenv ཁ݅ͰVersionࢦఆͳͲʹରԠ͢ΔͨΊ ϛυϧ΢ΣΞ ιʔε͔ΒίϯύΠϧٴͼBinary൛Λར༻ ཁ݅ͰVersionࢦఆͳͲʹରԠ͢ΔͨΊ ϥΠϒϥϦ

    ඞཁ͋Ε͹ιʔε͔ΒίϯύΠϧ ཁ݅ͰVersionࢦఆͳͲʹରԠ͢ΔͨΊ Πϯελϯε಺෦ consul࢖ͬͯΔΑʂίϯύΠϧ΋͚ͬ͜͏ͯ͠ΔΑʂ
  4. WVMTDPOpHUPNM [servers.HOSTNAME] host = "HOSTNAME" cpeNames = [ "cpe:/a:djangoproject:django:1.6", ]

    ↑ ඥ෇͚ͳ͍ͱ͍͚ͳ͍ ͋͞Ͳ͏΍ͬͯ͜ͷ৘ใΛɾɾɾ cpeNamesͰ ֦ுͰ͖Δ͕ɾɾɾ ↓
  5. DWFTRMJUFDQFTUBCMF CREATE TABLE "cpes" ( "id" integer primary key autoincrement,

    "created_at" datetime, "updated_at" datetime, "deleted_at" datetime, "jvn_id" integer, "nvd_id" integer, "cpe_name" varchar(255), "part" varchar(255), "vendor" varchar(255), "product" varchar(255), "version" varchar(255), "update" varchar(255), "edition" varchar(255), "language" varchar(255) ); ←͜ΕͰselect͢Ε͹ʂ
  6. KTPOGPSNBU { "middleware": [ { "name":"[middleware name]", "version":"[version]", "update":"[patch version]"

    } ], "update_time": "YYYY-MM-DD HH:MM:MM", "host": { "Πϯελϯε৘ใ͍Ζ͍Ζ", "node_name": "yusuke" } } ඞཁͳ৘ใΛϦετͰ
  7. 8FC"QQMJDBUJPO'SBNFXPSLͱ͔ʁ middleware: - name: [product name] version: [version num] update:

    [patch version] ↑ औಘͰ͖ͳ͍΋ͷʹ͍ͭͯ͸YAMLͰ೚ҙʹ֦ு ͱ͍ͬͯ΋ϑϨʔϜϫʔΫ͕ΆΜΆΜมΘΔ͜ͱ͸ͳ͍ͷͰɾɾɾ ͕͢͞ʹ͍Ζ͍Ζ͋ͬͯࣗಈऩू͸ϜϦͩͬͨ͆
  8. WVMTͷUPNMੜ੒ 1. consul HTTP API /v1/catalog/nodes 2. consul KV vuls/[hostname]

    JSONऔಘ 3. Host৘ใͷTagΛར༻֦ͯ͠ுͷYAMLऔಘ 4. cve sqliteʹJSONͷproduct, version, updateͰselect 5. Template EngineͰvulsͷtomlΛग़ྗ consul kv vuls/[instance name] cve.sqlite3 script vuls config.toml extend YAML Instance Tagʹඥͮ͘:".- 100୆͘Β͍Ͱ΋ 10਺ඵͰ׬ྃʂ
  9. *OJU4DSJQUʹΑΔӡ༻ͷ؆қԽ /etc/init.d/vuls /etc/init.d/vuls: vuls init script help: example: /etc/init.d/vuls [sub

    command] sub command: start: start server stop: stop server restart restart server status server status 1st_setup setup, update_week, reconfig, prepare, start full_setup setup, update_full, reconfig, prepare, start reconfig: make config setup: setup cve/nve database prepare: prepare instance scan: scan history: scan history report: for consul service report tui: Terminal User Interface update cve database update_entire: dictionary entire update update_month: dictionary month update update_week: dictionary week update update_full: dictionary full update go-cve-dictionaly/vulsͷ ىಈͱαϙʔτεΫϦϓτͱͯ͠ configੜ੒ͳͲͷϥούʔͱ͔ σΟϨΫτϦπϦʔͷੜ੒ͱ͔ ΋Ζ΋Ζɾɾɾ ·Δͬͱ΍ͬͯΔͷͰ ࣾ಺ͷΤϯδχΞʹ΋આ໌ཁΒͣ