subhanu
Contributor
Contributor

Fetch proxy settings from vRO to directly use in plugin

Goal: If a proxy is configured on the vRO (any version) then I need to fetch those settings and credentials (if any) then use those properties to route all the request of my plugin from that proxy server.

Problem: We cannot find any way to fetch the proxy settings and credentials that are set up in the vRO.

Tags (2)
0 Kudos
4 Replies
maverix7
VMware Employee
VMware Employee

It has been a long time I've written a plugin, but if there is a proxy configured on the vRO server, it should be available as part of environment variables. Did you try with accessing these in your plugin?

System.getProperty("http.proxyHost");
System.getProperty("http.proxyPort");
0 Kudos
subhanu
Contributor
Contributor

Hi @maverix7 ,

The approach you suggested is correct but I am also facing an issue in setting up the proxy settings in vRO 8.1.

 I used this command to set proxy,

 

 

root@cs-vm00 [ ~ ]# vracli proxy set --host http://10.21.202.244:81​

 

 

But the affected lines are : upstream_proxy_host, upstream_proxy_port. 

 

 

root@cs-vm00 [ ~ ]# vracli proxy show
{
"enabled": true,
"host": "10.244.4.51",
"java-proxy-exclude": "*.local|*.localdomain|localhost|10.244.*|192.168.*|172.16.*|kubernetes|10.21.202.220|",
"java-user": null,
"password": null,
"port": 3128,
"proxy-exclude": ".local,.localdomain,localhost,10.244.,192.168.,172.16.,kubernetes,10.21.202.220",
"scheme": "http",
"upstream_proxy_host": "10.21.202.244",
"upstream_proxy_password_encoded": "",
"upstream_proxy_port": 81,
"upstream_proxy_user_encoded": "",
"user": null,
"internal.proxy.config": "dns_v4_first on \nhttp_port 0.0.0.0:3128\nlogformat squid %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt\naccess_log stdio:/tmp/logger squid\ncoredump_dir /\ncache deny all \nappend_domain .prelude.svc.cluster.local\nacl mylan src 10.0.0.0/8\nacl mylan src 127.0.0.0/8\nacl mylan src 192.168.3.0/24\nacl proxy-exclude dstdomain .local\nacl proxy-exclude dstdomain .localdomain\nacl proxy-exclude dstdomain localhost\nacl proxy-exclude dstdomain 10.244.\nacl proxy-exclude dstdomain 192.168.\nacl proxy-exclude dstdomain 172.16.\nacl proxy-exclude dstdomain kubernetes\nacl proxy-exclude dstdomain 10.21.202.220\nacl proxy-exclude dstdomain .purecloud.com\nalways_direct allow proxy-exclude\nhttp_access allow mylan\nhttp_access deny all\n# End autogen configuration\n# http configuration of remote peer follows\ncache_peer 10.21.202.244 parent 81 0 no-query default \nnever_direct allow all\n",
"internal.proxy.config.type": "non-default"
}​

 

 

Whereas when fetching these settings in the code using:

System.getProperty("http.proxyHost");
System.getProperty("http.proxyPort");

 I get the 10.244.4.51 and 3128 respectively.

Can you please help me with this?

0 Kudos
maverix7
VMware Employee
VMware Employee

This is the way to do it. Follow this checklist of prerequisites to see if you cover them https://docs.vmware.com/en/vRealize-Automation/8.0/Using-and-Managing-Cloud-Assembly/GUID-C983585B-0...

 

0 Kudos
subhanu
Contributor
Contributor

Hi @maverix7,

I followed the steps but the proxy host and port didn't updated.
I also used :
vracli proxy apply command

Any idea were I could go wrong?

0 Kudos