我正在使用openconnect连接到VPN。 以sudo openconnect -v -u anaphory vpn-gw1.somewhere.net启动客户端时,可以在inputGROUP和密码后进行连接。
# openconnect -v -u anaphory vpn-gw1.somewhere.net […] XML POST enabled Please enter your username and password. GROUP: [Anyconnect-VPN|CLUSTER-DLCE|Clientless]:CLUSTER-DLCE POST https://vpn-gw1.somewhere.net Got HTTP response: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 […]
但是,当我在命令行上指定相同的组名时,连接将失败,并显示“无效的主机条目”消息。
# openconnect -v -g CLUSTER-DLCE -u anaphory vpn-gw1.somewhere.net […] XML POST enabled Please enter your username and password. Password:XML POST enabled Invalid host entry. Please re-enter. Failed to obtain WebVPN cookie
我是否需要对组名称做任何魔术,或者我如何才能find如何使这个工作?
事实上,user2000606没有给出答案导致成功。
发送到ASA的HTTP消息有所不同,具体取决于您如何select一个组,VPN网关可能会挑剔。
这是我openconnect基本要求
openconnect -v --printcookie --dump-http-traffic \ --passwd-on-stdin \ -u johnsmith \ vpn.ssl.mydomain.tld
发出这个命令并在提示后提供我想要的VPN组导致下面的HTTP聊天(我只包含了XML文档中看似相关的部分):
[Certificate error, I tell openconnect to continue] Me >> ASA: POST / HTTP/1.1 [...]<group-access>https://vpn.ssl.mydomain.tld</group-access> ASA << ME: HTTP/1.1 200 OK Me >> ASA: POST / HTTP/1.1 [...]<group-access>https://vpn.ssl.mydomain.tld/</group-access><group-select>AnyConnect-MyGroup</group-select> ASA << ME: HTTP/1.1 200 OK Me >> ASA: POST / HTTP/1.1 [...]<auth><username>johnsmith</username><password>secret</password></auth><group-select>AnyConnect-MyGroup</group-select> ASA << ME: HTTP/1.1 200 OK
注意group-select组,并且所有请求都是POST / HTTP/1.1 。 通过提供--authgroup AnyConnect-MyGroup与openconnect的基本调用, openconnect相同的结果。
使用-g AnyConnect-MyGroup而不是--authgroup AnyConnect-MyGroup ,会发生以下情况:
Me >> ASA: POST /AnyConnect-MyGroup HTTP/1.1 [...]<group-access>https://vpn.ssl.mydomain.tld/AnyConnect-MyGroup</group-access> ASA << ME: HTTP/1.1 200 OK [...] <error id="91" param1="" param2="">Invalid host entry. Please re-enter.</error>
请注意,这次我们不告诉服务器group-select ,只是简单地用group-access和HTTP请求来挤压我们的组名。 将组名添加到网关地址时会引发同样的否定结果,即使用vpn.ssl.mydomain.tld/AnyConnect-MyGroup作为openconnect基本调用的最后一行。
试试--authgroup而不是-g
openconnect -v --authgroup CLUSTER-DLCE -u anaphory vpn-gw1.somewhere.net
问候