fix(scripts: remove deprecated scripts check-ssl.sh and purge-dynu.sh
This commit is contained in:
1 parent
0c3367052c
commit
4d998f67f4
2 files changed
-88
No files matched your search
@@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# List of domains to check
|
|
||||||
DOMAINS=(
|
|
||||||
"arch-services.mywire.org"
|
|
||||||
"auth.arch-services.mywire.org"
|
|
||||||
"excalidraw.arch-services.mywire.org"
|
|
||||||
"gitea.arch-services.mywire.org"
|
|
||||||
"jellyfin.arch-services.mywire.org"
|
|
||||||
"learning.arch-services.mywire.org"
|
|
||||||
"logs.arch-services.mywire.org"
|
|
||||||
"mermaid.arch-services.mywire.org"
|
|
||||||
"ollama.arch-services.mywire.org"
|
|
||||||
"portainer.arch-services.mywire.org"
|
|
||||||
"traefik.arch-services.mywire.org"
|
|
||||||
)
|
|
||||||
|
|
||||||
printf "%-40s | %-30s | %-30s | %-20s\n" "Domain" "Issuer (CN)" "Subject (CN)" "Expiry"
|
|
||||||
printf "%-40s-|-%-30s-|-%-30s-|-%-20s\n" "----------------------------------------" "------------------------------" "------------------------------" "--------------------"
|
|
||||||
|
|
||||||
for domain in "${DOMAINS[@]}"; do
|
|
||||||
# Use timeout to avoid hanging on failed connections
|
|
||||||
cert_info=$(timeout 5 bash -c "echo | openssl s_client -showcerts -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -noout -issuer -subject -enddate 2>/dev/null")
|
|
||||||
|
|
||||||
if [ -z "$cert_info" ]; then
|
|
||||||
printf "%-40s | %-30s | %-30s | %-20s\n" "$domain" "CONNECTION FAILED" "-" "-"
|
|
||||||
else
|
|
||||||
# Extract CN from issuer and subject
|
|
||||||
issuer_cn=$(echo "$cert_info" | grep "issuer" | sed -n 's/.*CN = \([^,]*\).*/\1/p')
|
|
||||||
[ -z "$issuer_cn" ] && issuer_cn=$(echo "$cert_info" | grep "issuer" | sed 's/issuer= //')
|
|
||||||
|
|
||||||
subject_cn=$(echo "$cert_info" | grep "subject" | sed -n 's/.*CN = \([^,]*\).*/\1/p')
|
|
||||||
[ -z "$subject_cn" ] && subject_cn=$(echo "$cert_info" | grep "subject" | sed 's/subject= //')
|
|
||||||
|
|
||||||
expiry=$(echo "$cert_info" | grep "notAfter" | sed 's/notAfter=//')
|
|
||||||
|
|
||||||
printf "%-40s | %-30s | %-30s | %-20s\n" "$domain" "$issuer_cn" "$subject_cn" "$expiry"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Path to your configuration
|
|
||||||
# Changed to project relative path
|
|
||||||
ENV_FILE="${ENV_FILE:-.env}"
|
|
||||||
|
|
||||||
# 1. Load Environment Variables
|
|
||||||
if [ -f "$ENV_FILE" ]; then
|
|
||||||
export $(grep -v '^#' "$ENV_FILE" | xargs)
|
|
||||||
else
|
|
||||||
echo "Error: .env file not found at $ENV_FILE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2. Fetch Domain ID dynamically using the DOMAIN variable
|
|
||||||
echo "Fetching Domain ID for $DOMAIN..."
|
|
||||||
DOMAIN_ID=$(curl -s -X GET "https://api.dynu.com/v2/dns" \
|
|
||||||
-H "API-Key: $DYNU_API_KEY" | \
|
|
||||||
jq -r --arg DOMAIN "$DOMAIN" '.domains[] | select(.name==$DOMAIN) | .id')
|
|
||||||
|
|
||||||
if [ -z "$DOMAIN_ID" ] || [ "$DOMAIN_ID" == "null" ]; then
|
|
||||||
echo "Error: Could not find Domain ID for $DOMAIN. Check your API key and domain name."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Targeting Domain ID: $DOMAIN_ID"
|
|
||||||
|
|
||||||
# 3. Identify and Delete all TXT records
|
|
||||||
echo "Searching for stale TXT records..."
|
|
||||||
TXT_RECORD_IDS=$(curl -s -X GET "https://api.dynu.com/v2/dns/$DOMAIN_ID/record" \
|
|
||||||
-H "API-Key: $DYNU_API_KEY" | \
|
|
||||||
jq -r '.dnsRecords[] | select(.recordType=="TXT") | .id')
|
|
||||||
|
|
||||||
if [ -z "$TXT_RECORD_IDS" ] || [ "$TXT_RECORD_IDS" == "null" ]; then
|
|
||||||
echo "No TXT records found. Quota should be clear."
|
|
||||||
else
|
|
||||||
for ID in $TXT_RECORD_IDS; do
|
|
||||||
echo "Deleting TXT Record ID: $ID"
|
|
||||||
curl -s -X DELETE "https://api.dynu.com/v2/dns/$DOMAIN_ID/record/$ID" \
|
|
||||||
-H "API-Key: $DYNU_API_KEY" > /dev/null
|
|
||||||
done
|
|
||||||
echo "Purge complete."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 4. Restart Traefik to trigger new challenge
|
|
||||||
echo "Restarting Traefik..."
|
|
||||||
docker compose restart traefik
|
|
||||||
|
|
||||||
echo "Process complete. Monitor logs with: docker logs traefik 2>&1 | grep -iE 'acme|dynu'"
|
|
||||||
Reference in new issue
Block a user