我试图在Kerberos中使用curl (针对TM1)。当使用--与卷曲协商时,是否需要一个keytab文件?中的答案似乎非常有用,但是,它仍然对我不起作用。
没有成功的卷曲7.29.0和GSS-谈判
我跟踪了阿维纳什·雷迪的指示
$curl --version
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.44 zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
$/usr/share/centrifydc/kerberos/bin/kinit myuser
Password for myuser@MYREALM:
$/usr/share/centrifydc/kerberos/bin/klist
Ticket cache: FILE:/tmp/krb5cc_100123
Default principal: myuser@MYREALM
Valid starting Expires Service principal
01/24/2020 12:11:30 01/24/2020 22:11:30 krbtgt/MYREALM@MYREALM
renew until 01/25/2020 12:11:26WattsInABox说他成功地使用了卷曲7.29.0,但对我来说,它似乎不起作用:
$curl -ik -vvv --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt https://mytm1server/api/v1/Configuration
* About to connect() to mytm1server port 80 (#0)
* Trying 10.48.199.126...
* Connected to mytm1server (10.10.100.100) port 80 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* subject: CN=TM1Server,OU=TM1,O=www.ibm.com,C=US
* start date: Mar 31 18:50:22 2015 GMT
* expire date: Mar 27 18:50:22 2035 GMT
* common name: TM1Server
* issuer: CN=TM1Server,OU=TM1,O=www.ibm.com,C=US
* Server auth using Basic with user ''
> GET /api/v1/Configuration HTTP/1.1
> Authorization: Basic Og==
> User-Agent: curl/7.29.0
> Host: mytm1server:80
> Accept: */*
> Cookie: TM1SessionId=iJiQkqUDOEmdvN6A6_tHfQ
>
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Content-Type: text/plain
Content-Type: text/plain
< Content-Length: 0
Content-Length: 0
< Connection: keep-alive
Connection: keep-alive
< OData-Version: 4.0
OData-Version: 4.0
* gss_init_sec_context() failed: : Success
< WWW-Authenticate: Negotiate, Basic realm="TM1"
WWW-Authenticate: Negotiate, Basic realm="TM1"
<
* Connection #0 to host mytm1server left intact请注意这个非常有用的gss_init_sec_context() failed: : Success ;-)
我还尝试获得一张服务票,而不是TGT:
$/usr/share/centrifydc/kerberos/bin/kinit -S tm1s/mytm1server
Password for myuser@MYREALM:
$/usr/share/centrifydc/kerberos/bin/klist
Ticket cache: FILE:/tmp/krb5cc_100771
Default principal: myuser@MYREALM
Valid starting Expires Service principal
01/24/2020 13:37:52 01/24/2020 23:37:52 tm1s/mytm1server@MYREALM
renew until 01/25/2020 13:37:46也没有成功:
$curl -ik --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt https://mytm1server/api/v1/Configuration
HTTP/1.1 401 Unauthorized
Content-Type: text/plain
Content-Length: 0
Connection: keep-alive
OData-Version: 4.0
WWW-Authenticate: Negotiate, Basic realm="TM1"没有成功的curl 7.48.0和GSS和SPNEGO
在另一台具有curl7.48.0的机器上,我遵循了迈克尔-O的指示 (除了),即我试图不使用keytab文件(我们将无法获得该文件):
$ curl --version
curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1c zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.8.5/openssl/zlib nghttp2/1.33.0
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL Metalink
$/usr/share/centrifydc/kerberos/bin/kinit myuser
Password for myuser@MYREALM:
$/usr/share/centrifydc/kerberos/bin/klist
Ticket cache: FILE:/tmp/krb5cc_100123
Default principal: myuser@MYREALM
Valid starting Expires Service principal
01/24/2020 15:19:34 01/25/2020 01:19:34 krbtgt/MYREALM@MYREALM
renew until 01/25/2020 15:19:31
$curl -ik --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt https://mytm1server/api/v1/Configuration
* Trying 10.10.100.100...
* TCP_NODELAY set
* Connected to mytm1server (10.10.100.100) port 80 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; O=www.ibm.com; OU=TM1; CN=TM1Server
* start date: Mar 31 18:50:22 2015 GMT
* expire date: Mar 27 18:50:22 2035 GMT
* issuer: C=US; O=www.ibm.com; OU=TM1; CN=TM1Server
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /api/v1/Configuration HTTP/1.1
> Host: mytm1server:80
> User-Agent: curl/7.61.1
> Accept: */*
> Cookie: TM1SessionId=m0uTI8ceIVM2TamOFMxPHg
>
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Content-Type: text/plain
Content-Type: text/plain
< Content-Length: 0
Content-Length: 0
< Connection: keep-alive
Connection: keep-alive
< OData-Version: 4.0
OData-Version: 4.0
< WWW-Authenticate: Negotiate, Basic realm="TM1"
WWW-Authenticate: Negotiate, Basic realm="TM1"
<
* Connection #0 to host mytm1server left intact注意这里没有gss_init_sec_context() failed: : Success
无论我是否手动export KRB5CCNAME=/tmp/krb5cc_100123 (不应该是必需的),它也不起作用:
$export KRB5CCNAME=/tmp/krb5cc_100123
$curl -ik -u : -b ~/cookiejar.txt -c ~/cookiejar.txt https://mytm1server/api/v1/Configuration
HTTP/1.1 401 Unauthorized
Content-Type: text/plain
Content-Length: 0
Connection: keep-alive
Set-Cookie: TM1SessionId=mGR4OPSynQmCBIRd_B_L7g; Path=/api/; HttpOnly; Secure
WWW-Authenticate: Negotiate, Basic realm="TM1"当然,现在人们可能会问用户是否可以登录。但是使用TM1的官方客户端,集成登录可以完美地工作。
是否有人知道出了什么问题,或者知道如何获得更多的调试信息?
更新#1
我找到了这篇博客文章,它似乎也在做同样的事情。不过,我注意到服务器使用WWW-Authenticate: Negotiate进行响应,而TM1使用WWW-Authenticate: Negotiate, Basic realm="TM1"进行响应。因此,我构建了一个虚拟应用程序来模拟这两种情况,并猜猜我发现了什么:在只协商的情况下,curl正确地发送第二个请求。然而,在TM1的情况下,情况并非如此。
发布于 2020-01-28 16:00:49
结果是,在服务器响应中,截至7.64.0 卷曲不支持逗号分隔的header值。
所以这不管用:
WWW-Authenticate: Negotiate, Basic realm="TM1"虽然这样做:
WWW-Authenticate: Negotiatehttps://stackoverflow.com/questions/59898525
复制相似问题