mirror of
https://github.com/outbackdingo/labca.git
synced 2026-01-27 10:19:34 +00:00
Several fixes and tweaks
This commit is contained in:
@@ -258,7 +258,7 @@ case $txt in
|
||||
;;
|
||||
"backup-restore")
|
||||
read backup
|
||||
/opt/labca/restore "$backup"
|
||||
/opt/labca/restore "$backup" &>>$LOGFILE
|
||||
sleep 3
|
||||
;;
|
||||
"server-restart")
|
||||
|
||||
@@ -2501,8 +2501,9 @@ func _setupAdminUser(w http.ResponseWriter, r *http.Request) bool {
|
||||
|
||||
err = _applyConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
reg.Errors["File"] = "Could not apply config after importing backup"
|
||||
fmt.Println("Could not apply config, trying to migrate by restarting...")
|
||||
_hostCommand(w, r, "labca-restart")
|
||||
reg.Errors["File"] = "Could not apply config, trying to migrate by restarting..."
|
||||
render(w, r, "register:manage", map[string]interface{}{"User": reg, "IsLogin": true, "Progress": _progress("register"), "HelpText": _helptext("register")})
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
$("#cert-submit").prop('disabled', !$("#numdays-error").hasClass('hidden'));
|
||||
$("#generatebtn").prop('disabled', !$("#numdays-error").hasClass('hidden'));
|
||||
}
|
||||
|
||||
$.fn.inputFilter = function(callback, errMsg) {
|
||||
@@ -343,6 +343,14 @@
|
||||
return /^\d*$/.test(value); // Allow digits only, using a RegExp
|
||||
},"Only digits are allowed");
|
||||
|
||||
$("#certificate").change(function() {
|
||||
$("#cert-submit").prop('disabled', ($("#certificate").val() == "" && $("#key").val() == ""));
|
||||
})
|
||||
|
||||
$("#key").change(function() {
|
||||
$("#cert-submit").prop('disabled', ($("#certificate").val() == "" && $("#key").val() == ""));
|
||||
})
|
||||
|
||||
updateEndDate();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
func CheckUpgrades() {
|
||||
v := viper.GetString("version")
|
||||
if standaloneVersion == "" {
|
||||
gitVersion := controlCommand("git-version")
|
||||
gitVersion := controlCommand("git-version", true)
|
||||
if gitVersion != "" {
|
||||
viper.Set("version", gitVersion)
|
||||
viper.Set("version", strings.TrimSpace(gitVersion))
|
||||
viper.WriteConfig()
|
||||
}
|
||||
} else if v != standaloneVersion {
|
||||
@@ -33,13 +33,13 @@ func CheckUpgrades() {
|
||||
if changed {
|
||||
time.Sleep(2 * time.Second)
|
||||
log.Println("Applying updated configuration...")
|
||||
controlCommand("apply")
|
||||
controlCommand("apply", false)
|
||||
time.Sleep(2 * time.Second)
|
||||
log.Println("Updating CRL links if needed...")
|
||||
controlCommand("check-crl")
|
||||
controlCommand("check-crl", false)
|
||||
time.Sleep(2 * time.Second)
|
||||
log.Println("Restarting boulder containers...")
|
||||
controlCommand("boulder-restart")
|
||||
controlCommand("boulder-restart", false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,12 @@ func readFileAsString(filename string) string {
|
||||
return string(read)
|
||||
}
|
||||
|
||||
func controlCommand(command string) string {
|
||||
func controlCommand(command string, ignoreError bool) string {
|
||||
conn, err := net.Dial("tcp", "control:3030")
|
||||
if err != nil {
|
||||
if ignoreError {
|
||||
return ""
|
||||
}
|
||||
log.Println("**** Failed to connect to control container!")
|
||||
time.Sleep(1 * time.Minute)
|
||||
os.Exit(1)
|
||||
|
||||
2
install
2
install
@@ -305,7 +305,7 @@ parse_cmdline() {
|
||||
-t|--test)
|
||||
alphaTest=1
|
||||
shift 1
|
||||
msg_ok "option: INCLUDING ALPHA TEST STEPS"
|
||||
msg_ok "option: build docker images locally"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
|
||||
14
restore
14
restore
@@ -25,10 +25,16 @@ vrs=$(grep version /opt/labca/data/config.json | sed -e 's/.*:[ ]*//' | sed -e '
|
||||
rm -rf /opt/labca/data/* && mv $TMPDIR/data/* /opt/labca/data/
|
||||
sed -i -e "s/\"version\": \".*\"/\"version\": \"$vrs\"/" /opt/labca/data/config.json
|
||||
|
||||
[ -d $TMPDIR/webpki ] || (echo "Public CA files backup not found"; exit 1)
|
||||
rm -rf /opt/boulder/labca/certs/webpki/* && mv $TMPDIR/webpki/* /opt/boulder/labca/certs/webpki/
|
||||
if [ -d $TMPDIR/webpki ]; then
|
||||
rm -rf /opt/boulder/labca/certs/webpki/* && mv $TMPDIR/webpki/* /opt/boulder/labca/certs/webpki/
|
||||
else
|
||||
echo "WARNING: public CA files not found in backup"
|
||||
fi
|
||||
|
||||
[ -d $TMPDIR/tokens ] || (echo "SoftHSMv2 tokens folder backup not found"; exit 1)
|
||||
rm -rf /var/lib/softhsm/tokens/* && mv $TMPDIR/tokens/* /var/lib/softhsm/tokens/
|
||||
if [ -d $TMPDIR/tokens ]; then
|
||||
rm -rf /var/lib/softhsm/tokens/* && mv $TMPDIR/tokens/* /var/lib/softhsm/tokens/
|
||||
else
|
||||
echo "WARNING: SoftHSMv2 tokens folder not found in backup"
|
||||
fi
|
||||
|
||||
rm -rf $TMPDIR
|
||||
|
||||
Reference in New Issue
Block a user