anchore / anchore-cli

Simple command-line client to the Anchore Engine service
Apache License 2.0
114 stars 55 forks source link

ANCHORE_CLI_URL truncated? #145

Closed madchap closed 3 years ago

madchap commented 3 years ago

Hi,

I just installed from master (0.8.2) from this repo, following the instructions to install from source.

Prior to this version, I used 0.7.2 - which was working fine. On the other end, Anchore Enterprise 2.4.1.

However, it seems the ANCHORE_CLI_URL is not working as it used to somehow, and I am getting a 404? the /v1/ path does not seem to be taken into account. Other envvars for user and password are set accordingly.

$ ANCHORE_CLI_URL=https://anchore-api.xxxx.com/v1/ anchore-cli  --debug --as-account=security image add jenkins/jenkins:2.263.1-lts-centos 
DEBUG:anchorecli.clients.apiexternal:As Account = security
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): anchore-api.xxxx.com:443
DEBUG:urllib3.connectionpool:https://anchore-api.xxxx.com:443 "GET / HTTP/1.1" 404 146
Error: could not access anchore service (user=yyyy url=https://anchore-api.xxxx.com): "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"

I can reach the service with curl

curl -v https://anchore-api.xxxx.com/v1/
*   Trying 10.131.186.246:443...
* Connected to anchore-api.xxxx.com (10.131.xxx.xxx) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=anchore-api.xxxx.com
*  start date: Nov 10 17:49:19 2020 GMT
*  expire date: Feb  8 17:49:19 2021 GMT
*  subjectAltName: host "anchore-api.xxxx.com" matched cert's "anchore-api.xxxx.com"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55ea21f34f00)
> GET /v1/ HTTP/2
> Host: anchore-api.xxxx.com
> user-agent: curl/7.74.0
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< date: Mon, 04 Jan 2021 22:30:09 GMT
< content-type: application/json
< content-length: 5
< strict-transport-security: max-age=15724800; includeSubDomains
< 
"v1"
* Connection #0 to host anchore-api.xxxx.com left intact

I don't think I am doing anything stupid, but I could :-)

Cheers.

madchap commented 3 years ago

I just re-installed 0.7.2 using the same installation method, and all works as expected.

zhill commented 3 years ago

I'm using v0.9.1 dev branch and not seeing that behavior. What version of python are you using?

nightfurys commented 3 years ago

Verified with v0.9.1 and I don't see this behaviour either. Closing this ticket for now. @madchap feel free to open a new issue if you continue seeing the error