heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.37k stars 381 forks source link

Certificate signed by unknown authority #2018

Open prvsousa opened 7 years ago

prvsousa commented 7 years ago

I'm trying to make the login in heroku but I get this:

$ heroku login
Enter your Heroku credentials.
Email: xxx@gmail.com
Password (typing will be hidden):
 ▸    Post https://api.heroku.com/login: x509: certificate signed by unknown authority

I already try to generate a ssl certificate but it cannot solve the problem. I don't know if it is problem or not of the ssl.

Can anyone help me with this?

Thank's in advance.

jdx commented 7 years ago

Are you behind a proxy? Make sure you follow the proxy instructions here: https://devcenter.heroku.com/articles/using-the-cli

prvsousa commented 7 years ago

▸ Post https://api.heroku.com/login: http: error connecting to proxy https://proxy.server.com:portnumber: dial tcp: unknown port tcp/portnumber

After the export, I got this!

jdx commented 7 years ago

I don't know what your proxy server is, you'll have to ask your system administrator.

prvsousa commented 7 years ago

Oh sorry, I thought that it was for heroku. I don't have proxy, I'm using direct connection.

The error is: Post https://api.heroku.com/login: x509: certificate signed by unknown authority when I make "heroku login"

jdx commented 7 years ago

That error means the CLI isn't recognizing api.heroku.com as a legitimate host. Usually this happens because there is a MITM proxy that is intercepting the traffic and altering it. Something is between your internet and our servers that is causing it to happen.

prvsousa commented 7 years ago

But for example, I can't make heroku login on bash on ubuntu on windows but in Ubuntu, I can make the login! I don't understand the difference of connection between the both systems in same device.

jdx commented 7 years ago

well the CLI uses its own certs, you might have a root certificate that bypasses our SSL cert (which I hope you don't), but if that is the case, you can set the certs with SSL_CERT_DIR or SSL_CERT_FILE I think.

prvsousa commented 7 years ago

I try this but without success :s

kartiknagappa commented 7 years ago

This is going to sound stupid but I had the same problem and spent several hours trying to figure out what was going on. In the end, I shutdown/restarted my mac and it started working. Gah!

thirota commented 7 years ago

I encountered same error on Mac Yosemite and Sierra. In my case, I could login after turning off my AntiVirus software(Kaspersky Internet Security)...

houssem-yahiaoui commented 7 years ago

I've encountered the same problem but was the solution for my situation (running macOS Sierra) was going in sudo mode.

emilyemoss commented 7 years ago

Similar issue after installing heroku via homebrew. Running heroku update and then heroku login a second time resolved the issue for me.

DrFrolla commented 7 years ago

Mac OS 10.12.2 Sierra + antivirus Kaspersky... disabling the antivirus everything works correctly

alxpck commented 7 years ago

I had a similar issue in Sierra 10.12.2. Restarting iTerm2 did the trick for me.

ransombriggs commented 7 years ago

@alxpck @DrFrolla @emilyemoss @houssem-yahiaoui @thirota @patricia93sousa We were waiting on the 1.8 release of golang to get this fix, but saw that it was backported to the 1.7 and released as part of the 1.7.5 release. Could you heroku update and verify that you have heroku-cli/5.6.17-bee0f80 (darwin-amd64) go1.7.5 and let me know if you see this error again?

https://github.com/golang/go/commit/3357daa96e2b04f83be70d29b70858ddc7c803f4

ransombriggs commented 7 years ago

Note: heroku update may not work because of this error, but this error is intermittent, so either you can try again or run the installer from https://cli.heroku.com to fix this error.

alxpck commented 7 years ago

@ransombriggs I just checked heroku version and I'm already at heroku-cli/5.6.17-bee0f80 (darwin-amd64) go1.7.5 as I was at the time of the error.

Weirdly, all I had to do was quit my terminal (iTerm2) session and launch a new one and it started working.

ransombriggs commented 7 years ago

@alxpck the heroku CLI automatically updates in the background so it may have auto updated you after you saw the error four days ago without you manually requesting an update. Let me know if you see the error again so that I can continue to investigate this (I upgraded to Sierra to debug this error and have not seen the error since updating heroku, but since it was an intermittent error I am not completely sure it is fixed)

babzcraig commented 7 years ago

Sudo worked for me. I think it has something to do with the root certificate bypassing the SSL cert. I am using a mac on which I am not the root user even though I have admin privileges.

@kartiknagappa Not stupid at all. I took your advice.

jzcfamily commented 7 years ago

git 中heroku login 登录不上,总是报错: ▸ HTTP Error: https://api.heroku.com/login 400 Bad Request ▸ Invalid response from API. ▸ HTTP 400 ▸ {xxxxxxxxxxxx xxxxxxxxxxx} ▸ ▸ Are you behind a proxy? ▸ https://devcenter.heroku.com/articles/using-the-cli#using-an-http-proxy

▸ Post https://api.heroku.com/login: http: error connecting to proxy http://proxy.server.com:portnumber: dial tcp: unknown port tcp/portnumber

这两种错误。怎么能解决呢?