Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
できるLDAP(2013/09/27 社内勉強会)
Search
Takeru Ichii
September 27, 2013
Technology
650
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
できるLDAP(2013/09/27 社内勉強会)
Takeru Ichii
September 27, 2013
Other Decks in Technology
See All in Technology
FinOps Agentが生んだ技術負債:コスト自動調査の落とし穴と解消までの道のり
oasis1994liveforever
1
120
Kiro Crewをはじめよう
kizawa2020
1
160
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
180
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
820
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
290
Rust で関数型ドメインモデリング
takonda
0
160
夫婦で子育てするための育児標準化
codmoninc
PRO
0
430
AI コーディングと人間の認知スループット / CTO Night & Day 2026 Morning Session / AI Coding and Human Cognitive Throughput
prog893
4
1.2k
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
180
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
290
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
270
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.4k
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
590
Embracing the Ebb and Flow
colly
88
5.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
BBQ
matthewcrist
90
10k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
The untapped power of vector embeddings
frankvandijk
2
1.9k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Six Lessons from altMBA
skipperchong
29
4.5k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Transcript
できる LDAP Takeru Ichii جૅ͔ΒֶΜͰʹ͚ͭΑ͏ʂ -%"1ͷߏΛ؆୯ղઆ
「ああ、了解です。」 • 部長 「来週10人スタッフが増えるからアカウント関係、 用意しておいて〜」 • Aさん 「ああ、了解です。」 え? 2
数が多い… • アカウント登録先を6個/人とすれば、10人で60個 • 条件によってはアカウント登録先は増加する ( ^o^) .oO(あれ???) <) )>
< ̄ ̄> _人人人人人人人人_ > 登録忘れの危険性 <  ̄Y^Y^Y^Y^Y^Y^Y^Y^Y ̄ 3
チェックしても… • 結局のところ、パスワードがマスクされて 正しいのかわからない o 「PassWord」と「•••••••」が一緒では無い可能性がある • コピペしても、範囲が間違っていた o 「taro_yamada@yam…」が「taro_tamada@yam…」になってた
<(;^o^)> アカウントに ) ) 入れない!!! < ̄ ̄> 8文字 7文字 4
こんなこといいな できたらいいな • 一括してユーザー情報を管理 • 複数のサービスがひとつのユーザー情報を参照 ___________
| ̄ ̄ ̄ ̄ ̄ ̄ ̄/ノ ヽ、:\ >>1 | | ̄ ̄ ̄ ̄ ̄ /(•) (•)::::\ | | LDAP / (__人__)⌒::::::::::::\ | | | |r┬-| ::::::::::::::| | |____ \__`ー'´ ::::::::::::::::/ └___/ ̄\/ ::::::::::::::::::::::::\ |\ | / :::::::::::::::::::::::::\ \ \ \__/ :::::::::::::::::::::::::::| これだ!!! 5
救世主 LDAP Lightweight Directory Access Protocol • ディレクトリサービスにアクセスするためのプロトコル o
ディレクトリサービスとは、ユーザーやIT資源の情報を記録し、 検索するためのサービス • 現在はv3が規定されている(RFC2251) • もちろんパスワードも記録可能(userPassword) • というか、ユーザーや資源に関する情報は基本なんでも 記録可能。(スキーマの設定が必要) • 外部サービスがユーザー情報を検索して、認証に使うこ とができる。 6
要するにLDAPとは →プロフィールカードの集合である h5p://exeoparty.net/im_profile.jpg 識別名(dn) 属性 (a5ribute) LDAPでは識別名(dn)は階層構造で表される 例) 名=山田 太郎,
市区町村=渋谷区, 都道府県=東京都, 国=日本国 その識別名をもつエントリがもつ情報 LDAPは識別名でエントリを 素早く検索し、属性を返すのが 重要なお仕事 例:婚活パーティーのカード 7
エントリとは そしてLDAPの階層構造 jp com Dev Aさん Bさん Cさん Mark
Dさん Eさん … エントリ エントリ dn: uid=E-‐‑san, ou=Mark, dc=com, dc=jp dc : ドメイン構成要素 ou : 部署名 uid : user ID dn: dc=com, dc=jp dn: ou=Mark, dc=com, dc=jp 8
すごいぞLDAP • いろんなサービスでLDAPをサポートしている LDAP Srv ユーザー情報A ユーザー情報B ユーザー情報C Redmine WEB
Srv Basic Auth OpenSSH RSA Auth Linux machine Samba Srv Mail Srv FTP Srv 9
LDAP Srv. LDAPの構成 LDAP Interface DB Driver Backend DB 検索指示
DBへの リクエスト Backend DBに 対応したクエリ DB 検索結果 LDAP Interface が処理できる形 LDAP形式 の検索結果 LDAP Interface は389/TCP(標準) 10
DBはどんな感じ? • 標準的にはBerkeley DBを使用する。 • 皆さんおなじみのRDB(SQL)を使うことができる。 • DBに格納できるデータはスキーマファイルに記述して あるobjectClassで定義される。 スキーマ?
objectClass? ____ ━┓ / \ ┏┛ / \ ,_\. ・ / (•)゛ (•) \ | ∪ (__人__) | / ∩ノ ⊃ / ( \ / _ノ | | .\ “ /__| | \ /___ / h5p://thinkit.co.jp/free/article/0706/15/1/ 11
スキーマとは? そしてobjectClass • 詳しい説明はRFC2251の3.2.1.Attributes of Entries参照 • エントリが持てる属性の集合体であるobjectClassを 定義したのがスキーマ
core.schema (schema) person (objectClass) 例: sn (a5ribute) : 姓 cn (a5ribute) : 名 userPassword (a5ribute) : ユーザーパスワード (a5r) (a5r) organizationalPerson(objectClass) (a5r) (a5r) (a5r) h5p://www.turbolinux.co.jp/products/server/11s/user_guide/openldapdirtree.html 12
LDIFとは LDAP data interchange format • Backend DBの形式の一つ •
プレーンテキストで記述されるシンプルな形式 • LDAPのBackend DBにエントリを取り込むときに よく使われる • 書式の詳細はRFC2849を参照 13
LDIFの例 objectclass ( 2.5.6.6 NAME 'person' DESC 'RFC2256: a
person' SUP top STRUCTURAL MUST ( sn $ cn ) MAY ( userPassword $ telephoneNumber $ seeAlso $ description ) ) dn: uid=taro_yamada, dc=yamato, dc=co, dc=jp changetype: add objectClass: person cn: Taro sn: Yamada mail:
[email protected]
userPassword: password_hoge core.schema の objectClass ”person” LDIFはこう書く 必須項目 任意項目 cn, snなどの意味はRFC2256を参照 14
/;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;ヘ
小;:;:;:;:;:;:;:;:;:;:;:;:;:;:;::;:;:/ ̄ ̄ヽ;:;:;:;:;:;:;:;:;:;:;:;:;:;:;:;| ∨;:;:;:r、;:;:;:;:;:;:;:;:;:;/ ヽ;:;:;:;:;:;:;:;:;:;:;:;:;:| ヾミ | `¨''ー-f´ L;:;:;:;:;:>ミ;;;:;:;:;:| `| 〃´ `ヽ::l r |;:;:;:;:| | `ヽ ム=ニ二o二フ | |ソ |;:;:;:;:| ヽ弋二ニPY ` ;; |;:;:;:/ ヽ | i ト-へ/ ヘ. | i l ヽ. t___ ´ | _ ヽ ー─一 / | ンヘ ─一yへ~/ー´/ イヽ-z=======ミ ゙゙゙゙ / レ':::::::::| ./:::::/ (:::::/ /:::::::::::::::::::::::::::::::::::::|:ゝ、____. イ_,;r<´::::::::::::::::|ヽ、 └‐┘ └┘ /z───────-|:::::::::::::::::::::::::::::::::::::::::::::::::::::::ノ:::::: ヽ::::::::::::::::::::::::::::::::::::::彡ヘ:::::::::::: /`::ー───r一'''´ \::::: 〉::::::::::::::::::::::::〈 | /::::::::::::::::::::::::::/ | 、 /::::::::::::::::::::::::::/  ̄ ̄`ヽミ| |ヘ /::::::::::::::::::::::::::/ | |::∧ /:::::::::::::::::::::::::/ | |::::∧. ↓::::::::::::::::::::::↓ -=ミ 〃):) ハ-― 、 _{{:{:{/::≫'"´  ̄ ̄ ̄`ヽ、 _ >ヘ.::.:_>'´ .::.::.::.::.:-―::=ミ V/⌒\ / .::./ .::.::.::./::.::.::.::.:: ⌒\ {人 .::./ .::.::.::.::.::.::.::.::.:/::.::.: .::.::.ヽ / .:ーァ .::.::.::.::/:/\/.::.::.::.::. .::.::.::.::.:'. / .::.::./ .::.::.::.::/テ=ミ. |ヽ.::.::.::.::. .::.::.::.::.::.::i /'⌒7 .::.::.:: ::.::.::.::/ 乂..::::Ⅵ│.::.::.::.::.::/ :.::.::.::.::.::.ト: . /.::.::.::.::| ::.:ハ.::.i (_)´ |/|.:: /|.::.::.::.::.::.::.::.::}: . 厶ィ.::.::.: | ::./ 、| |Ⅹ :i/::.::.::.::.::.::.ノ: : : . ___ |::.::.::.八:{ , テ=ミ ∨.::.::.::/.::/\ : : : . /⌒\ i{'⌒^レi/ :. ト ヾ..:::Ⅳ.::.::.::.::.::.::.::.::.::.:) : : : . '⌒′ 人. V⌒ ´ :. ゝ (.)厶イ::.::./.::.::.:/ : : : : : / / \} __,, -―=ゝ ,,__({ _,,. <.::.::.::.::/.::.::.:/: : : : : : : : r─ < `''ー-=ニ二)::.::.::.::.::.::.::.::.::.::.::.::.::.::.::.:/: : : : : : : : : : / }  ̄ ̄} 丶、  ̄¨V⌒乙/⌒}/⌒: : : : : : : : : : : : / 〈  ̄ ̄ ̄ ̄`ヽ }: : : : : : : : : : : : : : : : : : : : : : : : く __ \ ∨: : : : : : : '^つ (ヽ: : : : : : : : 厂 ̄ } : : : : : / ノ ̄ (二): : : : : \/ }/ ∨: : : : / ー`ァノ: : : / 〈: : :./ _, ´: : : : : DBのデータが吹っ飛んだ…(アッカリーン こんなこともあろうかと LDAPのBackend DBに冗長性を持たせておいた ※初代ヤマトじゃ「こんなことも〜」ってセリフは無いらしいですね 15
LDAP Srv. LDAP Srv. DB分散化 • 大きくわけて2つ o 複製 Backend
DB Backend DB 負荷分散 or 冗長化 似た例:RAID1 16
LDAP Srv. dc=yamato, dc=jp DB分散化 • 大きくわけて2つ o 分割 •
その1 Backend DB 管理の分散 or セキュリティ向上 or 負荷分散 LDAP Srv. dc=sd, dc=yamato, dc=jp Backend DB LDAP Srv. dc=da, dc=yamato, dc=jp Backend DB 17
LDAP Srv. DB分散化 • 大きくわけて2つ o 分割 • その2 Backend
DB ユーザー頭文字:A-‐‑H Backend DB ユーザー頭文字:I-‐‑Z 容量拡大 or 処理性能向上 18
Access Control • Layer3レベルでのアクセスコントロールは必須 o iptables等でファイアーウォールを使えば簡単 • LDAP内の参照等のアクセスコントロールも指定可能 o ホスト別に読み書きの権限を振り分けることができる(peername.ip)
h5p://gihyo.jp/admin/serial/01/ldap/0010 19
通信フロー • 認証をするような場合を考える LDAP Srv ユーザー情報A ユーザー情報B ユーザー情報C Redmine 入力:
password -‐‑wo]@0i password ____ / _ノ ヽ_ \ /。(⌒) (⌒)o\ / :::⌒(__人__) ⌒::: \ | ヽr┬-ノ | ____________ \ `ー'′ ,/ ._i~~| | | | __/ ‘\ |_ _| | | | | | / ,. \n|| | | | | | / / .r. ( こ) | | | | | | ⌒ ーnnn |\ (⊆ソ .|_|__________|  ̄ \__、("二) ̄ ̄ ̄ ̄ ̄l二二l二二 _|_|__|_ tcpdumpやWiresharkで余裕で Pass見れるおwww 20
実際にキャプチャ 10:45:36.062466 IP 192.168.***.225.57759 > 192.168.***.224.ldap: Flags [P.],
seq 1:91, ack 1, win 229, options [nop,nop,TS val 2062252 ecr 2063846], length 90 0x0000: 4500 008e 65d2 4000 4006 1186 c0a8 20e1 E...e.@.@....... 0x0010: c0a8 20e0 e19f 0185 925f 127c 92d0 06d3 ........._.|.... 0x0020: 8018 00e5 64b7 0000 0101 080a 001f 77ac ....d.........w. 0x0030: 001f 7de6 3058 0201 0160 5302 0103 0444 ..}.0X...`S....D 0x0040: 7569 643d 7573 6572 5f73 616d 706c 652c uid=user_sample, 0x0050: 6f75 3d50 656f 706c 652c 6f3d 5379 7374 ou=People,o=Syst 0x0060: 656d 2053 7570 706f 7274 2c64 633d **** em.Support,dc=** 0x0070: **** **** **** **** 2c64 633d 636f 2c64 ********,dc=co,d 0x0080: 633d 6a70 8008 7061 7373 776f 7264 c=jp..password Redmine(192.168.***.225)でLDAP(192.168.***.224)を使って認証した時のtcpdump userID: user_sample, パスワード:password 本当に平文で送信されていた… 21
通信は安全なの? • 実は安全じゃない o LDAPサーバーが別のマシンでネットワークを通して通信する時、 パケットキャプチャすると平文で入力Passwordが流れている o その返りもキャプチャされると、正しいパスワードがダダ漏れに。 • どうする?
o ldapではなく、ldapsで通信すればおk! • ldapsって何よ? o LDAP over SSLのこと。これによって通信経路自体を暗号化することが可能 o httpsみたいなもんです。 • SASLでアプリケーションレベルの通信も暗号化できる h5p://www.atmarkit.co.jp/ait/articles/0901/21/news123_2.html 22
まとめ • 管理一元化できるから、アカウント管理楽になるよ! • DBも分散できるから何かあっても大丈夫! • 通信もちゃんと適切な設定すれば安全だよ! __、 ,r´⌒ヽ,⌒ヽ,ヽ
(⌒)、 .人 λ\、 ._____ \. \ 、 ヽ./ ー ー\ |\ \ ヽ./ ( •) ( •) | \ \ / (__人__) \ |. \ | ` ⌒´ | . |. |.\_ノ\ / . |. | | \______/ . | ) .| . . ̄ ̄ . | | .| | |.| .| . | | .| .| / / / ヽ, (__ノ ヽ、__つ ご清聴ありがとうございました 23