SonarQube Proxy Configuration, Tricky - proxy

I cannot get the proxy configuration to work for SonarQube 4.0 so that I can install plugins.
When i open http://localhost:9000/updatecenter/available it displays the error: "Not connected to update center. Please check your internet connection and logs."
In sonar.log I read: "org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://update.sonarsource.org/update-center.properties]. Response code: 403"
In sonar.properties I configured it with the same proxy which I use for other programs:
sonar.updatecenter.activate=true
http.proxyHost=<host>
http.proxyPort=<port>
http.proxyUser=<username>
http.proxyPassword=<password>
I tried the same to configure in wrapper.properties, but it didn't work either by the way.
For the proxy host I tried the short and the full name. For the username I tried just the username and with <DOMAINNAME>\<username> and <DOMAINNAME>\\<username>.
Nothing of it worked. Any ideas?

My proxy configuration works and looks the following way:
http.proxyHost=proxy.domain.de
http.proxyPort=8888
Note that there is no "http://" or anything else before the URL.
Also, I do not use proxy authentication, so I left "proxyUser" and "proxyPassword" commented out.

For those running SonarQube in Docker, I had no luck with any suggestion mentioned here. But I found following solution that worked for me (here):
docker run -d sonarqube -Dhttp.proxyHost=<myproxy.url.com> -Dhttp.proxyPort=<port>
and equivalent of this in a docker-compose notation:
services:
sonarqube:
image: sonarqube
command: -Dhttp.proxyHost=<myproxy.url.com> -Dhttp.proxyPort=<port>

Just an information: I had this problem also.
I can see the PlugIns but cannot download it. The problem is, you have to add this line into your sonar.properties, for the https:
# https-proxy
sonar.web.javaAdditionalOpts=-Dhttps.proxyHost=xxxxx -Dhttps.proxyPort=xxxx -Dhttps.proxyUser=xxxx -Dhttps.proxyPassword=xxxx

I used the official documentation and it works:
Using the Update Center behind a Proxy
http.proxyHost=<your.proxy.host>
http.proxyPort=<yout.proxy.port>
Regards,

At sonar.properties set the proxy without "http://", only http.proxyHost=myproxy.domain.pt
Another suggestion is to also add this lines on wrapper.conf:
wrapper.java.additional.3=-Dhttp.proxySet=true
wrapper.java.additional.4=-Dhttp.proxyHost=myproxy.domain.pt
wrapper.java.additional.5=-Dhttp.proxyPort=myproxy.port
wrapper.java.additional.6=-Dhttps.proxyHost=myproxy.domain.pt
wrapper.java.additional.7=-Dhttps.proxyPort=myproxy.port
Careful if you have a docker volume, remove it before deploy the new one with this configuration, or otherwise it will keep the original configuration

Appart from http, don't forget to set your https proxy configuration in sonar.properties (update server is behind HTTPS):
https.proxyHost=<host>
https.proxyPort=<port>
https.proxyUser=<username>
https.proxyPassword=<password>

Related

"c8ycli server" returns an error when try to connect behind the proxy

I need to use cumulocity behind the proxy server. Therefore, I have set the proxy addresses using: "npm set proxy" and "npm set https-proxy". Now I am able to run a standard angular project and it works fine.
But when I create a c8y project and run it using "c8ycli server -u ...", I get this error by each request:
[HPM] Error occurred while trying to proxy request /tenant/loginOptions from localhost:9000 to https://....com (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Does c8ycli use npm proxy settings? How can I set proxy address for c8ycli?
I think it has nothing to do with c8y itself. You should try setting the proxy manually with npm:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Taken from here
Hope this help!
Edit:
Checking at the c8y tool (/usr/local/lib/node_modules/cumulocity-tools in my case) I notice they are using express (lib/devserver/server.js) when you run the server command. In that file they use their own proxy (lib/devserver/proxy.js) settings to resolve the localhost to the tenant's url.
As they are using express I think you can change those file to set you proxy configurations. I have not much experience with express but I found some information searching
express behind-proxies
nodejs-express-why-should-i-use-app-enabletrust-proxy
using-app-set-to-set-trust-proxy
Good luck!

problems with proxy in vscode

I'm testing VSCode by first time and I configure my proxy in settings.json as recommended:
"http.proxy": "http://domain\user:pass#myproxy:port/"
But it doesn't work when I try to install new extensions I get a connected timeout error. I also try to configure the proxy as system environment variable with the same result.
Could you help me? Is it a bug or I'm doing something wrong?
Is there another way to download extensions?
Thank you very much!
start vscode with below command
code --proxy-server="xxx.xx.xx.xx:port"
add command in desktop for vscode
/usr/share/applications/code.desktop
Exec=/usr/share/code/code --proxy-server="xx.x.x.xx:xxx" --unity-launch %F
Setting Up VS code behind proxy (Proxy script pac file) in Windows 10 to install extensions and updates
Locate the Proxy script path from
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
From the proxy pac file locate the proxy server domain name/port details (chose one that allows internet connection if there are many)
In VS Code go to File > Preferences > Settings and search for "Proxy"
Enter the proxy server url in the Http: Proxy (http.proxy) setting field
Un-tick check box for Http: Proxy Strict SSL ( http.proxyStrictSSL)
Restart VS code
In VS code: File -> Preferences ->Settings.
{
"http.proxyStrictSSL":false,
"http.proxy":"http://USERID:PASSWORD#proxy.domain.com:3128"
}
It works for me. And will work for you too. It appears that in http.proxy you have added "domain" after "http://" which is not required.
I was having issues too. Try adding:
"http.proxyStrictSSL": false
to your settings.json file.
Here is a solution in Windows 7.
Change the system proxy to your proxy, like localhost:3128, in Internet Options => Connections => LAN Settings.
After a version (1.35.0 maybe), the proxy settings in the Settings of vscode seems not working.
My proxy is down as soon as I update.
Finally, I fixed the problem by changing the system proxy.
An official reference: https://code.visualstudio.com/docs/setup/network
As #Yan QiDonge mentioned you can do that.
But if you want to have a more generic solution, this is what I did.
What I did was, I went to Internet Options => Connections => LAN Settings, and then I checked the "Automatically detect setting" and un-checked all other boxes. and it worked like a charm!!!!!
If you are using yarn run this command it worked for me
"yarn config set strict-ssl false"
This worked for me

How to use socks with gradle for dependency resolving, in command line?

When jcenter is not accessible without proxy server, to resolve dependencies, and i want to use socks instead of http proxy, how i can use it in commanad line?
I know how to use http proxy:
-Dhttp.proxyHost=yourProxy -Dhttp.proxyPort=yourPort
-Dhttp.proxyUser=usernameProxy -Dhttp.proxyPassword=yourPassoword
I found answer, here you can use:
./gradlew -DsocksProxyHost=yourHost
-DsocksProxyPort=yourHostPort your-command
using above you can set socks host and port.
Gradle only documents about how to use HTTP(s) proxy, however in the ant source code it mentions, there is enough information about how to setup the SOCKS proxy.
Add the following two lines to the gradle.properties configuration file and you are done.
systemProp.socksProxyHost=your socks proxy ip
systemProp.socksProxyPort=your socks proxy port
The format of SOCKS configuration names (socksProxyHost and socksProxyPort) differs from HTTP proxy host and port configurations (http.proxyHost and http.proxyPort).
Refering to https://discuss.gradle.org/t/how-can-i-set-gradle-proxy-to-socks/15508
In the Project window change from Android to Project scope.
Then open up gradle.properties and add this line:
org.gradle.jvmargs=-DsocksProxyHost=yourHostIP -DsocksProxyPort=yourHostPort
Sync project.
i might be a little late but i found out that in ubuntu/Linux the proxy settings are cached in ~/.gradle/gradle.properties and I also found out that this gradle.properties is different from the one in your app inside android studio.
so you need to edit the credentials in there.
do a vim ~/.gradle/gradle.properties and edit the credentials there.
in my case i was using a socks proxy so i commented out all the http and https proxy hosts and ports and added one for socks. it looked like this
`systemProp.socks5ProxyHost=127.0.0.1
systemProp.socks5ProxyPort=1080`
i was able to sync gradle afterwards.

Running xd-shell and admin-ui against a HTTPS xd-admin in springxd 1.0.1 release

I installed springxd 1.0.1 release. I configured spring-xd to run in HTTPS mode by enabling the SSL properties as specified in https://github.com/spring-projects/spring-xd/wiki/Application-Configuration#enabling-https. I am able to start the xd admin and containers successfully after that. I set the httpSSL.properties as well. However, I am not able to get the xd shell properly. or admin UI to run. I know I have to specify these new ssl properties for them to use, but I am not sure where. The output when I run xd shell is:
1.0.1.RELEASE | Admin Server Target: http://localhost:9393
-------------------------------------------------------------------------------
Error: Unable to contact XD Admin Server at 'http://localhost:9393'.
Please execute 'admin config info' for more details.
-------------------------------------------------------------------------------
Welcome to the Spring XD shell. For assistance hit TAB or type "help".
server-unknown:>
When I try the admin-ui, I just get a 'Connection Interrupted' error.
EDIT: I tried basic authentication by enabling the properties in servers.yml. With this I am able to get the admin-ui to work, but shell still does not work. I am trying to find which configurations I need to set to make this work unsuccessfully. Any help is greatly appreciated.
Any pointers are greatly appreciated.
thanks much,
AG
Asha,
A few clarifications:
You do not need to change httpSSL.properties, that is necessary only for configuring HTTPS for the HTTP source.
Since you've enabled https, you must change the target URL accordingly, as follows:
xd:> admin config server https://localhost:9393
(please note that the protocol is https now)
If you also enable Basic security, you must add the configuration parameters to the configuration command, as in this example:
xd:> admin config server --uri https://localhost:9393 --username adminUserName --password adminPassword
(As described in the reference documentation)
Hope this helps,
Marius

How do I enable dependency management for PlayFramework behind a proxy?

Hi all
I'm trying to add new dependency to Play application, but it fails to resolve dependencies. I've added a line:
- org.fusesource.scalate -> scalate-core 1.4.1
Now when I'm trying to run 'play dependencies --verbose' I receive following:
Server access Error: Network is unreachable: connect url=http://repo1.maven.org/maven2/org/fusesource/scalate/scalate-core/1.4.1/scalate-core-1.4.1.pom
Server access Error: Network is unreachable: connect url=http://repo1.maven.org/maven2/org/fusesource/scalate/scalate-core/1.4.1/scalate-core-1.4.1.jar
This is because of a corporate proxy. I can't figure out how to configure Play (from output I assume it uses Ivy for Dependency management) to use proxy. Still python scripts like 'play install' work ok.
Thanks
Apparently ivy uses ant's setproxy which simply add some system options...
Can you try something like:
#> play deps YOUR_PROJECT_DIR -Dhttp.proxyHost=YOUR_PROXY -Dhttp.proxyPort=YOUR_PORT
My solution is:
play dependencies --sync --verbose -Dhttp.proxyHost=YOUR_PROXY
-Dhttp.proxyPort=YOUR_PORT
-Dhttp.proxyUser=YOUR_USERNAME -Dhttp.proxyPassword=YOUR_PASSWORD
and if you use a proxy script instead, use the same solution as ProgrammerX, but just substitute the URL for the script:
set HTTP_PROXY=http://your-proxy-script-server/ProxyScript.pac
Another simple way on windows is to simply set HTTP_PROXY in the environment properties or on the command like as so
set HTTP_PROXY=http://proxy server:port

Resources