【问题标题】:how to store server key permanently? openconnect如何永久存储服务器密钥?打开连接
【发布时间】:2015-09-15 18:32:37
【问题描述】:

有没有办法在连接成功后存储服务器密钥, ssh 是怎么做的?

无论我连接多少次,我都必须输入“yes”才能 接受服务器密钥。我希望它会被接受并永远保存。

###############################
amir@amirpc:~$ sudo openconnect uk.cisadd.com -u myusername
POST https://uk.cisadd.com/
Attempting to connect to server xxx.xxx.xxx.xxx:443
SSL negotiation with uk.cisadd.com
Server certificate verify failed: signer not found

Certificate from VPN server "uk.cisadd.com" failed verification.
Reason: signer not found
Enter 'yes' to accept, 'no' to abort; anything else to view: 

Connected to HTTPS on XXX.XXX.XXX.XXX
###############################

可以编写 bash 脚本来运行 openconnect 并转义

【问题讨论】:

  • 也许 --no-cert-check ?但是您的服务器证书验证失败的事实令人担忧

标签: bash terminal vpn


【解决方案1】:

最好的方法是第一次登录服务器时,像这样将 --servercert 保存在剪贴板中

echo "password" | sudo openconnect  -u username  uk2.cisadd.com --servercert sha25:xxxxxxx

【讨论】:

    【解决方案2】:

    我敢打赌,您可以使用选项 --no-cert-check 或拥有有效的 SSL 证书来做到这一点:

    sudo openconnect --no-cert-check uk.cisadd.com -u myusername
    

    【讨论】:

    • 使用 openconnect v7.08,他们似乎删除了 --no-cert-check 选项:The --no-cert-check option was insecure and has been removed.
    • 所以你现在需要一个有效的证书
    【解决方案3】:

    如果您不关心解密流量,可以使用--no-cert-check。否则使用--servercert=FINGERPRINT,其中 FINGERPRINT 是证书信息中显示的“服务器密钥哈希”。

    【讨论】:

    • 不再支持--no-cert-check 选项。
    【解决方案4】:

    我在 OpenWRT 上遇到了同样的问题,我的解决方案是安装“ca-certificates”包。

    # opkg install ca-certificates
    

    一旦我这样做了,openconnect 就会停止标记“未找到签名者”。

    此解决方案的好处是您使用了预期的证书并限制了破坏网络的机会。

    【讨论】:

      【解决方案5】:

      openconnect 版本 7.0.6 以后不再有 --no-cert-check 选项。 就这样,我做了下面的过程,作为一个shell脚本绕过了这个问题:

      首先,你需要服务器认证,你可以找到它:

      echo <password> | sudo openconnect <hostname> --user=<username> --passwd-on-stdin --no-dtls   
      

      然后你必须像这样从预期的输出中找到--servercert 值:

      ...
      SSL negotiation with xxxxxxx
      Server certificate verify failed: signer not found
      
      Certificate from VPN server "xxxxxxx" failed verification.
      Reason: signer not found
      To trust this server in future, perhaps add this to your command line:
          --servercert pin-sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  <--- Here it is
      Enter 'yes' to accept, 'no' to abort; anything else to view: fgets (stdin): Operation now in progress
      

      最后,复制认证代码后,您可以编写 bash 脚本如下:

      echo <password> | sudo openconnect <hostname> --user=<username> --passwd-on-stdin --no-dtls --servercert pin-sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-02-16
        • 1970-01-01
        • 2022-12-09
        • 1970-01-01
        • 1970-01-01
        • 2014-06-16
        • 2023-03-16
        相关资源
        最近更新 更多