SlideShare a Scribd company logo
1 of 13
Download to read offline
Zabbixの通信を暗号化する!!
~拠点間通信をstunnelで暗号化~
山根 健志(Takeshi YAMANE)/ふりっぱぁ
Twitter : @fripper1214
fripper1214 at gmail.com
2014/06/29
自己紹介
山根 健志 (Takeshi YAMANE)
https://twitter.com/fripper1214
https://www.facebook.com/takeshi.yamane.9
• 都内某社のプログラマ
• 開発だけでなく、導入支援やらHW周りやら色々‥
• 業務でもZabbixを愛用(2.0.x)
• アニメやら音楽やら色々好き
• 以前は自宅サーバとか置いていたけれど、今は引退‥
• Zabbixとの出会いは数年前(1.6.xの頃)
Zabbixが行う通信は平文
• 現行バージョン(2.2.4)およびそれ以前のZabbixでは、監
視動作に関する通信は、全て暗号化されず、平文にて通
信されている‥
• 公衆回線経由だと業務に関する監視とか心配‥
⇨暗号化して、秘匿性を維持確保したい
• zabbix_server  zabbix_agentd
• zabbix_proxy  zabbix_agentd
• zabbix_server  zabbix_proxy
• zabbix_sender ⇨ zabbix_server
• zabbix_sender ⇨ zabbix_proxy
• zabbix_get ⇨ zabbix_agentd
暗号化のために使う手法
• 離れた地点を、暗号化した通信経路でつなぐ技術
• NTTやSoftBankなどの業者が提供する閉域VPN
⇨コストが掛かり過ぎる!高い!
• OpenVPN等を利用したインターネットVPN
⇨各拠点でサブネットやらルーティングやらを
考慮して設計する必要がある
• もっとカジュアルに暗号化したいなぁ
⇨httpsなどのように、TCPソケット通信単位で
SSLを使って暗号化すればいいじゃない!!
SSL暗号化のために使う道具
• TCPソケット通信の暗号化処理・復号処理を行って
くれるようなツール
⇨ stunnel
https://www.stunnel.org/
• Linux・Windows、どちらも対応している
最新版は 5.02(2014/06/28現在)
CentOS等には公式rpmもあるが‥古い‥orz
stunnelを使った通信の暗号化
• stunnelでは色々な使い方で通信暗号化ができるが、今
回のターゲット、Zabbixは接続元・接続先、双方が暗号
通信に非対応なので、接続元・接続先の双方にstunnel
を配置して、経路の暗号化を行う
接続元
モジュール
接続先
モジュール
接続元
モジュール
接続先
モジュール
平文による通信
平
文
に
よ
る
通
信
stunnel
暗号化
stunnel
復号
平
文
に
よ
る
通
信
暗号通信
Zabbixの通信にstunnelを挟む(1)
• server(proxy)  agentd 間の通信
双方向のtcp接続をそれぞれ転送しなければ監視不成立‥
⇨面倒だし、監視対象が増えると、「エージェント」監視用の
転送待受tcpポートの設定・管理等で破綻‥
server(proxy) agentd
「エージェント」監視関連通信 (get)
10050
10051
「ログ」「アクティブ」監視関連通信 (trapper)
server(proxy) agentd
10050
10051
10050
10051
11050
11051
Zabbixの通信にstunnelを挟む(2)
• server  proxy 間通信
zabbix_proxyは標準だとactive proxy設定
⇨ 片方向の通信経路だけ準備できれば良い
⇨ server側の待受は共通化できるので、
監視対象・拠点数が増えても大丈夫!!
server proxy
「passive proxyの場合」
10050
10051
「active proxyの場合」
server proxy10051 1005111051
agent agent
agent agent
stunnelの導入
• ソースからインストールするなら‥
configure / make / make install
• yum / rpm でインストールするなら‥(CentOS6)
yum install stunnel
⇨標準だとinitスクリプトはインストールされない
Zabbixの通信用にサービス常駐させるので必要
⇨ http://www.gaztronics.net/scripts/stunnel.php
43行目のstunnel実行プログラムフルパスを修正
stunnelの設定(1)
• とりあえず key/cert が必要
⇨opensslを使って作る
⇨以下コマンド例(いわゆるオレオレ証明書)
• 用意した証明書を配置する
root# openssl genrsa 2048 > server.key
root# openssl req -new -key server.key > server.csr
root# openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
root# cat server.key server.crt > server.pem
root# cp server.pem /etc/stunnel/
root# chmod 600 /etc/stunnel/server.pem
stunnelの設定(2)
• stunnel.conf 内の設定
⇨先ほど用意した cert/key を設定
⇨転送接続に関する設定
⇨ server 側
⇨ agent 側
cert = /etc/stunnel/server.pem
key = /etc/stunnel/server.pem
[zabbix-server]
accept = 0.0.0.0:11051 ← 外部からの暗号接続を tcp:11051 で受信し
connect = 127.0.0.1:10051 平文化して localhost の tcp:10051 へ接続
[zabbix-agent-to-server]
client = yes
accept = 127.0.0.1:10051 ← agent からの接続を tcp:10051 で受信し
connect = 192.168.1.206:11051 暗号化して server の tcp:11051 へ接続
Zabbix側の設定
• zabbix_server.conf 内の設定
ListenIP
外部からの接続は stunnel が受け、server 自身は stunnel から
接続されるだけになるので、127.0.0.1 で十分
• zabbix_proxy.conf 内の設定
Server
proxy が結果を送るべき server は localhost 上の stunnel。
127.0.0.1 とする
• zabbix_agentd.conf 内の設定
ServerActive
agent(active) が結果を送るべき server は localhost 上の stunnel。
127.0.0.1 とする
これで安心!!
• 双方のホストで stunnel を常駐させ、常時通信を暗号化す
ることで、傍受・改ざんを回避!
⇨ これで安心だねっ\(-o-)/
<忘れちゃいけないこと:SSL 使った暗号化をやるなら‥>
・stunnelで使っている暗号化鍵の流出には注意!
・証明書・鍵の有効期限切れにも注意
・stunnel はバックエンドに openssl の機能を利用している
⇨ stunnel / openssl を適正に維持管理

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Zabbix モジュール間の通信を暗号化する