《ssh-agent管理ssh密鑰》要點(diǎn):
本文介紹了ssh-agent管理ssh密鑰,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
ssh-agent是ssh其中一個(gè)組件,可以用來(lái)管理密鑰和傳送證書(shū).
ssh-agent的man原文
DESCRIPTION
ssh-agent is a program to hold private keys used for public key authenti-
cation (RSA, DSA, ECDSA). The idea is that ssh-agent is started in the
beginning of an X-session or a login session, and all other windows or
programs are started as clients to the ssh-agent program. Through use of
environment variables the agent can be located and automatically used for
authentication when logging in to other machines using ssh(1).
ssh-agent代理允許使用ssh登陸已經(jīng)配置ssh信任關(guān)系的機(jī)器,并在這些已經(jīng)配置同樣信任關(guān)系的機(jī)器間跳轉(zhuǎn),而不需要再次鑒權(quán).
例如: 在不設(shè)置ssh-agent的情況下 機(jī)器bbb,ccc和ddd上都已經(jīng)配置了aaa機(jī)的公鑰
從aaa機(jī)器登陸bbb后,如果需要登陸ccc或者ddd機(jī)器 就必須是先退出bbb再重新登陸ccc或者ddd
root@aaa$ ssh bbb
root@bbb$ ssh ccc 如果從bbb上登陸ccc, 會(huì)因?yàn)闆](méi)有信任關(guān)系提示要求輸入密碼
root@ccc’s password:
這就是ssh-agent要解決的問(wèn)題,通過(guò)所有服務(wù)器上存放私鑰副本,可以不需要暴露私鑰.
你所需要做的是在aaa上啟動(dòng)ssh-agent代理,然后ssh-add添加默認(rèn)的ssh密鑰.
root@aaa$ ssh-agent
SSH_AUTH_SOCK=/XXXXXXX/XXX/agent.401; export SSH_AUTH_SOCK;
SSH_AGENT_PID=402; export SSH_AGENT_PID;
root@aaa$ ssh-add
不過(guò)你還需要在bbb,ccc和ddd機(jī)器上配置ssh客戶端轉(zhuǎn)發(fā)代理請(qǐng)求,配置/etc/ssh/ssh_config(不同操作系統(tǒng)位置不大一樣)
ForwardAgent Yes
這樣當(dāng)aaa登陸bbb,然后跳轉(zhuǎn)ccc的時(shí)候,bbb會(huì)要求ssh-agent提供有效證書(shū),甚至再繼續(xù)跳轉(zhuǎn)倒ddd上,ccc會(huì)先和bbb協(xié)商轉(zhuǎn)發(fā)請(qǐng)求給aaa的ssh-agent.
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.snjht.com/jiaocheng/4705.html