VictorNine / bitwarden-go

A Bitwarden-compatible server written in Golang
MIT License
250 stars 33 forks source link

Cannot register account through Bitwarden-web #12

Closed shackra closed 6 years ago

shackra commented 6 years ago

I have a docker container for Bitwarden-go, the binary running inside is based on my pull request VictorNine/bitwarden-go/pull/8 that is started this way.

I also have a docker container for Bitwarden Vault which is told to point to http://localhost:8000 as there is were Bitwarden-go listens requests.

Bitwarden-go can response to requests perfectly fine:

jorge@morpho ~ % wget 0.0.0.0:8000/api/accounts/register          
--2018-01-05 04:13:34--  http://0.0.0.0:8000/api/accounts/register
Connecting to 0.0.0.0:8000... connected.
HTTP request sent, awaiting response... 400 Bad Request
2018-01-05 04:13:34 ERROR 400: Bad Request.

However, Bitwarden Vault tells me that "Errors have occurred. · An unexpected error has occurred." and I cannot register my account (or login, I put the credentials I cannot register and try to login but bitwarden vault displays the exact error message).

I don't have any output from the bitwarden-go binary indicating an error.

What am I doing wrong?

ElCyborg commented 6 years ago

Looking through your repo, it appears that your mirror is out of date, perhaps updating it could fix the problem? The last commit of your mirror seems to be 02995b9535030208dd843f8901b5c96e9eece6c7, decently old at this time.

EDIT: I reread and realized you were running a different binary. Ill look into the problem and try to recreate it on my end.

shackra commented 6 years ago

On the mean time I will too update my repo with your recent changes and re-apply my additions and see what happens

VictorNine commented 6 years ago

The code is now part of this repo if you would like to try again

shackra commented 6 years ago

Nope, the weird error is still there even with the latest code for bitwarden-go compiled:

screenshot-2018-1-30 register - bitwarden web vault

The most frustrating part is the ausence of output from bitwarden-go, I can see you have log.Println inside the HandleRegister among many but nothing prints to console besides 2018/01/30 23:36:31 Starting server on :8000

shackra commented 6 years ago

On the other hand, maybe the Bitwarden Vault running inside the container is NOT hitting the backend. Going to check tomorrow.

shackra commented 6 years ago

Running everything locally (without docker) the behavior remains the same.

Bitwarden Vault is configure in this fashion:

{
  "appSettings": {
      "apiUri": "http://localhost:8000",
      "identityUri": "http://localhost:8000",
      "iconsUri": "https://icons.bitwarden.com",
      "stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD",
      "braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2"
  }
}

and package.json is changed in its env variable:

...
   "env": "Development",
...

Not sure what is going on.

VictorNine commented 6 years ago

Looks like thats the problem. My setting.json file looks like this:

{ "appSettings": { "apiUri": "/api", "identityUri": "/identity", "iconsUri": "https://icons.bitwarden.com", "stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD", "braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2", "whitelistDomains": [ "localhost", "localhost:8080" ] } }

Odysseus16 commented 6 years ago

So far, I can register at the web-vault. But I get this error: Missing auth header; I am using your neweset version and the newest version of the web-vault. It is 1.22

leonghui commented 6 years ago

@shackra Thanks, I referenced your dockerfiles to build my own alpine-based containers. I got this to work using reverse proxy with the vaultURL parameter.

The command I used is as follows. The Vault container IP is in docker's default 172.17../16 subnet. bitwarden-go -init -location /data -vaultURL <vault container IP>:4001

In the Vault container, I copied settings.Production.json to settings.json and changed to env tag in package.json. Access is via port 8000 on the bitwarden-go container.

VictorNine commented 6 years ago

@thoundernousx Just tried with the latest version. Could you post your settings.json?

Nous1699 commented 6 years ago

Thanks, I tried it yesterday. Now everything works like a charm.

shackra commented 6 years ago

Weird, suddenly I was unable to access Bitwarden-web from the outside running inside a docker container.

I just will use @leonghui alpine versions of both containers and that is.