Merge commit '1e5306b8203a7ebe24047910e6c690c18c6d827a' into 2fa_enforcement

This commit is contained in:
Olivier Martin 2021-04-29 23:29:28 -04:00
commit f707f86c8e
6 changed files with 19 additions and 11 deletions

8
Cargo.lock generated
View File

@ -1572,9 +1572,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.33" version = "0.10.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
@ -1601,9 +1601,9 @@ dependencies = [
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.61" version = "0.9.62"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" checksum = "fa52160d45fa2e7608d504b7c3a3355afed615e6d8b627a74458634ba21b69bd"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cc", "cc",

View File

@ -116,7 +116,7 @@ regex = { version = "1.4.5", features = ["std", "perf"], default-features = fals
data-url = "0.1.0" data-url = "0.1.0"
# Used by U2F, JWT and Postgres # Used by U2F, JWT and Postgres
openssl = "0.10.33" openssl = "0.10.34"
# URL encoding library # URL encoding library
percent-encoding = "2.1.0" percent-encoding = "2.1.0"

View File

@ -58,7 +58,7 @@ fn read_git_info() -> Result<(), std::io::Error> {
// Combined version // Combined version
let version = if let Some(exact) = exact_tag { let version = if let Some(exact) = exact_tag {
exact exact
} else if &branch != "master" { } else if &branch != "main" && &branch != "master" {
format!("{}-{} ({})", last_tag, rev_short, branch) format!("{}-{} ({})", last_tag, rev_short, branch)
} else { } else {
format!("{}-{}", last_tag, rev_short) format!("{}-{}", last_tag, rev_short)

View File

@ -2,6 +2,9 @@
if [ -r /etc/vaultwarden.sh ]; then if [ -r /etc/vaultwarden.sh ]; then
. /etc/vaultwarden.sh . /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 fi
if [ -d /etc/vaultwarden.d ]; then if [ -d /etc/vaultwarden.d ]; then
@ -10,6 +13,13 @@ if [ -d /etc/vaultwarden.d ]; then
. $f . $f
fi fi
done 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 fi
exec /vaultwarden "${@}" exec /vaultwarden "${@}"

View File

@ -522,7 +522,7 @@ fn diagnostics(_token: AdminToken, ip_header: IpHeader, conn: DbConn) -> ApiResu
Ok(r) => r.tag_name, Ok(r) => r.tag_name,
_ => "-".to_string(), _ => "-".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) => { Ok(mut c) => {
c.sha.truncate(8); c.sha.truncate(8);
c.sha c.sha

View File

@ -1,4 +1,3 @@
use chrono::prelude::*;
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection}; use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
use rocket::{ use rocket::{
http::Status, http::Status,
@ -228,12 +227,11 @@ pub fn backup_database(conn: &DbConn) -> Result<(), Error> {
use std::path::Path; use std::path::Path;
let db_url = CONFIG.database_url(); let db_url = CONFIG.database_url();
let db_path = Path::new(&db_url).parent().unwrap().to_string_lossy(); 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)?; diesel::sql_query(format!("VACUUM INTO '{}/db_{}.sqlite3'", db_path, file_date)).execute(conn)?;
}
}
Ok(()) Ok(())
}
}
} }
/// Get the SQL Server version /// Get the SQL Server version