是否可以使用 curl 获取目录中的所有文件?到目前为止,这是我的字符串:
curl --ftp-ssl -k ftp://user:pass@IP
Run Code Online (Sandbox Code Playgroud)
这将列出用户 FTP 目录中的文件,如何调整此字符串以获取(RETR)远程目录中的所有文件?
在全新安装的 Ubuntu 上,使用 wget 时出现以下错误:
wget https://test.sagepay.com
--2012-03-27 12:55:12-- https://test.sagepay.com/
Resolving test.sagepay.com... 195.170.169.8
Connecting to test.sagepay.com|195.170.169.8|:443... connected.
ERROR: cannot verify test.sagepay.com's certificate, issued by `/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA':
Unable to locally verify the issuer's authority.
To connect to test.sagepay.com insecurely, use `--no-check-certificate'.
Run Code Online (Sandbox Code Playgroud)
我试过安装 ca-certificates 并配置 ca-certs,它们似乎都设置在 /etc/ssl/certs.conf 中。
cURL 也存在同样的问题:
curl https://test.sagepay.com
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify …Run Code Online (Sandbox Code Playgroud) 目标:连接到Exchange服务器(EWS)
方法:卷曲
的问题:无法获得认证(NTLM),请求返回401 1
似乎有一个古老的、有据可查的2问题始于 cURL 从 OpenSSL 到 NSS 的转移。我读到 NTLM 的实现依赖于 OpenSSL,因此这一举动破坏了 NTLM 身份验证。
问题如下所示,但重要的部分似乎是返回的401和gss_init_sec_context()下面的部分。
我不明白的是我当前的版本:
libcurl/7.22.0 OpenSSL)我不确定如何解决这个问题。我可以找到很多关于这个问题的旧(主要是 2010 年)参考,但没有什么新的,当然也没有解决方案。我知道提供的参考资料(参见2)表明这可能适用于旧版本(7.19),但我无法(也不愿意)降级到该版本。
交换通信 (EWS) 的几个实现使用 cURL 来检索 EWS 文件(wsdl 等),所以我确信必须有一种工作方法,但我找不到它。有谁知道我能做什么?我是否有另一个错误,我是否对事实的解释有误,这是否仍然与链接中提供的情况相同并且永远不会修复?
1错误是这样的:
curl https://*DOMAIN*/Exchange.asmx -w %{http_code} --ntlm -u *USERNAME* --verbose --show-error
Enter host password for user '*USERNAME':
* About to connect() to DOMAIN port …Run Code Online (Sandbox Code Playgroud) 我正在一个使用很多这样的命令的平台上工作:
ssh login@server.com 'curl http://some_server/script.sh | bash'
这对于远程执行脚本来说非常干净和方便,但是,无论如何我都看不到获取脚本的输出/退出代码。任何人都可以找出一些方法来确保脚本已正确执行(从启动 ssh 的主机的角度来看)。
我有一个问题,即使主机名存在于 /etc/hosts 中,也会从 DNS 中查找主机名。
我有以下配置:
/etc/host.conf:
order hosts,bind
Run Code Online (Sandbox Code Playgroud)
/etc/nsswitch.conf:
hosts: files dns
Run Code Online (Sandbox Code Playgroud)
/etc/resolv.conf:
nameserver <nameserver one>
nameserver <nameserver two>
Run Code Online (Sandbox Code Playgroud)
主机上运行的应用程序会发出一些内部和外部 API 请求。
从 tcpdump 中,我看到了对 /etc/hosts.conf 中列出的一些内部服务主机名的 DNS 查询。我正在使用的 tcpdump 命令是:
tcpdump -tqAlU -s0 port 53 and host <nameserver one>
Run Code Online (Sandbox Code Playgroud)
在转储中,我看到如下请求:
IP 10.0.80.11.domain > app004-private.51308: UDP, length 102
E...I2..>...
.P.
.........I.1E...:...Q.. localhost............ ..@.a.root-servers.net..nstld.verisign-grs.com.w..
IP app004-private.33828 > 10.0.80.11.domain: UDP, length 39
E..Ca.@.@.B.
.2.
.P..$.5./..3e.......... localhost.site.com.....
IP 10.0.80.11.domain > app004-private.33828: UDP, length 96
E..|....>.T;
.P.
.2..5.$.hU.3e.......... localhost.site.com................-.ns10.dnshost.com...dns.8w.............u.....
Run Code Online (Sandbox Code Playgroud)
请注意,localhost 正在发送到 DNS 以及 …
我正在尝试克隆刚刚完全开源的 atom 存储库,但遇到了一些麻烦。
尝试访问git clone存储库会产生 SSL 错误:
wug@wugputer:/src/test$ git clone https://github.com/atom/atom.git
Cloning into atom...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/atom/atom.git/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)
谷歌搜索表明这是一个失败的 CURL 调用,我可以设置一个环境变量来获取更多信息,但它没有显示任何特别有用的信息:
wug@wugputer:/src/test$ GIT_CURL_VERBOSE=1 git clone https://github.com/atom/atom.git
Cloning into atom...
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to proxy proxy.wugcorp.com port 3128 (#0)
* Trying 10.1.2.3... * Connected to proxy.wugcorp.com …Run Code Online (Sandbox Code Playgroud) 在我的专用服务器(由 OVH 托管)上,运行全新安装的 Ubuntu 14.04,curl 和 wget 需要大约 10 秒才能完成一个简单的请求。
$ curl -v google.com
* Rebuilt URL to: google.com/
* Hostname was NOT found in DNS cache
Run Code Online (Sandbox Code Playgroud)
只有在 10 秒后它才会真正返回一些东西。所以我决定在这个上运行strace:
write(2, "Hostname was NOT found in DNS ca"..., 36) = 36
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 3
close(3) = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f0a24fb8000
mprotect(0x7f0a24fb8000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f0a257b7f70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f0a257b89d0, tls=0x7f0a257b8700, child_tidptr=0x7f0a257b89d0) = 5047
poll(0, 0, 4) = 0 (Timeout)
poll(0, 0, 8) …Run Code Online (Sandbox Code Playgroud) 我已经在这个问题上浪费了几天时间,希望它能激发某人的想法。
我正在使用 Powershell 脚本将多个系统集成在一起。我连接到的两个服务之一(托管 JIRA)可以从我的本地系统正常访问,但是从我的一个 VM 运行时脚本会失败。我偶然发现,如果我打开/刷新服务器上的浏览器以获取该主机的 HTTPS URL,那么脚本将能够在此后大约 20-30 秒内通过 HTTPS 访问 API。
当我远程访问服务器并从 powershell 控制台尝试此操作时,我收到超时错误。然后我验证了 cUrl 发生了相同的行为(下面包含详细输出)。使用该域刷新浏览器后,两者都可以在短时间内访问 HTTPS URL。在 SSL 协商之前的初始连接似乎超时。
代表 PoSH 命令:
Invoke-RestMethod -Method Get -Uri " https://MYDOMAIN.atlassian.net/rest/api/2/issue/PLPT-1?fields=key,id,status " -Headers @{"Authorization" = "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('USERNAME:PASSWORD'))}
代表 cUrl 命令:
curl.exe " https://MYDOMAIN.atlassian.net/rest/api/2/issue/PLPT-1?fields=key,id,status " -u "USERNAME:PASSWORD" -v -X GET
我在这方面做了很多挖掘,我很难过。我确实尝试使用 Wireshark 进行更深入的挖掘,但是我已经好几年没有使用数据包嗅探器了,而且我已经生疏了,不得不学习 UI。
以下是我在尝试隔离问题时能想到的问题/答案:
https://google.com/ 没有超时工作正常https://localhost/... 没有超时工作正常像大多数其他人一样,我们的存储库服务器需要尽快禁用 SSLv3(和 v2)。
然而,这样做似乎破坏了我们的 git 客户端——至少,在 RHEL5 上(来自我的 FreeBSD 桌面的连接工作正常)。即使是最新的 git (2.1.2) 也失败了,将 OpenSSL 库升级到供应商的最新版本也无济于事。
然而!相同的 git-client 对 github.com 工作得很好——而且 github.com 也已经禁用了 SSLv3。通过反复试验,我将我们服务器的(Apache)SSL 配置设置为与 github 的配置相匹配:
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite "AES128-SHA AES256-SHA RC4-SHA"
Run Code Online (Sandbox Code Playgroud)
通过sslscan在我们的服务器和 github 上运行,我得到了接受和拒绝的相同密码列表。但是 git 继续失败:
% git clone https://git.example.net/git/puppet-hiera
Cloning into 'puppet-hiera'...
* Couldn't find host git.example.net in the .netrc file, using defaults
* About to connect() to git.example.net port 443
* Trying 10.89.8.27... * connected
* Connected to git.example.net (10.89.8.27) …Run Code Online (Sandbox Code Playgroud) 检查指定 URL 是否有效的最快方法是什么?(以 OK http 状态代码响应)?
现在我正在使用 curl,但我有一堆 URL 需要循环测试,所以我正在寻找最快的解决方案。
除了 wget 之外还有其他选项要检查吗?