Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin panel login redirect #1040

Closed
SinTh0r4s opened this issue Jul 2, 2020 · 12 comments
Closed

Admin panel login redirect #1040

SinTh0r4s opened this issue Jul 2, 2020 · 12 comments

Comments

@SinTh0r4s
Copy link

Subject of the issue

Hi,
I am using a Bitwarden_RS instance on my personal host behind a nginx reverse proxy for HTTPS. Let's Encrpyt. All that good stuff. Now i am looking into hardening my installation before i go live. As part of that I configured my nginx to block every public access to the /admin/ subdirectory.

  location ~ /admin {
    deny all;
    return 403;
  }

This works like intended. If i try to access https://bitwarden.public.dns/admin i am greeted with a 403 warning. So far so good.

I am still able to access the admin panel locally by accessing https://bitwarden.local/admin. Now i enter my token and press enter . Then i get redirected to https://bitwarden.public.dns/admin and receive a 403. If i change the address to https://bitwarden.local/admin again i can use the admin panel without problems.
The same thing happens when i log out of the admin panel (although it does not bother me in that case).

Is it possible to stop that redirecting to the public dns after login? After all it is just for convenience.

Great project! Love it!
SinTh0r4s

My environment

@Mte90
Copy link

Mte90 commented Jul 27, 2020

I have a similar problem.
Domain: https://dev.domain.tld/bitwarden/admin
After entering the password: https://dev.domain/admin

@wcjxixi
Copy link

wcjxixi commented Oct 12, 2020

incorrect nginx reverse proxy configuration

  location ~ /admin {
    deny all;
    return 403;
  }

Replace with:

  location /admin {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_pass http://127.0.0.1:8443; #8443 is the host port your bitwarden_rs container is exposed to
  }

reference https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples Nginx (by shauder)

@Mte90
Copy link

Mte90 commented Oct 12, 2020

I have the issue with apacheand as I can see in the wiki this parameters for nginx already exists.

@BlackDex
Copy link
Collaborator

The redirect is done based upon the DOMAIN setting you have configured.
So, in the case where it redirects to a wrong place that value is configured wrong.
In the other case, i can understand the multi-tld stuff. I could look into using the actual host for this instead of the configured DOMAIN.

@Mte90
Copy link

Mte90 commented Oct 12, 2020

In my case is multihost installation in a subfolder and the domain is configured right

@BlackDex
Copy link
Collaborator

But with multi host you can only configure one host/domain in the config. And that is where the Redirect is pointing you to.

@BlackDex
Copy link
Collaborator

Closing this ticket because of inactivity.
Feel free to continue this discussion on the forum: https://bitwardenrs.discourse.group/

@Mte90
Copy link

Mte90 commented Nov 18, 2020

I still have the issue, so I don't know how to keep the discussion moving on as the problem persist.

@BlackDex
Copy link
Collaborator

Well i have tested this my self just right now, and i can't reproduce this issue.
I tested this with nginx and it works without any strange redirect issues.

Also, i saw that there was no example for nginx available at the Proxy Examples, so i added this.
Please see: https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples -> Nginx with sub-path (by BlackDex)

@Mte90
Copy link

Mte90 commented Nov 19, 2020

In my case the TLD was missing in the settings so I fixed it but the admin is like this:
Screenshot_20201119_155358

I am using "Apache in a sub-location" setting.

@BlackDex
Copy link
Collaborator

@Mte90 did you also added the correct sub-path into the DOMAIN variable? So like https://my-domain.tld/bitwarden/?

@blackw1ng
Copy link

blackw1ng commented Mar 5, 2021

Hey, to continue on that one..

I used the apache2-sublocation stencil from the wiki - which does not mention DOMAIN.
In case I do not set this env, i can get the /bitwarden/ working :)

However /bitwarden/admin/ does not really work.
First of all tries to load resources from /bwrs_static/.

A simple RewriteRule ^/bwrs_static/(.*) /bitwarden/bwrs_static/$1 [R=302,L] fixes at least the layout.

Entering the correct password results in first a POST (with a set token), next a 303, then again a GET on the /bitwarden/admin - so no login happens :(
In case an incorrect password is entered, the yellow banner appears - so at least it seems, that the token is verified.

Setting DOMAIN="https://xyz/bitwarden/admin" or DOMAIN="https://xyz/bitwarden/admin/" results in a 404 from rocket...

Repository owner locked and limited conversation to collaborators Mar 6, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants