Quantcast
Channel: 小惡魔 – 電腦技術 – 工作筆記 – AppleBOY
Viewing all articles
Browse latest Browse all 325

SSH agent forwarding 教學

$
0
0
Screen Shot 2016-10-05 at 9.26.13 AM SSH agent forwarding 可以讓開發者將 Local 端的 SSH Key Pair 帶到另外一台機器進行傳送,也就是說你不用將 SSH Key 複製到遠端 Server 再進行跳板動作,原本在 AWS 維護多台 EC2 主機,都會固定有一台跳板機,大家都把自己需要登入遠端機器的 SSH Key 複製到跳板機,這做法其實沒有很安全,又需要多下一個指令進行跳板。
個人電腦 —-> EC2 跳板機 —-> EC2 Server
大家都會把 Key Pair 存放到跳板機,安全性堪憂,只要這台主機被 Hack,或者是內部員工登入,拿別人的 Key Pair 登入其它主機,不就可以搞破壞?所以此篇教學主要教大家如何設定 SSH agent forwarding,讓憑證只存放在自己電腦,而不需上傳到 EC2 跳板機。這樣跳板機就真的只是跳板機,不需要存放任何憑證資料,每小時設定清空 Ubuntu User 家目錄,避免內部員工放個人資料或憑證,提升主機安全性。

將 Key Pair 方到清單

透過 ssh-add 指令將 Private Key Pair 加入清單
$ ssh-add ~/.ssh/keys/labs.pem
透過底下指令可以看到清單列表
$ ssh-add -L
這邊注意可以將所有機器的 key pair 都放到 ~/.ssh/keys 目錄,並且設定 400 權限

設定 ~/.ssh/config

設定 ~/.ssh/config 檔案,每個 Host 都加上 ForwardAgent yes 參數
Host aws
  HostName 10.130.xxx.xxx
  User ubuntu
  ServerAliveInterval 60
  ForwardAgent yes
  UseRoaming no
  IdentityFile ~/.ssh/keys/aws.pem
最後執行底下指令就可以直接跳到您要的 EC2 Server
$ ssh -t aws 'ssh example.inc'
直接就跳到 EC2 Server,不用再跳板機多下一個 SSH 登入指令,蠻方便又安全。內部 Host Name 可以透過設定 AWS Private Hosted Zones

Viewing all articles
Browse latest Browse all 325

Trending Articles


Best Crush Tagalog Quotes And Sayings 2017


Sapos para colorear


Tagalog Quotes About Crush – Tagalog Love Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Tagalog Quotes To Move on and More Love Love Love Quotes


5 Tagalog Relationship Rules


INUMAN QUOTES


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.


Girasoles para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Break up Quotes Tagalog Love Quote – Broken Hearted Quotes Tagalog


Patama Quotes : Tagalog Inspirational Quotes


Pamatay na Banat and Mga Patama Love Quotes


Tagalog Long Distance Relationship Love Quotes


BARKADA TAGALOG QUOTES


Re:Mutton Pies (lleechef)


FORECLOSURE OF REAL ESTATE MORTGAGE