Openconnect for Cisco VPN 无法识别私钥文件 - asn1 编码例程:ASN1_CHECK_TLEN:错误标签

Ale*_*war 5 linux vpn cisco-vpn-client vpnc

我正在尝试使用我的Synology DS212 NAS 盒同时充当我公司 VPN 的 VPN 网关。遗憾的是,他们只使用Cisco ASA,并且让事情变得更加复杂,我们必须使用个人证书(这当然更安全,但使用起来更复杂\xe2\x80\xa6)。

\n\n

所以我从http://www.infradead.org/openconnect/编译了OpenConnect v4.06 。作为一个非常基本的测试,我尝试通过手动调用 openconnect 来构建连接,传递密钥和证书文件,如下所示:

\n\n
/lib/ld-linux.so.3 --library-path /opt/lib \\\n /opt/openconnect/sbin/openconnect \\\n  --certificate=$VPN_CFG/alexander.crt \\\n  --sslkey=$VPN_CFG/alexander.key \\\n  --cafile=$VPN_CFG/Company_VPN_CA.crt \\\n  --user=alexander --verbose <ip>:443\n
Run Code Online (Sandbox Code Playgroud)\n\n

它失败 :(

\n\n
Attempting to connect to <ip>:443\nUsing certificate file $VPN_CFG/alexander.crt\nUsing client certificate \'/CN=alexander@tech.doma.in/OU=Company VPN\'\n5919:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1315:\nLoading private key failed (see above errors)\nLoading certificate failed. Aborting.\nFailed to open HTTPS connection to <ip>\nFailed to obtain WebVPN cookie\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我在 Ubuntu 12.04 机器上使用相同的证书/密钥文件运行相同的命令时,它可以工作:

\n\n
openconnect \\\n --certificate=$VPN_CFG/alexander.crt \\\n  --sslkey=$VPN_CFG/alexander.key \\\n  --cafile=$VPN_CFG/Company_VPN_CA.crt \\\n  --user=alexander --verbose <ip>:443\nAttempting to connect to <ip>:443\nUsing certificate file $VPN_CFG/alexander.crt\nExtra cert from cafile: \'/CN=Company AG VPN CA/O=Company AG/L=Zurich/ST=ZH/C=CH\'\nSSL negotiation with <ip>\nServer certificate verify failed: self signed certificate\n\nCertificate from VPN server "<ip>" failed verification.\nReason: self signed certificate\nEnter \'yes\' to accept, \'no\' to abort; anything else to view: yes\nConnected to HTTPS on <ip>\nGET https://<ip>/\n[\xe2\x80\xa6]\n
Run Code Online (Sandbox Code Playgroud)\n\n

那么\xe2\x80\xa6 NAS上的错误是这样的:

\n\n

5919:错误:0D0680A8:asn1 编码例程:ASN1_CHECK_TLEN:错误标签:tasn_dec.c:1315:

\n\n

有什么想法,是什么原因造成的?

\n\n

在 Syno 上,我使用 OpenConnect 4.06。在 Ubuntu 上,我也刚刚编译并安装到自定义位置 OpenConnect 4.06。

\n\n

谢谢,\n亚历山大

\n

小智 0

我建议您首先尝试通过普通的 Linux 发行版(例如 Ubuntu)连接到 Cisco AnyConnect 网络。

$ sudo openconnect http://$gateway/Full-Access --script /etc/vpnc/vpnc-script --user $USERNAME

这就是我通过 openconnect 登录 AnyConnect 安装的方式。

您需要安装 openconnect 和 vpnc 才能正常工作。