cURL 请求挂起

时间:2021-01-10 23:37:11

标签: batch-file ssl curl

我一直在为工作场所的一些自动化编写批处理脚本。我们有一个 Watchguard 防火墙,我需要批量登录。我目前的解决方案是发送带有所需详细信息的 cURL POST 请求。这就是我所说的:

set address="https://watchguard.<domain>:4100/wgcgi.cgi"
set data="fw_username=<username>&fw_password=<password>&fw_domain=<domain>&submit=Login&action=fw_logon&fw_logon_type=logon"
curl -k -m 10 -X POST -d %data% %address%

出于安全原因,我已将域、用户名和密码留在了外面。这几乎一直有效,但偶尔 cURL 请求会无限期挂起,尽管使用了 -m 标志。到目前为止,只有在计算机的 8 小时 Watchguard 会话到期后才会发生这种情况,尽管这并不总是会导致问题。一旦出现问题,它就会继续发生,直到机器重新启动。

此问题似乎与 Internet Explorer 上的类似问题有关。 Internet Explorer 在尝试打开任何网页时无限期挂起。 Chrome、Edge 和 Firefox 加载网页没有问题。由于这个线程,我被告知 cURL 和 Internet Explorer 之间的关联:https://curl.se/mail/lib-2012-10/0184.html

当我运行 curl -v -m 10 -X POST -d %data% %address% 时(使用 -v 但没有 -k)。这样做给了我以下输出:

*   Trying <Firebox IP>...
* TCP_NODELAY set
* Connected to watchguard.<domain> (<Firebox IP>) port 4100 (#0)
* schannel: SSL/TLS connection with watchguard.<domain> port 4100 (step 1/3)
* schannel: checking server certificate revocation

当我运行 curl -v -k -m 10 -X POST -d %data% %address% 时(使用 -v)。这样做给了我以下输出:

*   Trying <Firebox IP>...
* TCP_NODELAY set
* Connected to watchguard.<domain> (<Firebox IP>) port 4100 (#0)
* schannel: SSL/TLS connection with watchguard.<domain> port 4100 (step 1/3)
* schannel: disabled server certificate revocation checks
* schannel: verifyhost setting prevents Schannel from comparing the supplied target name with the subject names in server certificates.

我能做些什么来确保它成功通过吗?

卷曲版本:

curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL

守望者版本: WatchguardFireBox M670 运行 Fireware OSv12.6.2.B631387

0 个答案:

没有答案