1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-21 04:55:08 -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

View File

@ -115,7 +115,9 @@ function Update-Lets-Encrypt {
function Update-Database { function Update-Database {
Pull-Setup 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 ` -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
dotnet Setup.dll -update 1 -db 1 -os win -corev $coreVersion -webv $webVersion -q $setupQuiet dotnet Setup.dll -update 1 -db 1 -os win -corev $coreVersion -webv $webVersion -q $setupQuiet
Write-Line "Database update complete" Write-Line "Database update complete"
@ -140,7 +142,6 @@ function Restart {
Docker-Compose-Pull Docker-Compose-Pull
Update-Lets-Encrypt Update-Lets-Encrypt
Docker-Compose-Up Docker-Compose-Up
Docker-Prune
Print-Environment Print-Environment
} }
@ -175,6 +176,7 @@ elseif ($update) {
Docker-Compose-Down Docker-Compose-Down
Update -withpull Update -withpull
Restart Restart
Docker-Prune
Write-Line "Pausing 60 seconds for database to come online. Please wait..." Write-Line "Pausing 60 seconds for database to come online. Please wait..."
Start-Sleep -s 60 Start-Sleep -s 60
Update-Database Update-Database

View File

@ -43,21 +43,6 @@ then
echo $LGID >>$ENV_DIR/uid.env echo $LGID >>$ENV_DIR/uid.env
fi 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 # Functions
function install() { function install() {
@ -140,7 +125,9 @@ function updateLetsEncrypt() {
function updateDatabase() { function updateDatabase() {
pullSetup 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 \ -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 dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
echo "Database update complete" echo "Database update complete"
@ -168,7 +155,6 @@ function restart() {
dockerComposePull dockerComposePull
updateLetsEncrypt updateLetsEncrypt
dockerComposeUp dockerComposeUp
dockerPrune
printEnvironment printEnvironment
} }
@ -198,6 +184,7 @@ then
dockerComposeDown dockerComposeDown
update withpull update withpull
restart restart
dockerPrune
echo "Pausing 60 seconds for database to come online. Please wait..." echo "Pausing 60 seconds for database to come online. Please wait..."
sleep 60 sleep 60
updateDatabase updateDatabase

View File

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