2014-02-13 90 views
1

我已經讀了一些公鑰認證,但我認爲我錯過了一個關鍵方面。SSH - 在公鑰認證期間需要密碼輸入

我有一臺Ubuntu服務器,我已經配置爲一個Subversion服務器,它接受通過SSH使用非標準端口的SVN連接。因此,要查出來,它會是這樣的:

svn co svn+ssh://[email protected]:12345/repos/public 

現在,我的服務器目前支持基於口令認證和公鑰認證。假設我辦公室的服務器被固定並停住,並且防火牆和所有工作正常,我不必擔心有人將文件從服務器上覆制下來。

對於我的兩臺客戶端便攜式計算機,我生成了公鑰和私鑰對,並已通過ssh-copy-id命令將客戶端的公鑰添加到服務器上的授權密鑰列表中。我現在可以從這些客戶端筆記本電腦無需密碼SSH進入服務器。

雖然這關注我。如果有人闖入我的旅館房間並竊取我的筆記本電腦,那麼他們可以拉硬盤,將~/.ssh的內容複製到單獨的機器,並嘗試輕鬆登錄到我的服務器。如果我只使用基於密碼的身份驗證,並記住密碼或將它們存儲在加密的TrueCrypt存檔中,則安全性更高。

我知道在客戶端創建密鑰對期間,必須輸入密碼。是否有可能要求服務器不僅驗證公鑰,還要求輸入密碼短語?這似乎是一個非常薄弱的​​系統,如果所有這些都需要竊取單個員工的筆記本電腦,並從中複製文件以獲得完整的系統訪問權限。

謝謝。

回答

0

這是在另一個SO網站上覆蓋。

https://serverfault.com/questions/93807/how-do-i-setup-ssh-with-both-private-key-and-password

這裏是例如SSHD服務器腳本。

####################################################### 
### Calomel.org SERVER /etc/ssh/sshd_config 
####################################################### 
# 
Port 22 
Protocol 2 
AddressFamily inet 
#ListenAddress 127.0.0.1 

#See the questions section for setting up the gatekeeper 
#ForceCommand /tools/ssh_gatekeeper.sh 

AllowUsers [email protected] [email protected]* 
AllowGroups calomel 

AllowTcpForwarding yes 
#AuthorizedKeysFile .ssh/authorized_keys (need to be be commented for OpenSSH 5.4) 
Banner /etc/banner 
ChallengeResponseAuthentication no 
Ciphers aes256-ctr,aes192-ctr,aes128-ctr 
ClientAliveInterval 15 
ClientAliveCountMax 3 
Compression yes 
GatewayPorts no 
LogLevel VERBOSE 
LoginGraceTime 50s 
MACs hmac-sha2-512-96,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-256,hmac-sha1-96,hmac-sha1 
MaxAuthTries 6 
MaxStartups 10 
PasswordAuthentication yes 
PermitEmptyPasswords no 
#PermitOpen localhost:80 
PermitRootLogin no 
PermitUserEnvironment no 
PidFile /var/run/sshd.pid 
PrintLastLog yes 
PrintMotd no 
PubkeyAuthentication yes 
StrictModes yes 
Subsystem sftp /usr/libexec/sftp-server 
SyslogFacility AUTH 
TCPKeepAlive no 
UseDNS no 
UseLogin no 
UsePrivilegeSeparation yes 
X11DisplayOffset 10 
X11Forwarding no 
X11UseLocalhost yes 

#Match User anoncvs 
#  X11Forwarding no 
#  AllowTcpForwarding no 
#  ForceCommand cvs server 
# 
####################################################### 
### Calomel.org SERVER /etc/ssh/sshd_config 
####################################################### 
1

您可以使用其他密碼來保護客戶機上的密鑰庫,因此需要解鎖密鑰才能使用密鑰庫,但這是在客戶機上配置的,無法由服務器強制執行。使用SSH-agent您只需要解鎖一次密鑰並在客戶端正在使用時使用它。

相關問題