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
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Done Done
chrislema
181
16k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Fireside Chat
paigeccino
34
3k
BBQ
matthewcrist
85
9.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
How to Ace a Technical Interview
jacobian
276
23k
Navigating Team Friction
lara
183
14k
Typedesign – Prime Four
hannesfritz
40
2.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠