SSH-在公钥身份验证过程中要求输入密码短语



我读了一些关于公钥身份验证的内容,但我认为我缺少一个关键方面。

我有一个Ubuntu服务器,我已经配置为作为Subversion服务器工作,它使用非标准端口通过SSH接受SVN连接

svn co svn+ssh://user@example.com:12345/repos/public

现在,我的服务器目前同时支持基于密码的身份验证和公钥身份验证。假设我办公室的服务器已经用螺栓固定,防火墙和所有东西都在工作,我就不必担心有人从服务器上复制文件了。

对于我的两台客户端笔记本电脑,我已经生成了公私密钥对,并通过ssh-copy-id命令将客户端的公钥添加到服务器上的AuthorizedKeys列表中。我现在可以通过SSH从这些客户端笔记本电脑进入服务器,而无需密码。

不过这让我很担心。如果有人闯入我的酒店房间偷走了我的笔记本电脑,那么他们只需拔出硬盘,将~/.ssh的内容复制到另一台机器上,然后尝试毫不费力地登录我的服务器。如果我只是使用基于密码的身份验证,只需记住密码或将其存储在加密的TrueCrypt档案中,就会安全得多。

我知道在客户端上创建密钥对的过程中,必须输入一个密码短语。是否可以要求服务器不仅验证公钥,还要求输入密码短语?如果只需要窃取一名员工的笔记本电脑并从中复制一个文件以获得全面的系统访问权限,那么这似乎是一个非常薄弱的系统。

谢谢。

您可以使用额外的密码短语来保护客户端上的密钥库,因此需要解锁密钥才能使用它,但这是在客户端上配置的,服务器无法强制执行。使用SSH代理,您只需要解锁一次密钥,并在客户端使用期间使用它。

另一个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 calomel@10.10.10.3 calomel@192.168.*
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
#######################################################

最新更新