self signed certificate in certificate chain atom - atom-editor

Atom Package install issue.png
Hello,
I am using Atom to develop nodejs code for the very first time, problem with accessing the packages tab of the settings. Whenever I search for something, I get this error come up:
self signed certificate in certificate chain
I have tried uninstalling Atom and reinstalling it, and the same problem comes up.
Is this an Atom problem, or more likely something to do with my machine, and if so, what?
Am using win10 and my atom version is Atom 1.33.0x64
Any help would be most appreciated, since I don't seem to be able to add extensions any more.
Many thanks,
Sathiya

From the Atom FAQ:
I’m getting an error about a “self-signed certificate”. What do I do?
This means that there is a proxy between you and our servers where someone (typically your employer) has installed a “self-signed” security certificate in the proxy. A self-signed certificate is one that isn’t trusted by anyone but the person who created the certificate. Most security certificates are backed by known, trusted and certified companies. So Atom is warning you that your connection to our servers can be snooped and even hacked by whoever created the self-signed certificate. Since it is self-signed, Atom has no way of knowing who that is.
If you decide that unsecured connections to our servers is acceptable to you, you can use the following instructions.
apm config set strict-ssl false

https://www.juev.org/2018/07/27/atom-ssl/
Because of a poor software architecture decision early in the NPM project, there is an env var that that will reject self-signed certificates, even if you have strict-ssl set to none. The solution is to set NODE_TLS_REJECT_UNAUTHORIZED=0 in your init.coffee (you can test it by running NODE_TLS_REJECT_UNAUTHORIZED=0 atom . and then trying to install a package.
# $EDITOR $ATOM_HOME/init.coffee or ~/.atom/init.coffee
# Disable TLS Verification.
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0

Below instructions useful you are behind corporate proxy and
using Atom zip download.
If you are on windows, Locate you apm.cmd file.
mostly at -> cd 'C:\Atom\atom-x64-windows\Atom x64\resources\app\apm\bin\'
Execute below command at your windows power shell:
.\apm.cmd config set strict-ssl false
After this in your Atom,
File -> Settings -> init.coffee
ssl=false
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
proxy = "http://your.proxy:8080"
Restart your Atom, at try to install
File -> Settings -> Install -> (for eg. minimap)
Restart your Atom.exe

I also had same issue in Window 10 with atom IDE .
Reason is the proxy server which was blocking the connection to install the packages I was looking for .
So to address this I downloaded the package using apm command from the command line instance .
I was looking for go-plus package so used command as apm install go-plus

On Mac, just setting strict-ssl to false might not work.
You may have to set proxy for this.
apm config set proxy http://*****.****.***:<<port>>
apm config set https_proxy http://****.****.****:<<port>>

If you can get a copy of the self-signed certificate, you may point NODE_EXTRA_CA_CERTS to the self-signed certificate, instead of apm config set strict-ssl false. Here are the steps:
Export the self-signed root CA certificate in PEM format (or Base-64 Encoded X.509 (.CER) on Windows). Sorry, I cannot upload images to illustrate the process. But you may easily find some references by searching "export certificate pem chrome".
Set environment varialble NODE_EXTRA_CA_CERTS:
# Windows
set NODE_EXTRA_CA_CERTS=<absolute-path-to-the-self-signed-root-ca>
# Linux
export NODE_EXTRA_CA_CERTS=<absolute-path-to-the-self-signed-root-ca>
Install the desired Atom plugin:
apm install <plugin-name>

Related

How do I fix the CondaHTTPError [duplicate]

I'd like to install the pymongo library but I'm getting the following error:
(C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
conda install -c anaconda pymongo
Fetching package metadata ...
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a
naconda/win-64/repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', por
t=443): Max retries exceeded with url: /anaconda/win-64/repodata.json (Caused by
ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000
00000054D6128>, 'Connection to conda.anaconda.org timed out. (connect timeout=9.
15)'))",),)
Steps taken to resolve:
1. Update C:\Users\\xxxxxxx\.condarc file with the following:
channels:
- defaults
ssl_verify: false
proxy_servers:
http: http://sproxy.fg.xxx.com:1000
https: https://sproxy.fg.xxx.com:1000
2. (C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
conda config --set ssl_verify False
Additional Info:
(C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
conda info
Current conda install:
platform : win-64
conda version : 4.3.27
conda is private : False
conda-env version : 4.3.27
conda-build version : 3.0.22
python version : 3.6.2.final.0
requests version : 2.18.4
config file : C:\Users\xxxxxxx\.condarc
netrc file : None
offline mode : False
user-agent : conda/4.3.27 requests/2.18.4 CPython/3.6.2 Windows/7 W
indows/6.1.7601
administrator : False
A number of posts online simply reinstalled Anaconda, any other options apart from a fresh install?
This works a charm:-
Just copy these:-
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.
Execute the following command in the cmd prompt/terminal:
conda config --set ssl_verify no
I try to create a virtual env with python 2.7 with anaconda, the base env is python 3.7. I encounter the exactly same problem. It turns out that there isn't such problem with other virtual envs with python 3.7 or 3.6.
This post works perfectly to solve my problem on win7 with anaconda prompt.
It basically says you need to add the following directories into your user environment path in windows (go to Start and type in: View Advanced System Settings, then select Environmental Variables: then select Path and click Edit: finally you can click New and add a path):
C:\your_directory_to_anaconda3\Anaconda3\Scripts
C:\your_directory_to_anaconda3\Anaconda3\
C:\your_directory_to_anaconda3\Anaconda3\Library\bin -- This is the directory for openssl
If you added conda to your PATH variables, remove it and use the "Anaconda Prompt". This solved the problem for me.
See: https://github.com/conda/conda/issues/8046#issuecomment-450582208
I faced this issue when I tried to create environment. I solved it by first activating conda base environment by using:
conda activate base
then I created the environment
conda create -n myenv python=3.7
Check the proxy URL
Verify .condarc file
For me, the problem was with the indentation in the .condarc file.
proxy_servers:
http: http://testproxy:8080
https: https://testproxy:8080
My authenticated proxy server is configured with a domain whitelist for massive and repeated downloads so root or local sudoer doesn't need to be authenticated.
Adding conda.anaconda.org is not enough as this repo redirect its traffic to amazonaws.com.
In my case, adding ".amazonaws.com" to the whitelist solved the issue.
The issue was resolved by adding a username and password to file C:\Users\xxxxx.condarc
channels:
- defaults
ssl_verify: false
proxy_servers:
http: http://xxxxx:password#sproxy.fg.abc.com:yyyy
https: https://xxxxx:password#sproxy.fg.abc.com:yyyy
I had the same problem on Windows 10-64 bit and intuitively installed the 64-bit version of miniconda. However, it results in exactly the same error above. Installing 32 bit conda installer has resolved the issue
Before installing some package (pydicom) the installation run just fine. After
it I tried to install matplotlib, but I got the same error as yours.
I tried conda config --set ssl_verify no but it didn't solve the problem so I set it again to true.
Fortunately, I had a virtual environment where I installed my packages. I closed all Anaconda prompts and tried in a new test environment. Magically, the install worked. I came back to my original virtual env and run the install again, and it worked!.
It might be that I just had to wait for some time before I could use conda install again.
One other thing I could do is remove the package that caused the problem, but I didn't have the chance to try it. If it has anything to do with some virtual environments not being affected, then one possible way to guard against this is to clone the environment before installing any new package.
Edit: I tried the same solution but It did not work. But instead of showing the error immediately, it asks me whether I want to proceed. I deactivated the env, and re-opened anaconda prompt, then did the same steps as above and worked again.
I also had the Same Issue, I resolved by installing 32 bit Anaconda Installer.
Which resolved the CondaHTTPError: HTTP 000 CONNECTION, on Windows 64 bit.
I faced this issues after "conda clean -a" on win-64.
Activating and deactivating existing conda env resolved the issue.
You might need to upgrade your openssl installation
You can download it here (Try the latest version):
https://slproweb.com/products/Win32OpenSSL.html
Source:
https://github.com/ContinuumIO/anaconda-issues/issues/6424#issuecomment-464660808
My issue was simply not running the conda init command prior to attempting to create an environment.
Came across the CondaHTTP Connection error after installing Anaconda environment on a new Windows 10 computer. I tried virtually all the recommendations above unsuccessfully! Looking up the Anaconda archives ( https://repo.continuum.io/archive/ ), I downloaded the immediate previous release .... and on installation and rebooting my PC, all is now wellscreenshot of release
In short - installing Microsoft Visual C++ Redistributable for Visual Studio solved my problem.
In more detail: upon trying a suggested solution of installing a new version of OpenSSL, the installation process told me I was missing a dependency - the Visual Studio Redistributable package. The installer led me to a direct download page of the 2017 version. I can't find that page now, but the official release of 2019 can be found here, and should work as well (found under Other Tools and Frameworks).
Uninstalling and reinstalling anaconda for all users (instead, of current user only, requires admin privileges) and activating the option to add Anaconda to PATH during the installation process, fixed the issues for me.
Thank you everyone for your responses. In my case, I found out that my Kaspersky Internet Security was blocking it the whole time. The moment I quit the application all applications were downloaded. Please check your firewall settings before trying all the above options.
I tried all of these solutions and none worked for me. After running the command
conda config --remove-key channels
in the Anaconda Prompt, everything started working for me on my next attempt.
Adding that I had the same problem on ubuntu on WSL. None of the solutions worked for me, until I realized I was working on WSL version 1 (I thought I'd already upgraded). Upgrading from WSL 1 to WSL 2 solved the problem for me.
Running following these two commands worked for me.
conda config --remove-key proxy_servers
conda clean --source-cache
I'd tried all of the advice on this and many other webpages.
In the end I broadcast a "help me Obiwan Kenobi, you're my only hope message" to a large group of people at work and one of them who used python all the time was able to help me
The trick was to set several windows environmental variables
CURL_CA_BUNDLE
REQUESTS_CA_BUNDLE
SSL_CERT_FILE
To my company's root certificate (a .cer or .crt) which I had downloaded to a spot on my disk
You may also need to add (in my case)
C:\Users\kdalbey\Anaconda3\Scripts
(or your particular \Anaconda3\Scripts) to your path.
And then I set proxies just for good measure
note I previously copied libcrypto-1_1-x64.dll, libcrypto-1_1-x64.pdb, libssl-1_1-x64.dll, libssl-1_1-x64.pdb from anaconda3\Library\bin to anaconda3\DLLs so that could be part of the secret sauce
and it didn't work until I killed and restarted anaconda-navigator
Two steps to deal with this error.
The Anaconda prompt configures the path, to include all the necessary executable files (for instance Library\bin - On Windows, launch it with admin permission). So that you need to use it to execute conda :
Update conda with conda update conda
Exit my proxy software which solved the issue.
I would like summarize some of the proposed answers in this post and propose my experience on that. As it can be understood from the error explanation, the error is related to the connection and I strongly believe that no need to uninstall and reinstall anything if the real cause of the problem be known. My problem gone away after the system powered off and powered on again one day later. So, some possible causes and their solutions (these solutions could be tested in order based on the written bulleted order) could be as follows:
Crash in anaconda prompt:
Probable solutions:
Deactivating and activating the environment, without removing all packages or …, or
Closing/reopening the prompt (Michael Heidelberg) or
Using cmd.exe instead, perhaps
Non-responsiveness of the anaconda site:
Massive site traffics related probable issues, that could be the reason of non-responsiveness or to temporary block some IPs
Probable solutions:
Retying as recommended in the error: HTTP errors are often intermittent, and a simple retry will get you on your way. It solves my problem sometimes. or
Activate or deactivate VPNs or Proxies (like use in .condarc; see: Github sroder, Nandhan Thiravia, Vinod Sangale, Peter Lucas, Sunding Wei).
Try after a while if you have time
System firewall block the site:
That might be happened by activating and deactivating of VPNs, repeatedly or by some other works
Probable solutions:
Finding the issue in system firewall and allowing the connection in the firewall settings (ScienceJedi, Github)
Reboot, perhaps
If the aforementioned ways didn't solve the problem, testing the related answers in the following order:
Add ...\Anaconda3\Scripts, ...\Anaconda3\, and ...\Anaconda3\Library\bin to the path (talentcat, skerjj, Victor Ochieng, jankap), perhaps need a reboot after (lightarrow)
Copying libcrypto-1_1-x64.dll and libssl-1_1-x64.dll from D:\Anaconda3\Library\bin into D:\Anaconda3\DLLs (Swapnil)
I think it could be used in the first step because It is unlikely to be cause of any other problem. The reason I didn't mention this at the beginning is that the developers could placed these files in that directory during installation, too, in default, but they didn't; perhaps it had some reasons (Github).
Note: these files are for Python >3, and I didn't find them for Python 2. Perhaps they have another names.
It must be said that my problem didn't solve by this solution.
Keep your SSL stack up-to-date (kamal dua, Anaconda troubleshooting, update openssl, Abdulrahman Bres, Update to openssl 1.1.1)
I didn't recommend it at first because Its not a good idea to unset ssl verification unless you know what you are doing (Pratyush comment) and somewhere I read that it couldn't return to True again.
It must be said that my problem didn't solve by this solution, too.
conda config --set ssl_verify false
conda update openssl ca-certificates certifi

RStudio Proxy Configuration on Windows

This question has been asked in: Configure proxy on Rstudio. However, it was never resolved.
I am a user of RStudio 0.99.486 version and R 3.2.2 version. I have tried 2 ways to configure proxy settings in the office without success after reading several suggestions:
FIRST TRY:
Type in Rstudio as first line:
Sys.setenv(http_proxy="http://user_name:password#proxy.company_domain.es:8080/")
Go to:
-Tools, -Global Options, -Packages, and unmark option:
"Use internet library/proxy for HTTP"
I also unmarked the option: "Use secure download method for HTTP".
Besides, I right-clicked on the R x64 3.2.2 icon of the desktop and added after 1 space in the "Target" camp:
http_proxy=http://user_name:password#proxy.company_domain.es:8080/
It did not work as I received the message:
Warning in install.packages : cannot open: HTTP status was '407
Proxy Authentication Required'
SECOND TRY:
Create a notepad file with the name:
.Renviron
Saved it in: "C:\Users\username\Documents".
The file contains inside the following 2 lines:
http_proxy=http://proxy.company_domain.es/
http_proxy_user=user_name:password
When I try installing a package I receive:
"Warning in install.packages : unable to connect to
'cran.rstudio.com' on port 80.
Unable to access index for repository http://cran.rstudio.com/src/contrib"
After running code line: R.home() My R_HOME route is:
"C:/Program Files/R/R-32~1.2"
I appreciate before-hand for your advice and help.
Thank you for your question. It helped me to resolve my issue. I had to unmark the option to use the settings from the Internet Explorer and restart.
Maybe your .Renviron does not contain the proxy port, you have to write
http_proxy=http://proxy.company_domain.es:8080/
http_proxy_user=user_name:password
If you specify
http_proxy_user=ask
it should prompt you for user name and password - then you know that the file is read
I struggled with this when I initially started working behind a proxy. Here's what I believe is to be the solution. Disclaimer, I am working on a Windows 7 Workstation.
Even though when you read through the documentation, R suggests that .Renviron and .Rprofile should be in R.home(), that is not the case for Windows.
By default (I believe), the R.home() for Windows is actually the Documents folder for your user. You can check that with
path.expand("~/")
which defaults to "My Documents" directory.
Therefore, do place the .Renviron file with the content you
already have, disable the Internet Explorer option in RStudio, and
make sure you place the file in "My Documents."
Hope it helps!
I also nearly gave up on this problem until I found this simple solution (R3.3.1):
specify the system environment variables (in Windows Advanced System Settings add the variables http_proxy and https_proxy and set it to
http://user_name:password#proxy.company_domain.es:8080/ with your specific settings)
in the R console type
update.packages(ask='graphics',method="libcurl",checkBuilt=TRUE)

Errors when using RStudio's Git tools

When attempting to push to GitHub from RStudio, I get the following errors.
error: unable to read askpass response from 'rpostback-askpass'
fatal: could not read Username for 'https://github.com':
No such device or address
RStudio has my origin as
https://github.com/rmscriven/other.git
when it actually should be
https://github.com/rmscriven/saber.git
RStudio will not allow me to change the origin from the version control system. Here is what it shows:
Is it possible to change my GitHub origin url from RStudio?
Thanks to the pro tip provided by #krlmlr in the comments,
Use an empty target directory. Look for "clone URL" on your GitHub project page, perhaps choose the SSH variant.
I clicked "clone url" on GitHub once, nothing. Then again, nothing. And once again for good measure, nothing. So I went to the terminal, read the man git help file, and decided to change my password and reconfigure. These are the lines I ran, and it was successful.
git config --global user.name <myuser.name>
git config --global user.email <myuser.email>
git clone https://github.com/rmscriven/saber.git
git pull
Then I went to RStudio and it allowed me to clone my repository, and change the URL of my version control setting. Here's a colorful pic
New project -> Version Control -> Git -> Create Project
Next, magic happened, and I had a copy of my package which I very carefully removed to prepare to push the development tarball to GitHub. Rock on.
#krlmlr, I thank you for nudging me in the right direction. Now I feel like I'm actually doing it the right way. :)
And for fun, try saying 'rpostback-askpass' ten times fast.
I had the same problem and for me these two simple steps worked great:
Add the SSH key from RStudio to my github account.
Change the origin URL and use the -u flag for push/pull once (solution found here).
For 1., in RStudio go to Tools → Global Options... → Git/SVN → view public key, and copy the key. In your browser of choice, logged in on Github, click Edit Profile → SSH keys and paste the copied key here.
For 2., back in RStudio, click Tools → Shell… , then enter:
git remote add origin https://github.com/myname/test.git
git config remote.origin.url git#github.com:myname/test.git
git pull -u origin master
git push -u origin master
Of course, change "myname" to your username and "test.git" to the name of your project. (Or even "github.com" to the URL of your institute's github or similar.)
After doing this once, the Push/Pull buttons in RStudio should work and you don't need the shell anymore!
I've been running into this issue on multiple computers now, with a remote that doesn't support SSH and thus can't leverage password-less login.
The problem in this case is that by default, git ask for the password interactively, and RStudio can't display this graphically. The trick is to use git's credential storage system.
For instance on Mac OS X:
git config --global credential.helper osxkeychain
On Linux one could use the gnome-keyring integration.

Where does makecert.exe store the digital certificate

I created a self-signed certificate and a client certificate using this tutorial and the makecert.exe tool:
http://msdn.microsoft.com/en-us/library/ff647171.aspx
However, when I go to MMC and try to import the certificate in the Trusted Root Certificate Authorities, I have no clue where to locate the .cer file.
Where does the makecert.exe tool save the certificates it creates?
If you did what I did and just left the command prompt in c:\windows\system32 (using the x64 Cross Tools Command Prompt) you will be surprised that the file is not in c:\windows\system32 (as evidenced by doing a simple dir *.cer).
Fortunately it will be found sitting in c:\windows\SysWOW64.
Step 1, point 1
Open a Visual Studio command prompt and browse to the location where
you want to save the certificate files
Is it therefore not the location you went to, upon opening the Visual Studio command prompt?

How to use sbt from behind proxy?

How do I configure sbt to use a proxy?
For example, my build definition needs to connect to GitHub, specifying connection parameters for http.proxy, http.proxyPort, user, and password.
How would I pass in these settings to sbt?
Is there an easy way to switch between proxy/no-proxy settings for when I work from home?
sbt respects the usual environment variables for http proxy settings:
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=yourserver -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password"
(That's of course, assuming Unix (Linux/OSX etc). On windows you could just set the same environment variable (%JAVA_OPTS%) as usual in the Windows way.)
Then run sbt as usual:
sbt
Switching between proxy/no-proxy should be a matter of setting up a little script that you can 'slurp' in whenever you need it.
Gotchas
Don't include "http://" in the yourserver value
Don't include the port in the yourserver value
You probably also want to include https.proxyHost and https.proxyPort since a lot of stuff works over https
If your proxy requires authentication, don't even bother trying unless it just uses Basic Authentication as SBT doesn't support anything else. Also always beware clear texting credentials into environment variables! Be sure to remove the commands from your .bash_history using a text editing method that won't create trace files (technically you should shred or srm the entire file). If you are on Windows, don't worry about it, your security is already messed up you can't do any more harm.
sbt works in a fairly standard way comparing to the way other JVM-based projects are usually configured.
sbt is in fact two "subsystems" - the launcher and the core. It's usually xsbt.boot.Boot that gets executed before the core starts up with the features we all know (and some even like).
It's therefore a matter of how you execute sbt that says how you could set up a proxy for HTTP, HTTPS and FTP network traffic.
The following is the entire list of the available properties that can be set for any Java application, sbt including, that instruct the Java API to route communication through a proxy:
http_proxy
http_proxy_user
http_proxy_pass
http.proxyHost
http.proxyPort
http.proxyUser
http.proxyPassword
Replace http above with https and ftp to get the list of the properties for the services.
Some sbt scripts use JAVA_OPTS to set up the proxy settings with -Dhttp.proxyHost and -Dhttp.proxyPort amongst the others (listed above). See Java Networking and Proxies.
Some scripts come with their own way of setting up proxy configuration using the SBT_OPTS property, .sbtopts or (only on Windows) %SBT_HOME%\conf\sbtconfig.txt. You can use them to specifically set sbt to use proxies while the other JVM-based applications are not affected at all.
From the sbt command line tool:
# jvm options and output control
JAVA_OPTS environment variable, if unset uses "$java_opts"
SBT_OPTS environment variable, if unset uses "$default_sbt_opts"
.sbtopts if this file exists in the current directory, it is
prepended to the runner args
/etc/sbt/sbtopts if this file exists, it is prepended to the runner args
-Dkey=val pass -Dkey=val directly to the java runtime
-J-X pass option -X directly to the java runtime
(-J is stripped)
-S-X add -X to sbt's scalacOptions (-S is stripped)
And here comes an excerpt from sbt.bat:
#REM Envioronment:
#REM JAVA_HOME - location of a JDK home dir (mandatory)
#REM SBT_OPTS - JVM options (optional)
#REM Configuration:
#REM sbtconfig.txt found in the SBT_HOME.
Be careful with sbtconfig.txt that just works on Windows only. When you use cygwin the file is not consulted and you will have to resort to using the other approaches.
I'm using sbt with the following script:
$JAVA_HOME/bin/java $SBT_OPTS -jar /Users/jacek/.ivy2/local/org.scala-sbt/sbt-launch/$SBT_LAUNCHER_VERSION-SNAPSHOT/jars/sbt-launch.jar "$#"
The point of the script is to use the latest version of sbt built from the sources (that's why I'm using /Users/jacek/.ivy2/local/org.scala-sbt/sbt-launch/$SBT_LAUNCHER_VERSION-SNAPSHOT/jars/sbt-launch.jar) with $SBT_OPTS property as a means of passing JVM properties to the JVM sbt uses.
The script above lets me to set proxy on command line on MacOS X as follows:
SBT_OPTS="-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=9999" sbt
As you can see, there are many approaches to set proxy for sbt that all pretty much boil down to set a proxy for the JVM sbt uses.
In windows environment simply add following line in the sbt/sbtconfig.txt
-Dhttp.proxyHost=PROXYHOST
-Dhttp.proxyPort=PROXYPORT
-Dhttp.proxyUser=USERNAME
-Dhttp.proxyPassword=XXXX
or the Https equivalent (thanks to comments)
-Dhttps.proxyHost=PROXYHOST
-Dhttps.proxyPort=PROXYPORT
-Dhttps.proxyUser=USERNAME
-Dhttps.proxyPassword=XXXX
I used (this is a unix environment) :
export SBT_OPTS="$SBT_OPTS -Dhttp.proxyHost=myproxy-Dhttp.proxyPort=myport"
This did not work for my setup :
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=myproxy-Dhttp.proxyPort=myport"
In sbt.sh file :
JAVA_OPTS environment variable, if unset uses "$java_opts"
SBT_OPTS environment variable, if unset uses "$default_sbt_opts"
But apparently SBT_OPTS is used instead of JAVA_OPTS
For Windows users, enter the following command :
set JAVA_OPTS=-Dhttp.proxySet=true -Dhttp.proxyHost=[Your Proxy server] -Dhttp.proxyPort=8080
To provide one answer that will work for all Windows-users:
Add the following to your sbtconfig.txt (C:\Program Files (x86)\sbt\conf)
-Dhttp.proxyHost=XXXXXXX -Dhttp.proxyPort=YYYY -Dhttp.proxySet=true -Dhttps.proxyHost=XXXXXXX -Dhttps.proxyPort=YYYY -Dhttps.proxySet=true
Replace both XXXXXXX with your proxyHost, and both YYYY with your proxyPort.
If you get the error "Could not find or load main class" you need to set your JAVA_HOME:
set JAVA_HOME=C:\Progra~1\Java\jdkxxxxxx
When on 64-bit windows, use:
Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'
Add both http and https configuration:
export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=yourserver -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password"
export JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyHost=yourserver -Dhttps.proxyPort=8080 -Dhttps.proxyUser=username -Dhttps.proxyPassword=password"
(https config is must, since many urls referred by the sbt libraries are https)
In fact, I even had an extra setting 'http.proxySet' to 'true' in both configuration entries.
When I added the proxy info to the %JAVA_OPTS%, I got an error "-Dhttp.proxyHost=yourserver was unexpected at this time". I put the proxy info in %SBT_OPTS% and it worked.
Using
sbt -Dhttp.proxyHost=yourServer-Dhttps.proxyHost=yourServer -Dhttp.proxyPort=yourPort -Dhttps.proxyPort=yourPort
works in Ubuntu 15.10 x86_64 x86_64 GNU/Linux.
Replace yourServer by the proper address without the http:// nor https:// prefixes in Dhttp and Dhttps, respectively. Remember to avoid the quotation marks. No usr/pass included in the code-line, to include that just add -Dhttp.proxyUser=usr -Dhttp.proxyPassword=pass with the same typing criteria. Thanks #Jacek Laskowski!.
Cheers
I found an item on the FAQ section of Lightbend Activator useful. I am using Activator, which in turn uses SBT, so not sure if this helps users with just SBT, but if you use Activator, like me, and are behind a proxy, follow the instructions in the "Behind A Proxy" section of the FAQ:
https://www.lightbend.com/activator/docs
Just in case the content disappears, here's a copy-paste:
When running activator behind a proxy, some additional configuration
is needed. First, open the activator configuration file, found in your
user home directory under ~/.activator/activatorconfig.txt. Note that
this file may not exist. Add the following lines (one option per
line):
-Dhttp.proxyHost=PUT YOUR PROXY HOST HERE
-Dhttp.proxyPort=PUT YOUR PROXY PORT HERE
-Dhttp.nonProxyHosts="localhost|127.0.0.1"
-Dhttps.proxyHost=PUT YOUR HTTPS PROXY HOST HERE
-Dhttps.proxyPort=PUT YOUR HTTPS PROXY PORT HERE
-Dhttps.nonProxyHosts="localhost|127.0.0.1"
SBT use both HTTP/HTTPS/SFTP/SSH and other kind of connections to a repository. so when behind a proxy, these protocols should be available.
In most simple cases on Windows, you just need to pass proxy parameters options to JVM, like:
java -Dhttp.proxyHost=myproxy -Dhttp.proxyPort=8080
That will do.
But if not, there are few things you should be aware of:
whether if you are making a HTTPS connection to the repository.
whether sever certificates been imported to jre cacerts
whether your proxy would replace your server certificates
to solve first, you should pass https proxy parameter to jvm, like:
java -Dhttps.proxyHost=myproxy -Dhttps.proxyPort=8080 -Djavax.net.ssl.trustStore=${TRUST_STORE_PATH}
to solve the second, you should import the ca. there are a lot of tips.
to solve the third, you maybe could considering using a authentication proxy.
to Simplify the config of SBT, it provide sbtconfig.txt and sbtops in the conf directory, look into it.
Reference:
http://www.scala-sbt.org/0.13/docs/Setup-Notes.html
http://www.scala-sbt.org/1.0/docs/Publishing.html
On Mac OS X / El Capitan you can set java environment variables:
$launchctl setenv _JAVA_OPTIONS "-Dhttp.proxyHost=192.168.1.54 -Dhttp.proxyPort=9999"
I found that starting IntelliJ IDEA from terminal let me connect and download over the internet. To start from terminal, type in:
$ idea
Try providing the proxy details as parameters
sbt compile -Dhttps.proxyHost=localhost -Dhttps.proxyPort=port -Dhttp.proxyHost=localhost -Dhttp.proxyPort=port
If that is not working then try with JAVA_OPTS
(non windows)
export JAVA_OPTS = "-Dhttps.proxyHost=localhost -Dhttps.proxyPort=port -Dhttp.proxyHost=localhost -Dhttp.proxyPort=port"
sbt compile
or
(windows)
set JAVA_OPTS = "-Dhttps.proxyHost=localhost -Dhttps.proxyPort=port -Dhttp.proxyHost=localhost -Dhttp.proxyPort=port"
sbt compile
if nothing works then set SBT_OPTS
(non windows)
export SBT_OPTS = "-Dhttps.proxyHost=localhost -Dhttps.proxyPort=port -Dhttp.proxyHost=localhost -Dhttp.proxyPort=port"'
sbt compile
or
(windows)
set SBT_OPTS = "-Dhttps.proxyHost=localhost -Dhttps.proxyPort=port -Dhttp.proxyHost=localhost -Dhttp.proxyPort=port"
sbt compile
If you are using a Proxy which requires authentication, I have a solution for you :)
As #Faiz explained above, SBT has a very hard time handling proxy requiring authentication. The solution is to bypass this authentication, if you cannot turn off your proxy on demand (corporate proxy for example).
To do so, I suggest you use a squid proxy, and configure it with your username and password to access your corporate proxy. See : https://doc.ubuntu-fr.org/squid
Then, you can set JAVA_OPTS or SBT_OPTS environment variables so that SBT connects to your own local squid proxy instead of your corporate proxy :
export JAVA_OPTS = "-Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128"
(just c/c this in your bashrc without modifying anything and it should work fine).
The trick is that Squid Proxy does not require any authentication, and acts as an intermediate between SBT and your other proxy.
If you have troubles in applying this advise, please let me know.
Regards,
Edgar
For those still landing on this thread trying to find where/how to configure HTTP proxy in IntelliJ, here's how I managed to get it to work for me. I hope this helps!
(Note: specify your network username and password in the corresponding boxes):-

Resources