2014-02-13 88 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您只需要解锁一次密钥并在客户端正在使用时使用它。

相关问题