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
Designing for humans not robots
tammielis
250
25k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
BBQ
matthewcrist
85
9.3k
Building Applications with DynamoDB
mza
90
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Documentation Writing (for coders)
carmenintech
65
4.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Designing Experiences People Love
moore
138
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Agile that works and the tools we love
rasmusluckow
327
21k
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠