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
多段接続について
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yukitkns
February 04, 2024
Programming
81
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
多段接続について
yukitkns
February 04, 2024
More Decks by yukitkns
See All by yukitkns
Let's EncryptでSSL証明書を自動更新
yukitkns
1
68
OCI Stack Monitoringでリソース監視をする
yukitkns
1
840
WAFログの推奨ルールを確認する
yukitkns
0
63
OCI ロギングでカスタム・ログを収集する
yukitkns
1
860
「寺子屋Oracle Cloud:Win Story研究会『ハイブリッドクラウド・マルチクラウド』」に参加してみて
yukitkns
1
180
開発未経験者がはじめて DevOpsを触ってみた
yukitkns
0
190
「寺子屋Oracle Cloud:Win Story研究会『OCVSのリフト案件』」に参加してみて
yukitkns
0
190
ここがスゴいよ、OCM!!
yukitkns
1
180
Other Decks in Programming
See All in Programming
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
810
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.4k
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
980
FDEとは、何者なのか?
masapyon1212
0
140
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
630
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
高専キャリア LT 発表内容
crysta1221
6
5.5k
MySQLとPostgreSQLって何が違うの?
akagami
PRO
0
160
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
220
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
360
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
280
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
How to make the Groovebox
asonas
2
2.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
720
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
GraphQLとの向き合い方2022年版
quramy
50
15k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Embracing the Ebb and Flow
colly
88
5.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Transcript
踏み台サーバ経由で 多段接続を実施
従来のプライベート・サブネットにある サーバの接続方法 1. 踏み台サーバ経由で接続 ・手順が簡素 ・踏み台サーバに秘密鍵を配置するため、セキュアな接続方法ではない 2. ポートフォワーディングで接続 ・ローカルの秘密鍵を使用するので、セキュアに接続可能 ・コマンドを複数回実行する必要があり、かつ長文で複雑
多段接続とは? l異なるネットワークセグメントやセキュリティゾーンに存在する複数のコ ンピュータやサーバに、SSHや他のプロトコルを使用して順次接続する セキュリティ手法。 →コマンド一文のみでプライベート環境にあるサーバに接続する事が可能 l多段接続は2つ方法がある 1. ワンライナーで実行 2. ~/.ssh/configに記述
ワンライナーで実行 l以下のコマンドを使用 ssh -o ProxyCommand=‘ssh -i <踏み台サーバの秘密鍵のパス> -W %h:%p opc@<踏み台サーバの
パブリックIPアドレス>’ -i <目的サーバの秘密鍵のパス> opc@<目的サーバのプライベートIPアドレス> l ssh -o ProxyCommand=‘ssh -i <踏み台サーバの秘密鍵のパス> -W %h:%p opc@<踏み台サーバのパブリック IPアドレス > :目的のホストに直接接続せず、指定されたプロキシコマンドを使用して中継経由で接続を確立。 l -W %h:%p:プロキシサーバを通してトンネルを確立するためのオプション。 lSCPコマンドでファイル転送を行う場合 scp -o ProxyCommand=‘ssh -i <踏み台サーバの秘密鍵のパス> -W %h:%p opc@<踏み台サーバの パブリックIPアドレス>’ –i <目的サーバの秘密鍵のパス> <転送対象のファイル> opc@<目的サーバの プライベートIPアドレス>:<転送先のパス>
ローカルPC 踏み台サーバ vm-tokyo 138.2.25.12 目的サーバ private 10.0.1.215 VCN(10.0.0.0/16) 秘密鍵 踏み台サーバ:~/Desktop/key/test.key
目的サーバ: ~/Desktop/key/private.key
~/.ssh/configに記述 l右の内容を記述 ログイン時は「ssh <ホスト名>」のみで目的 サーバに接続可能 lSCPコマンドでファイル転送を行う場 合 scp -i <目的サーバの秘密鍵のパス>
<転送 対象のファイル> <目的サーバのホスト名>: <転送先のパス> ※ProxyCommandをProxyJumpに変更
ユースケース lワンライナーで実行 l configファイルに設定不要で接続可能 l configに書き込むより、コマンドが長く直感的に実行できない l~/.ssh/configに記述 l ログイン時にホスト名のみで可能 l
事前にconfigファイルに記述が必要 l ホスト名は重複不可で、事前にホスト名の定義を行う必要がある
出典 「踏み台サーバ経由の多段SSH接続をローカル端末の秘密鍵のみで実施する」 https://dev.classmethod.jp/articles/bastion-multi-stage-ssh-only-local-pem/ 「多段 ssh するなら ProxyCommand じゃなくて ProxyJump を使おう」
https://zenn.dev/kariya_mitsuru/articles/ed76b4b27ac0fc