1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-11 08:08:14 -05:00

Merge branch 'master' of github.com:bitwarden/server

This commit is contained in:
Kyle Spearrin 2019-10-04 13:46:55 -04:00
commit 481d444c43
3 changed files with 10 additions and 21 deletions

@ -115,7 +115,9 @@ function Update-Lets-Encrypt {
function Update-Database {
Pull-Setup
docker run -it --rm --name setup --network container:bitwarden-mssql `
Docker-Compose-Files
$mssqlId = docker-compose ps -q mssql
docker run -it --rm --name setup --network container:$mssqlId `
-v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
dotnet Setup.dll -update 1 -db 1 -os win -corev $coreVersion -webv $webVersion -q $setupQuiet
Write-Line "Database update complete"
@ -140,7 +142,6 @@ function Restart {
Docker-Compose-Pull
Update-Lets-Encrypt
Docker-Compose-Up
Docker-Prune
Print-Environment
}
@ -175,6 +176,7 @@ elseif ($update) {
Docker-Compose-Down
Update -withpull
Restart
Docker-Prune
Write-Line "Pausing 60 seconds for database to come online. Please wait..."
Start-Sleep -s 60
Update-Database

@ -43,21 +43,6 @@ then
echo $LGID >>$ENV_DIR/uid.env
fi
# Backwards compat GID/UID for pre-1.20.0 installations
if [[ "$COREVERSION" == *.*.* ]] &&
echo -e "1.19.0\n$COREVERSION" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -n | awk 'END {if($0!="1.19.0") {exit 1}}'
then
LUID="LOCAL_UID=`id -u $USER`"
LGID="LOCAL_GID=`awk -F: '$1=="docker" {print $3}' /etc/group`"
if [ "$OS" == "mac" ]
then
LUID="LOCAL_UID=999"
LGID="LOCAL_GID=999"
fi
echo $LUID >$ENV_DIR/uid.env
echo $LGID >>$ENV_DIR/uid.env
fi
# Functions
function install() {
@ -140,7 +125,9 @@ function updateLetsEncrypt() {
function updateDatabase() {
pullSetup
docker run -i --rm --name setup --network container:bitwarden-mssql \
dockerComposeFiles
MSSQL_ID=$(docker-compose ps -q mssql)
docker run -i --rm --name setup --network container:$MSSQL_ID \
-v $OUTPUT_DIR:/bitwarden --env-file $ENV_DIR/uid.env bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
echo "Database update complete"
@ -168,7 +155,6 @@ function restart() {
dockerComposePull
updateLetsEncrypt
dockerComposeUp
dockerPrune
printEnvironment
}
@ -198,6 +184,7 @@ then
dockerComposeDown
update withpull
restart
dockerPrune
echo "Pausing 60 seconds for database to come online. Please wait..."
sleep 60
updateDatabase

@ -43,7 +43,7 @@ namespace Bit.Setup
_context.Config.Ssl = true;
_context.Install.Trusted = false;
_context.Install.SelfSignedCert = true;
Helpers.Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -days 365 " +
Helpers.Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -days 36500 " +
$"-keyout /bitwarden/ssl/self/{_context.Install.Domain}/private.key " +
$"-out /bitwarden/ssl/self/{_context.Install.Domain}/certificate.crt " +
$"-reqexts SAN -extensions SAN " +
@ -70,7 +70,7 @@ namespace Bit.Setup
_context.Install.IdentityCertPassword = Helpers.SecureRandomString(32, alpha: true, numeric: true);
Directory.CreateDirectory("/bitwarden/identity/");
Helpers.Exec("openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout identity.key " +
"-out identity.crt -subj \"/CN=Bitwarden IdentityServer\" -days 10950");
"-out identity.crt -subj \"/CN=Bitwarden IdentityServer\" -days 36500");
Helpers.Exec("openssl pkcs12 -export -out /bitwarden/identity/identity.pfx -inkey identity.key " +
$"-in identity.crt -certfile identity.crt -passout pass:{_context.Install.IdentityCertPassword}");