代码之家  ›  专栏  ›  技术社区  ›  codec

无法创建vmware会话ID

  •  1
  • codec  · 技术社区  · 9 年前

    curl -kv -X POST -H 'Accept: application/json' --basic -u me@abc.co.in:myPass! $VCENTER/rest/com/vmware/cis/session
    

    其中$VCENTER= https://vc

    * Hostname was NOT found in DNS cache
    *   Trying 1.2.3.4...
    * Connected to vc (1.2.3.4) port 443 (#0)
    * successfully set certificate verify locations:
    *   CAfile: none
      CApath: /etc/ssl/certs
    * SSLv3, TLS handshake, Client hello (1):
    * SSLv3, TLS handshake, Server hello (2):
    * SSLv3, TLS handshake, CERT (11):
    * SSLv3, TLS handshake, Server finished (14):
    * SSLv3, TLS handshake, Client key exchange (16):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSL connection using AES256-SHA
    * Server certificate:
    *        subject: O=VMware, Inc.; OU=vCenterServer_2014.12.24_203443; CN=VMware default certificate; emailAddress=support@vmware.com
    *        start date: 2014-12-24 04:44:30 GMT
    *        expire date: 2024-12-22 04:44:32 GMT
    *        issuer: O=VMware, Inc.; OU=vCenterServer_2014.12.24_203443; CN=VC.xyz.co.in; emailAddress=support@vmware.com
    *        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
    * Server auth using Basic with user 'me@xyz.co.in'
    > POST /rest/com/vmware/cis/session HTTP/1.1
    > Authorization: Basic YWthbmtzaGFfamFpbkBwZXJzaXN0ZW50LmNvLmluOmFra2FTZXAyMDE3IQ==
    > User-Agent: curl/7.35.0
    > Host: pt-vc
    > Accept: application/json
    >
    < HTTP/1.1 400 Bad Request
    < Date: Thu, 13 Jul 2017 09:33:40 GMT
    < Connection: close
    < Content-Type: text; charset=plain
    < Content-Length: 0
    <
    * Closing connection 0
    * SSLv3, TLS alert, Client hello (1):
    

    从输出来看,我不确定哪里出了问题,哪里出了问题。这是因为我的密码有一个 ! 哪个需要转换为十六进制等价物?

    1 回复  |  直到 9 年前
        1
  •  2
  •   Kyle Ruddy    9 年前

    感叹号可以作为密码传递。

    curl -kv -X POST -H 'Accept: application/json' --basic -u user@domain.lab:VMware1! https://vcsa01.domain.lab/rest/com/vmware/cis/session
    *   Trying 10.159.13.52...
    * Connected to vcsa01.domain.lab (10.159.13.52) port 443 (#0)
    * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    * Server certificate: VCSA01
    * Server auth using Basic with user 'user@domain.lab'
    > POST /rest/com/vmware/cis/session HTTP/1.1
    > Host: vcsa01.domain.lab
    > Authorization: Basic ZWNrQGNwYnUubGFiOlZNd2FyZTEh
    > User-Agent: curl/7.43.0
    > Accept: application/json
    > 
    < HTTP/1.1 200 OK
    < Date: Thu, 13 Jul 2017 18:47:18 GMT
    < Set-Cookie: vmware-api-session-id=37e6921e6a3905b47ba356aaad19d3d6;Path=/rest;Secure;HttpOnly
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < Content-Type: application/json
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host vcsa01.domain.lab left intact
    {"value":"37e6921e6a3905b47ba356aaad19d3d6"}