Fixed command not found
parent
a81cac18bf
commit
798f36ab4b
25
mbadmin.jps
25
mbadmin.jps
|
@ -588,19 +588,24 @@ actions:
|
||||||
type: info
|
type: info
|
||||||
message: "${response.out}"
|
message: "${response.out}"
|
||||||
remove_ssl_cert:
|
remove_ssl_cert:
|
||||||
|
- if: ${settings.confirm} != true
|
||||||
|
return:
|
||||||
|
type: error
|
||||||
|
message: "Confirmation checkbox must be checked to proceed with certificate removal."
|
||||||
|
|
||||||
- cmd[cp]:
|
- cmd[cp]:
|
||||||
user: root
|
user: root
|
||||||
commands:
|
commands:
|
||||||
- >
|
- bash /home/litespeed/mbmanager/ssl-manager/ssl_manager.sh --domain="${settings.domain}" --remove-cert=yes --confirm=yes
|
||||||
if [[ "${settings.confirm}" == "true" ]]; then
|
|
||||||
bash /home/litespeed/mbmanager/ssl-manager/ssl_manager.sh --domain="${settings.domain}" --remove-cert=yes --confirm=yes
|
- if: ${response.exitcode} == 0
|
||||||
else
|
return:
|
||||||
echo "Confirmation checkbox must be checked to proceed with certificate removal."
|
type: success
|
||||||
exit 1
|
message: "SSL certificate for '${settings.domain}' has been successfully removed."
|
||||||
fi
|
- else:
|
||||||
- return:
|
return:
|
||||||
type: info
|
type: error
|
||||||
message: "${response.out}"
|
message: "Failed to remove SSL certificate: ${response.out}"
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
enableSuccess:
|
enableSuccess:
|
||||||
|
|
|
@ -764,11 +764,15 @@ remove_ssl_certificate() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the HTTPS-domain listener section
|
# Remove the HTTPS-domain listener section - find both <name> and <n> tags to handle inconsistencies
|
||||||
|
grep -n -E "<(name|n)>HTTPS-${domain}</(name|n)>" "$config_file" > /dev/null || {
|
||||||
|
log "No listener found for domain ${domain}, continuing with certificate removal only.";
|
||||||
|
}
|
||||||
|
|
||||||
awk -v domain="$domain" '
|
awk -v domain="$domain" '
|
||||||
BEGIN { skip = 0; }
|
BEGIN { skip = 0; }
|
||||||
/<name>HTTPS-'"$domain"'<\/name>/,/<\/listener>/ {
|
/HTTPS-'"$domain"'/,/<\/listener>/ {
|
||||||
if ($0 ~ /<name>HTTPS-'"$domain"'<\/name>/) {
|
if ($0 ~ /HTTPS-'"$domain"'/) {
|
||||||
skip = 1;
|
skip = 1;
|
||||||
print "<!-- Listener for " domain " removed by ssl_manager.sh -->";
|
print "<!-- Listener for " domain " removed by ssl_manager.sh -->";
|
||||||
}
|
}
|
||||||
|
@ -785,21 +789,29 @@ remove_ssl_certificate() {
|
||||||
log "Removing domain-specific virtual host if it exists..."
|
log "Removing domain-specific virtual host if it exists..."
|
||||||
local vhost_name="${domain//[.]/_}"
|
local vhost_name="${domain//[.]/_}"
|
||||||
|
|
||||||
awk -v vhost="$vhost_name" '
|
# Check if virtualhost exists
|
||||||
BEGIN { skip = 0; }
|
grep -n -E "<(name|n)>${vhost_name}</(name|n)>" "$config_file" > /dev/null || {
|
||||||
/<name>'"$vhost"'<\/name>/,/<\/virtualHost>/ {
|
log "No virtual host found for ${vhost_name}, skipping this step.";
|
||||||
if ($0 ~ /<name>'"$vhost"'<\/name>/) {
|
cp "$temp_file" "${temp_file}.new";
|
||||||
skip = 1;
|
|
||||||
print "<!-- VirtualHost for " vhost " removed by ssl_manager.sh -->";
|
|
||||||
}
|
|
||||||
if ($0 ~ /<\/virtualHost>/ && skip == 1) {
|
|
||||||
skip = 0;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if (skip) next;
|
|
||||||
}
|
}
|
||||||
{ if (!skip) print; }
|
|
||||||
' "$temp_file" > "${temp_file}.new"
|
if [ ! -f "${temp_file}.new" ]; then
|
||||||
|
awk -v vhost="$vhost_name" '
|
||||||
|
BEGIN { skip = 0; }
|
||||||
|
/'"$vhost"'/,/<\/virtualHost>/ {
|
||||||
|
if ($0 ~ /'"$vhost"'/) {
|
||||||
|
skip = 1;
|
||||||
|
print "<!-- VirtualHost for " vhost " removed by ssl_manager.sh -->";
|
||||||
|
}
|
||||||
|
if ($0 ~ /<\/virtualHost>/ && skip == 1) {
|
||||||
|
skip = 0;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if (skip) next;
|
||||||
|
}
|
||||||
|
{ if (!skip) print; }
|
||||||
|
' "$temp_file" > "${temp_file}.new"
|
||||||
|
fi
|
||||||
|
|
||||||
# 4. Remove any domain mappings from shared listeners
|
# 4. Remove any domain mappings from shared listeners
|
||||||
log "Removing domain mappings from shared listeners..."
|
log "Removing domain mappings from shared listeners..."
|
||||||
|
|
Loading…
Reference in New Issue