Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
mrubyで作る海外IPフィルター
Search
yasuaki-tahira
June 10, 2017
5
4.3k
mrubyで作る海外IPフィルター
PHPカンファレンス福岡2017のスポンサーセッションでお話した「mrubyで作る海外IPフィルター」のスライドです。
yasuaki-tahira
June 10, 2017
Tweet
Share
More Decks by yasuaki-tahira
See All by yasuaki-tahira
alpine linux 入門した
yasuakitahira
5
4k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Building Adaptive Systems
keathley
38
2.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
2k
Facilitating Awesome Meetings
lara
49
6.1k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Six Lessons from altMBA
skipperchong
26
3.5k
A better future with KSS
kneath
238
17k
Unsuck your backbone
ammeep
668
57k
Why Our Code Smells
bkeepers
PRO
334
57k
Transcript
ాฏ߁࿕(.01FQBCP *OD 1)1ΧϯϑΝϨϯεԬ NSVCZͰ࡞Δւ֎*1ϑΟϧλʔ
ΠϯϑϥΤϯδχΞ ాฏ߁࿕!UBQSB ϗεςΟϯάࣄۀ෦ΠϯϑϥνʔϜ IUUQUBQJSBIBUFOBCMPHDPN
झຯ
(.0ϖύϘʹ͍ͭͯ
ϗεςΟϯά &$ࢧԉ ϋϯυϝΠυ ίϛϡχςΟ
None
͋ΔͷΞϥʔτ
ϨεϙϯεԆΛݕ 8FCαʔόίϯςϯπͷϨεϙϯε࣌ؒࢹάϥϑ
ΞϥʔτݪҼΛௐࠪ
ΞϥʔτൃੜલͷΞΫηεݩͷࠃ ւ֎ ຊ ࠃͷαʔϏεʹؔΘΒͣւ֎͕ଟ ͦͷଟ͕ͬ͘औΓߴෛՙΛ༩͑Δ߈ܸ
ւ֎͔ΒͷΞΫηε੍ݶ͕ඞཁ
ւ֎*1ϑΟϧλʔ
ւ֎*1ϑΟϧλʔͱ ւ֎*1ϑΟϧλʔ 8FC4FSWFS ւ֎͔Βͷ ΞΫηε ຊ͔Βͷ ΞΫηε
ϩϦϙοϓʂʹ͓͚Δ ւ֎*1ϑΟϧλʔͰߟྀ͢Δ՝
ϩϦϙοϓʂେنɾߴूੵ wར༻࣮ສਓ wυϝΠϯສҎ্ wΞΫηε૯ԯ ສඵ wαʔόສυϝΠϯऩ༰ͷߴूੵ ˞݄࣌
ϩϦϙοϓʂେنɾߴूੵΏ͑ͷ՝ ௨͖͢ւ֎͔ΒͷΞΫηεΛڐՄ ಛఆͷϦΫΤετύεͰಈ࡞ υϝΠϯ͝ͱʹ༗ޮɾແޮΓସ͑ ϨεϙϯεΛԼͤ͞ͳ͍
௨͖͢ւ֎͔ΒͷΞΫηεΛڐՄ wྫ͑ʜ wେखݕࡧΤϯδϯͷΫϩʔϥͷେւ֎ wΫϩʔϥΛϒϩοΫ͢ΔͱΠϯσοΫε͞Εͳ͍
ಛఆͷϦΫΤετύεͰಈ࡞ wαΠτͬऔΓαʔόෛՙʹܨ͕ΔݪҼʹݶఆ wରΛݶఆ͢Δ͜ͱʹΑΓෆཁͳఆॲཧΛ͙ wѱҙͷͳ͍ւ֎ϢʔβͷӨڹΛ࠷খݶʹ
ւ֎*1ϑΟϧλʔ υϝΠϯ͝ͱʹ༗ޮɾແޮΓସ͑ ւ֎Λڋ൱͍ͨ͠ υϝΠϯ ւ֎ΛڐՄ͍ͨ͠ υϝΠϯ wւ֎*1ϑΟϧλʔͷར༻Ϣʔβ͕ࣗ༝ʹબ 8FC4FSWFS
ϨεϙϯεΛԼͤ͞ͳ͍ wւ֎*1ϑΟϧλʔ༗ޮԽ࣌ʹԼΛײͤ͡͞ͳ͍ wʮॏ͍͔Βແޮʹ͍ͨ͠ʯͱϢʔβʹࢥΘͤͳ͍
࣮
ϩϦϙοϓʂͷߏ
ϓϩΩγαʔόʔͱ8FC4FSWFSͷଟஈߏ ϦόʔεϓϩΩγ /HJOY ɾɾɾ 8&#αʔό ςφϯτ ςφϯτ ɾɾɾ ɾɾɾ 8&#αʔό
ςφϯτ ςφϯτ ɾɾɾ ΞΫηε ΞΫηεΛదʹৼΓ͚
HFPJQϞδϡʔϧͰͷ࣮Λݕ౼
HFPJQϞδϡʔϧͱ wOHJOYDPOGͰࠃίʔυΛ༻੍ͨ͠ݶ͕Մೳ # US(ΞϝϦΧ)ͱJP(ຊ)Λڋ൱ map $geoip_country_code $allowed_country { default yes;
US no; JP no; }
௨͖͢ւ֎͔ΒͷΞΫηεΛڐՄ ಛఆͷϦΫΤετύεͰಈ࡞ υϝΠϯ͝ͱʹ༗ޮɾແޮΓସ͑ ࠃ୯Ґͷڋ൱༰қ͕ͩଞͷ݅ͱΈ߹Θͤਏ͍
௨͖͢ւ֎͔ΒͷΞΫηεΛڐՄ ಛఆͷϦΫΤετύεͰಈ࡞ υϝΠϯ͝ͱʹ༗ޮɾແޮΓସ͑ ࠃ୯Ґͷڋ൱༰қ͕ͩଞͷ݅ͱΈ߹Θͤਏ͍ ϩϦϙοϓʂͰཁ݅Λຬͨͨ͢Ί ࡉ͔ͳઃఆΛߦ͍͍ͨ
͜ͷ՝Λղܾ͢Δ ιϑτΣΞ
OHY@NSVCZNSVCZ
OHY@NSVCZͱ w!NBUTVNPUPSZ͕։ൃ wOHJOYͰNSVCZΛར༻͢ΔͨΊͷ֦ுϞδϡʔϧ wOHJOYͷڍಈΛ3VCZͰ֦ுՄೳ wύϑΥʔϚϯεྼԽ͕࠷খݶ
OHY@NSVCZͰཁ݅Λຬͨ͢ ւ֎*1ϑΟϧλʔΛ࡞Δ
*1ͷࠃίʔυΛ.BY.JOE%#͔Βऔಘ͠ఆ w*1ͱࠃίʔυΛඥ͚ͨ.BY.JOE%#Λར༻ wSFNPUF@BEESมΑΓΞΫηεݩ*1औಘ wऔಘͨ͠*1ͷࠃίʔυΛ.BY.JOE%#ΑΓऔಘ wऔಘͨ͠ࠃίʔυ͕ڐՄͯ͠Α͍͔ఆ
6TFS"HFOUΛݩʹ௨͖͢ւ֎͔ΒͷΞΫηε͔ఆ wIUUQ@VTFS@BHFOUมΑΓ6TFS"HFOUΛऔಘ wऔಘͨ͠6TFS"HFOU͕௨͖͢ͷ͔ఆ
ϦΫΤετύεΛݩʹ੍ݶର͔ఆ wSFRVFTU@VSJมΑΓϦΫΤετύεΛऔಘ wऔಘͨ͠ϦΫΤετύε੍͕ݶର͔ఆ
ΞΫηεఆΛߦ͏ػೳΛ OHY@NSVCZ͔Β؆ܿʹݺͼग़͢
NSVCZJQpMUFS
NSVCZJQpMUFSͷׂ wIUUQTHJUIVCDPNQFQBCPNSVCZJQpMUFS w༷ʑͳଐੑΛͱʹڐՄɾڋ൱ͷఆ wϦΫΤετύεɾ6TFS"HFOUɾΞΫηεݩࠃίʔυ wQFSNJU ɾEFOZ ͱ͍͏ڞ௨ͷϝιουͰఆ wࠓޙͦͷଞ༷ʑͳύϥϝʔλʹରԠ༧ఆ
༷ʑͳใΞΫηεʹΑΔ ύϑΥʔϚϯεྼԽΛ࠷খݶʹ͑Δ
NSVCZNTE
NSVCZNTEͷׂ wIUUQTHJUIVCDPNQFQBCPNSVCZNTE w!QZBNBͱڞಉͰ։ൃ wσʔλϕʔεɾωοτϫʔΫ,74ɾΠϯϝϞϦ,74 ͷΞΫηεΛࣗಈͰ࠷దԽ w.Z42-ɾ3FEJTɾ-.$ ΠϯϝϞϦͷ,74 Λ࠾༻
NSVCZNTE ΠϯϝϞϦ ,74 MPDBMNFNDBDIF ωοτϫʔΫ ,74 ʢ3FEJTʣ σʔλϕʔε .Z42- σʔλΞΫηε
ॲཧίετ͕͍σʔλετΞ͔ΒॱʹΞΫηε σʔλ͕ݟ͔ͭΓ࣍ୈฦ͢ ࣍ճҎ߱ͷΞΫηεͷͨΊʹΩϟογϡ OHY@NSVCZ
ւ֎*1ϑΟϧλʔͷॲཧͷྲྀΕ
ւ֎*1ϑΟϧλʔͷॲཧ༰ ւ֎*1ϑΟϧλʔ ւ֎*1ϑΟϧλʔ͕༗ޮͳαΠτʁ ࠷దԽ͞Εͨ σʔλετΞ :&4 63-ఆ 6TFS"HFOUఆ ࠃίʔυఆ શͯʹ֘͠ͳ͍ΞΫηεͷΈ8&#αʔόʹసૹ
ΞΫηε
·ͱΊ
·ͱΊ wηΩϡϦςΟɾߴෛՙରࡦͱ͓٬༷ͷӨڹͷόϥϯεΛ ߟྀͨ͠ւ֎*1ϑΟϧλʔΛ࣮ͨ͠ wࠃίʔυϦΫΤετใΛݩʹఆΛߦ͏ *1ϑΟϧλʔϞδϡʔϧ wσʔλΞΫηε࠷దԽ͠େنڥద༻Մೳͱͨ͠
1)1Λ҆શɾշదʹ͏ͳΒϩϦϙοϓʂ
܅ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠