Skip to content

vmw-cli and proxy on "native" npm installation does not work w/ proxy #9

@vMarkus

Description

@vMarkus

I am trying to get vmw-cli working over proxy server

what I did:

  • setup dedicated Photon OS 4.0 VM with working squid proxy for apt and curl
  • setup second Ubuntu 21 VM with no access to internet, only connection is to dedicated vm with squid proxy (dedicated vSwitch for Photon VM and Ubuntu VM on unrouted network)
  • configured Ubuntu VM to use proxy for apt and curl, verify working setup

set npm proxy via .npmrc file for default user and root and logging out and back in again

install vmw-cli via npm as described (npm install vmw-cli --global)

vmw-cli ls fails, no local dns resolution (should be performed over proxy?):

root@ubuntu-npm:~# vmw-cli ls
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
(node:5811) UnhandledPromiseRejectionWarning: RequestError: getaddrinfo EAI_AGAIN customerconnect.vmware.com
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/vmw-cli/node_modules/got/dist/source/core/index.js:956:111)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:326:22)
    at ClientRequest.origin.emit (/usr/local/lib/node_modules/vmw-cli/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at TLSSocket.socketErrorListener (_http_client.js:427:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
(node:5811) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5811) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

working curl over proxy

root@ubuntu-npm:~# curl web.de
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://web.de/">here</a>.</p>
</body></html>

Squid working with proxy and no local dns resolution on air-gapped Ubuntu VM

root@ubuntu-npm:~# ping web.de
ping: web.de: Temporary failure in name resolution

Squid access.log does not show any activity, when I run vmw-cli, so the proxy configuration somehow is not picked up,

This time with /etc/hosts setting for customerconnect.vmware.com to point to ip address to rule out dns resolution issue

root@ubuntu-npm:~# vmw-cli ls
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
[GET] https://customerconnect.vmware.com/channel/public/api/v1.0/products/getProductsAtoZ
(node:5919) UnhandledPromiseRejectionWarning: RequestError: connect ENETUNREACH 23.53.168.34:443 - Local (0.0.0.0:0)
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/vmw-cli/node_modules/got/dist/source/core/index.js:956:111)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:326:22)
    at ClientRequest.origin.emit (/usr/local/lib/node_modules/vmw-cli/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at TLSSocket.socketErrorListener (_http_client.js:427:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    at internalConnect (net.js:924:16)
    at defaultTriggerAsyncIdScope (internal/async_hooks.js:364:12)
    at GetAddrInfoReqWrap.emitLookup [as callback] (net.js:1060:9)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:68:8)
(node:5919) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5919) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Not sure if this is a vmw-cli issue or more a nodejs/npm issue?
Any pointers welcome to get this working for air-gapped deployments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions