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