[PR #1443] [MERGED] Check for data folder on startup #2958

Closed
opened 2026-03-03 09:09:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/1443
Author: @jjlin
Created: 2/27/2021
Status: Merged
Merged: 2/28/2021
Merged by: @dani-garcia

Base: masterHead: data-folder


📝 Commits (1)

  • 513056f Check for data folder on startup

📊 Changes

3 files changed (+34 additions, -4 deletions)

View changed files

📝 src/api/admin.rs (+2 -2)
📝 src/main.rs (+23 -2)
📝 src/util.rs (+9 -0)

📄 Description

Currently, when starting up for the first time (running standalone, outside of Docker), bitwarden_rs panics when the openssl tool isn't able to create data/rsa_key.pem due to the data dir not existing:

[2021-02-26 18:35:01.596][bitwarden_rs][INFO] JWT keys don't exist, checking if OpenSSL is available...
OpenSSL 1.1.1f  31 Mar 2020
[2021-02-26 18:35:01.604][bitwarden_rs][INFO] OpenSSL detected, creating keys...
genrsa: Can't open "data/rsa_key.pem" for writing, No such file or directory
Can't open data/rsa_key.pem for reading, No such file or directory
140549065942336:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('da
ta/rsa_key.pem','r')
140549065942336:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
unable to load Private Key
Can't open data/rsa_key.der for reading, No such file or directory
140120792266048:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('da
ta/rsa_key.der','rb')
140120792266048:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
unable to load Private Key
[2021-02-26 18:35:01.627][bitwarden_rs][ERROR] Error creating keys, exiting...

Instead, we should print a more helpful error message telling the user to create the directory:

Create the data folder and try again.

Or when running in Docker/Podman:

Verify that your data volume is mounted at the correct location.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/1443 **Author:** [@jjlin](https://github.com/jjlin) **Created:** 2/27/2021 **Status:** ✅ Merged **Merged:** 2/28/2021 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `master` ← **Head:** `data-folder` --- ### 📝 Commits (1) - [`513056f`](https://github.com/dani-garcia/vaultwarden/commit/513056f7118da82c8011710b65c569080e1fc2ca) Check for data folder on startup ### 📊 Changes **3 files changed** (+34 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/api/admin.rs` (+2 -2) 📝 `src/main.rs` (+23 -2) 📝 `src/util.rs` (+9 -0) </details> ### 📄 Description Currently, when starting up for the first time (running standalone, outside of Docker), bitwarden_rs panics when the `openssl` tool isn't able to create `data/rsa_key.pem` due to the `data` dir not existing: ``` [2021-02-26 18:35:01.596][bitwarden_rs][INFO] JWT keys don't exist, checking if OpenSSL is available... OpenSSL 1.1.1f 31 Mar 2020 [2021-02-26 18:35:01.604][bitwarden_rs][INFO] OpenSSL detected, creating keys... genrsa: Can't open "data/rsa_key.pem" for writing, No such file or directory Can't open data/rsa_key.pem for reading, No such file or directory 140549065942336:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('da ta/rsa_key.pem','r') 140549065942336:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76: unable to load Private Key Can't open data/rsa_key.der for reading, No such file or directory 140120792266048:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('da ta/rsa_key.der','rb') 140120792266048:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76: unable to load Private Key [2021-02-26 18:35:01.627][bitwarden_rs][ERROR] Error creating keys, exiting... ``` Instead, we should print a more helpful error message telling the user to create the directory: > Create the data folder and try again. Or when running in Docker/Podman: > Verify that your data volume is mounted at the correct location. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 09:09:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#2958
No description provided.