bitwarden / self-host

Bitwarden's self-hosted release repository
GNU General Public License v3.0
335 stars 61 forks source link

update process (still) breaks working installations if downloaded files are corrupted #82

Closed wntrstn closed 1 year ago

wntrstn commented 1 year ago

Opening a new issue here since bitwarden/server#2644 was closed and I'm not sure if my last comment will be noticed.

My instance just broke again after a failed download of run.sh:

Unable to download run script from https://func.bitwarden.com/api/dl/?app=self-host&platform=linux&variant=run. Received status code: 502 http response: \ \\502 Bad Gateway\\ \ \

\

502 Bad Gateway\

\
\
\
nginx\
\ \

As stated in my comment on the other issue, the problem is that the file is still not downloaded to a temporary location, overwriting any existing file:

The addition to the downloadRunFile function that checks the HTTP return code still breaks instances on failure, because it still downloads directly to the "final" destination of run.sh instead of downloading to a temporary location and only moving the file on success. In the case I just experienced, the API sent an HTTP 400 response upon executing bitwarden.sh update, resulting in the following message:

Unable to download run script from https://func.bitwarden.com/api/dl/?app=self-host&platform=linux&variant=run. Received status code: 400 http response: {"message": "Traffic from your network looks unusual. Connect to a different network or try again later. [Error Code 2]"}

The run.sh file was missing afterwards since the function removes it on failure.

joshuabjordan commented 1 year ago

Hi there,

I see the error code 2 message you are receiving. This isn't a bug, but a security measure on our end.

We use GitHub issues as a place to track bugs and other development-related issues. for this particular error, it's not a bug. Could you please reach out to our help center so we can get this resolved. https://bitwarden.com/contact/

Please include the same information you included here.

The issue here will be closed.

Thanks!

JoKneeMo commented 1 year ago

I was coming here to post this exact issue! Cloudflare can't connect to the func host, so updates can't be processed.

Commit https://github.com/bitwarden/self-host/commit/a4305ca7f8ae2b3aff211fa1f7d9c9eca2393046/bitwarden.sh Set the URLs to the go.btwrdn.co domain, but Commit https://github.com/bitwarden/self-host/commit/7b37af5efed334b1be9641fc35be0c260919df76/bitwarden.sh changed it to func.bitwarden.com.

The go.btwrdn.co URL is currently responsive and returns the latest version.

I don't see this as a support issue, but instead a bug on using the wrong domain.

wntrstn commented 1 year ago

I see the error code 2 message you are receiving. This isn't a bug, but a security measure on our end.

We use GitHub issues as a place to track bugs and other development-related issues. for this particular error, it's not a bug. Could you please reach out to our help center so we can get this resolved. https://bitwarden.com/contact/

@joshuabjordan It's a security feature that a failed file download breaks a working instance?

wntrstn commented 1 year ago

I don't see this as a support issue, but instead a bug on using the wrong domain.

@JoKneeMo Also a bug in the implementation of the update process IMHO.
It should very certainly not break an instance if the download servers are not available.