Providing Access to OpenStack CLI through a Proxy Server
You can make the OpenStack command line interface (CLI) accessible through a proxy server.
To provide access to the OpenStack CLI through a proxy server, you must first set the environment variable for the proxy server in the OpenStack RC file.
For example, if http://proxy-server.samplecorp.com is the URL of the proxy server, and 3128 is the port number, you can edit the OpenStack RC file to specify the URL and port number with the export command as follows.
[bash]export http_proxy=http://proxy-server.samplecorp.com:3128/export https_proxy=http://proxy-server.samplecorp.com:3128/[/bash]
If the proxy server requires a username and password, then add the username and password to the URL.
In general, the export command must have the following format.
[bash] export http_proxy=http://<username>:<password>@<server-ip>:<port>/[/bash]Replace the <username>, <password>, <server-ip>, and <port> with the appropriate values from your configuration.
If one or more OpenStack services can be accessed locally, you can specify the exception with the export command in the OpenStack RC file. For instance, you might want to access OpenStack Glance locally. In this case, you can add the following command to the OpenStack RC file, to access Glance locally.
[bash]glance_endpoint_id=$(openstack endpoint list -f value | awk ‘/glance / { print $1 }’)
glanceIP=$(openstack endpoint show “$glance_endpoint_id” -c publicurl -f value | sed ‘s|http://||’)
export no_proxy=localhost,127.0.0.1,$glanceIP
[/bash]
In the aforementioned command, 127.0.0.1 is your localhost IP and the glance IP address is gathered via the openstack endpoint list command.
Note: If you know the exact IP address of your glance API server, you could directly assign it to glanceIP in the above command, as in glanceIP=<Glance API server IP address>.
The OpenStack RC file can be sourced on the machine where a user wants to run the OpenStack CLI so that the OpenStack CLI is available through the proxy server.
[bash]source <path to saved OpenStack RC file>[/bash]Tip: Alternatively, you can add the aforementioned export commands to the /etc/environments on the machine, on which you want to run the OpenStack CLI.