mirror of
https://github.com/bitwarden/server.git
synced 2025-02-22 02:51:33 +01:00
Added force renew certificate (#781)
This commit is contained in:
parent
48d166e80e
commit
5977803e3b
@ -6,6 +6,7 @@ param (
|
||||
[switch] $update,
|
||||
[switch] $rebuild,
|
||||
[switch] $updateconf,
|
||||
[switch] $renewcert,
|
||||
[switch] $updatedb,
|
||||
[switch] $updaterun,
|
||||
[switch] $updateself,
|
||||
@ -64,6 +65,7 @@ Available commands:
|
||||
-updaterun
|
||||
-updateself
|
||||
-updateconf
|
||||
-renewcert
|
||||
-rebuild
|
||||
-help
|
||||
|
||||
@ -137,6 +139,10 @@ elseif ($stop) {
|
||||
Check-Output-Dir-Exists
|
||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -stop -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif ($renewcert) {
|
||||
Check-Output-Dir-Exists
|
||||
Invoke-Expression "& `"$scriptsDir\run.ps1`" -renewcert -outputDir `"$output`" -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif ($updaterun) {
|
||||
Check-Output-Dir-Exists
|
||||
Download-Run-File
|
||||
|
@ -91,6 +91,7 @@ updatedb
|
||||
updaterun
|
||||
updateself
|
||||
updateconf
|
||||
renewcert
|
||||
rebuild
|
||||
help
|
||||
|
||||
@ -132,6 +133,10 @@ elif [ "$1" == "stop" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
$SCRIPTS_DIR/run.sh stop $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "renewcert" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
$SCRIPTS_DIR/run.sh renewcert $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "updaterun" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
|
@ -8,6 +8,7 @@ param (
|
||||
[switch] $stop,
|
||||
[switch] $pull,
|
||||
[switch] $updateconf,
|
||||
[switch] $renewcert,
|
||||
[switch] $updatedb,
|
||||
[switch] $update
|
||||
)
|
||||
@ -139,6 +140,16 @@ function Update-Lets-Encrypt {
|
||||
}
|
||||
}
|
||||
|
||||
function Force-Update-Lets-Encrypt {
|
||||
if (Test-Path -Path "${outputDir}\letsencrypt\live") {
|
||||
Invoke-Expression ("docker pull{0} certbot/certbot" -f "") #TODO: qFlag
|
||||
$certbotExp = "docker run -it --rm --name certbot -p ${certbotHttpsPort}:443 -p ${certbotHttpPort}:80 " +`
|
||||
"-v ${outputDir}/letsencrypt:/etc/letsencrypt/ certbot/certbot " +`
|
||||
"renew{0} --logs-dir /etc/letsencrypt/logs --force-renew" -f $qFlag
|
||||
Invoke-Expression $certbotExp
|
||||
}
|
||||
}
|
||||
|
||||
function Update-Database {
|
||||
Pull-Setup
|
||||
Docker-Compose-Files
|
||||
@ -171,6 +182,15 @@ function Restart {
|
||||
Print-Environment
|
||||
}
|
||||
|
||||
function certRestart {
|
||||
Docker-Compose-Down
|
||||
Docker-Compose-Pull
|
||||
Force-Update-Lets-Encrypt
|
||||
Docker-Compose-Up
|
||||
Print-Environment
|
||||
}
|
||||
|
||||
|
||||
function Pull-Setup {
|
||||
Invoke-Expression ("docker pull{0} bitwarden/setup:${coreVersion}" -f "") #TODO: qFlag
|
||||
}
|
||||
@ -195,6 +215,9 @@ elseif ($pull) {
|
||||
elseif ($stop) {
|
||||
Docker-Compose-Down
|
||||
}
|
||||
elseif ($renewcert) {
|
||||
certRestart
|
||||
}
|
||||
elseif ($updateconf) {
|
||||
Docker-Compose-Down
|
||||
Update -withpull
|
||||
|
@ -148,6 +148,16 @@ function updateLetsEncrypt() {
|
||||
fi
|
||||
}
|
||||
|
||||
function forceupdateLetsEncrypt() {
|
||||
if [ -d "${OUTPUT_DIR}/letsencrypt/live" ]
|
||||
then
|
||||
docker pull certbot/certbot
|
||||
docker run -i --rm --name certbot -p 443:443 -p 80:80 \
|
||||
-v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
renew --logs-dir /etc/letsencrypt/logs --force-renew
|
||||
fi
|
||||
}
|
||||
|
||||
function updateDatabase() {
|
||||
pullSetup
|
||||
dockerComposeFiles
|
||||
@ -183,6 +193,14 @@ function restart() {
|
||||
printEnvironment
|
||||
}
|
||||
|
||||
function certrestart() {
|
||||
dockerComposeDown
|
||||
dockerComposePull
|
||||
forceupdateLetsEncrypt
|
||||
dockerComposeUp
|
||||
printEnvironment
|
||||
}
|
||||
|
||||
function pullSetup() {
|
||||
docker pull bitwarden/setup:$COREVERSION
|
||||
}
|
||||
@ -201,6 +219,9 @@ then
|
||||
elif [ "$1" == "stop" ]
|
||||
then
|
||||
dockerComposeDown
|
||||
elif [ "$1" == "renewcert" ]
|
||||
then
|
||||
certrestart
|
||||
elif [ "$1" == "updateconf" ]
|
||||
then
|
||||
dockerComposeDown
|
||||
|
Loading…
Reference in New Issue
Block a user