Fix Typo
parent
a4e76194c4
commit
7a16665ce8
64
mbadmin.jps
64
mbadmin.jps
|
@ -143,6 +143,17 @@ menu:
|
|||
action: remove_ssl_cert
|
||||
settings: sslRemoveConfig
|
||||
successText: "${response.out}"
|
||||
- confirmText: Are you sure you want to clean up certificate references?
|
||||
loadingText: Cleaning certificate references...
|
||||
caption: Clean Certificate References
|
||||
action: clean_cert_references
|
||||
settings: cleanCertConfig
|
||||
successText: "Certificate references cleaned successfully for ${settings.domain}"
|
||||
- confirmText: Are you sure you want to diagnose LiteSpeed configuration?
|
||||
loadingText: Analyzing configuration...
|
||||
caption: Diagnose LiteSpeed Config
|
||||
action: diagnose_litespeed_config
|
||||
successText: "${response.out}"
|
||||
|
||||
settings:
|
||||
checkDomainConfig:
|
||||
|
@ -269,6 +280,13 @@ settings:
|
|||
type: text
|
||||
caption: Comma-separated Domains
|
||||
required: true
|
||||
cleanCertConfig:
|
||||
submitUnchanged: true
|
||||
fields:
|
||||
- name: domain
|
||||
type: text
|
||||
caption: Domain Name
|
||||
required: true
|
||||
|
||||
actions:
|
||||
dynamic_wp_cli:
|
||||
|
@ -630,60 +648,30 @@ actions:
|
|||
cp "${CONF_FILE}" "${BACKUP_FILE}"
|
||||
echo "Created backup at ${BACKUP_FILE}"
|
||||
|
||||
# Create temp file for processing
|
||||
# Clean up process
|
||||
TEMP_FILE=$(mktemp)
|
||||
|
||||
# Clean up certificate references
|
||||
echo "Cleaning up certificate references for ${DOMAIN}..."
|
||||
|
||||
# Use awk with proper quoting and domain variable handling
|
||||
awk -v domain="${DOMAIN}" '
|
||||
BEGIN { in_listener = 0; is_shared = 0; }
|
||||
|
||||
/<listener>/ {
|
||||
in_listener = 1;
|
||||
print;
|
||||
next;
|
||||
}
|
||||
|
||||
/<listener>/ { in_listener = 1; print; next; }
|
||||
in_listener && (/<name>HTTPS<\/name>/ || /<name>HTTPS-ipv6<\/name>/) {
|
||||
is_shared = 1;
|
||||
print;
|
||||
next;
|
||||
is_shared = 1; print; next;
|
||||
}
|
||||
|
||||
in_listener && is_shared && /<keyFile>.*live\/'"${DOMAIN}"'\/.*<\/keyFile>/ {
|
||||
print " <keyFile>/var/www/conf/default.key</keyFile>";
|
||||
next;
|
||||
print " <keyFile>/var/www/conf/default.key</keyFile>"; next;
|
||||
}
|
||||
|
||||
in_listener && is_shared && /<certFile>.*live\/'"${DOMAIN}"'\/.*<\/certFile>/ {
|
||||
print " <certFile>/var/www/conf/default.crt</certFile>";
|
||||
next;
|
||||
print " <certFile>/var/www/conf/default.crt</certFile>"; next;
|
||||
}
|
||||
|
||||
/<\/listener>/ {
|
||||
in_listener = 0;
|
||||
is_shared = 0;
|
||||
print;
|
||||
next;
|
||||
}
|
||||
|
||||
/<\/listener>/ { in_listener = 0; is_shared = 0; print; next; }
|
||||
{ print; }
|
||||
' "${CONF_FILE}" > "${TEMP_FILE}"
|
||||
|
||||
# Verify the file is valid
|
||||
if grep -q "<httpServerConfig>" "${TEMP_FILE}" && grep -q "</httpServerConfig>" "${TEMP_FILE}"; then
|
||||
# Apply changes
|
||||
if grep -q "<httpServerConfig>" "${TEMP_FILE}"; then
|
||||
cat "${TEMP_FILE}" > "${CONF_FILE}"
|
||||
rm -f "${TEMP_FILE}"
|
||||
echo "Certificate references cleaned up successfully."
|
||||
|
||||
# Restart LiteSpeed
|
||||
echo "Restarting LiteSpeed..."
|
||||
systemctl restart lsws
|
||||
else
|
||||
echo "ERROR: Generated config is invalid. Keeping original configuration."
|
||||
echo "ERROR: Invalid config generated"
|
||||
rm -f "${TEMP_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue