vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit f707f86c8e50c16898b971633f38b131d6242e35
parent cc021a47843a10b2923af82113a6d6a7045d2bdf
Author: Olivier Martin <olivier.martin@illogika.com>
Date:   Thu, 29 Apr 2021 23:29:28 -0400

Merge commit '1e5306b8203a7ebe24047910e6c690c18c6d827a' into 2fa_enforcement

Diffstat:
MCargo.lock | 8++++----
MCargo.toml | 2+-
Mbuild.rs | 2+-
Mdocker/start.sh | 10++++++++++
Msrc/api/admin.rs | 2+-
Msrc/db/mod.rs | 6++----
6 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -1572,9 +1572,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.33" +version = "0.10.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1601,9 +1601,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.61" +version = "0.9.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +checksum = "fa52160d45fa2e7608d504b7c3a3355afed615e6d8b627a74458634ba21b69bd" dependencies = [ "autocfg", "cc", diff --git a/Cargo.toml b/Cargo.toml @@ -116,7 +116,7 @@ regex = { version = "1.4.5", features = ["std", "perf"], default-features = fals data-url = "0.1.0" # Used by U2F, JWT and Postgres -openssl = "0.10.33" +openssl = "0.10.34" # URL encoding library percent-encoding = "2.1.0" diff --git a/build.rs b/build.rs @@ -58,7 +58,7 @@ fn read_git_info() -> Result<(), std::io::Error> { // Combined version let version = if let Some(exact) = exact_tag { exact - } else if &branch != "master" { + } else if &branch != "main" && &branch != "master" { format!("{}-{} ({})", last_tag, rev_short, branch) } else { format!("{}-{}", last_tag, rev_short) diff --git a/docker/start.sh b/docker/start.sh @@ -2,6 +2,9 @@ if [ -r /etc/vaultwarden.sh ]; then . /etc/vaultwarden.sh +elif [ -r /etc/bitwarden_rs.sh ]; then + echo "### You are using the old /etc/bitwarden_rs.sh script, please migrate to /etc/vaultwarden.sh ###" + . /etc/bitwarden_rs.sh fi if [ -d /etc/vaultwarden.d ]; then @@ -10,6 +13,13 @@ if [ -d /etc/vaultwarden.d ]; then . $f fi done +elif [ -d /etc/bitwarden_rs.d ]; then + echo "### You are using the old /etc/bitwarden_rs.d script directory, please migrate to /etc/vaultwarden.d ###" + for f in /etc/bitwarden_rs.d/*.sh; do + if [ -r $f ]; then + . $f + fi + done fi exec /vaultwarden "${@}" diff --git a/src/api/admin.rs b/src/api/admin.rs @@ -522,7 +522,7 @@ fn diagnostics(_token: AdminToken, ip_header: IpHeader, conn: DbConn) -> ApiResu Ok(r) => r.tag_name, _ => "-".to_string(), }, - match get_github_api::<GitCommit>("https://api.github.com/repos/dani-garcia/vaultwarden/commits/master") { + match get_github_api::<GitCommit>("https://api.github.com/repos/dani-garcia/vaultwarden/commits/main") { Ok(mut c) => { c.sha.truncate(8); c.sha diff --git a/src/db/mod.rs b/src/db/mod.rs @@ -1,4 +1,3 @@ -use chrono::prelude::*; use diesel::r2d2::{ConnectionManager, Pool, PooledConnection}; use rocket::{ http::Status, @@ -228,12 +227,11 @@ pub fn backup_database(conn: &DbConn) -> Result<(), Error> { use std::path::Path; let db_url = CONFIG.database_url(); let db_path = Path::new(&db_url).parent().unwrap().to_string_lossy(); - let file_date = Utc::now().format("%Y%m%d_%H%M%S").to_string(); + let file_date = chrono::Utc::now().format("%Y%m%d_%H%M%S").to_string(); diesel::sql_query(format!("VACUUM INTO '{}/db_{}.sqlite3'", db_path, file_date)).execute(conn)?; + Ok(()) } } - - Ok(()) } /// Get the SQL Server version