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