Compare commits

...

2 commits

Author SHA1 Message Date
0860072166 feat: zert-check in toolbox (Netzwerk-Kategorie) 2026-04-10 11:21:09 +02:00
ca376f6793 feat: zert-check — SSL-Zertifikate aller motocamp.de Domains prüfen
Alias zert-check, Script in bin/zert-check.
Zeigt Ablaufdatum und verbleibende Tage mit Farbkodierung (grün/gelb/rot).
2026-04-10 11:20:10 +02:00
3 changed files with 78 additions and 0 deletions

View file

@ -319,6 +319,16 @@ TOOLS = [
"/ dog --json example.com | jq",
"dog example.com", "dog", linux=False),
Tool("Netzwerk", "zert-check",
"SSL-Zertifikate aller motocamp.de Domains prüfen",
"Prüft alle motocamp.de Subdomains auf Zertifikatsgültigkeit.\n"
"Zeigt Ablaufdatum und verbleibende Tage mit Farbkodierung:\n"
" grün = ok (>30 Tage)\n"
" gelb = bald fällig (≤30 Tage)\n"
" rot = kritisch (≤7 Tage) oder nicht erreichbar\n"
"Bsp: zert-check",
"zert-check", "zert-check", brew=""),
# ── Text & Daten ─────────────────────────────────────────────────────────
Tool("Text/Daten", "jq",
"JSON-Prozessor für Kommandozeile",

67
bin/zert-check Executable file
View file

@ -0,0 +1,67 @@
#!/usr/bin/env bash
# zert-check — SSL-Zertifikate aller motocamp.de Subdomains prüfen
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
BOLD='\033[1m'
RESET='\033[0m'
DOMAINS=(
motocamp.de
www.motocamp.de
dsm.motocamp.de
akku.motocamp.de
akkudb.motocamp.de
audiobooks.motocamp.de
bitwarden.motocamp.de
calibre.motocamp.de
docs.motocamp.de
git.motocamp.de
grafana.motocamp.de
home.motocamp.de
immich.motocamp.de
iobroker.motocamp.de
mealie.motocamp.de
n8n.motocamp.de
npm.motocamp.de
pairdrop.motocamp.de
paperless.motocamp.de
)
printf "${BOLD}%-35s %-12s %-12s %s${RESET}\n" "Domain" "Läuft ab" "Tage" "Status"
printf '%0.s─' {1..70}; echo
TODAY=$(date +%s)
for domain in "${DOMAINS[@]}"; do
result=$(echo | openssl s_client -connect "${domain}:443" -servername "$domain" 2>/dev/null \
| openssl x509 -noout -enddate 2>/dev/null)
if [[ -z "$result" ]]; then
printf "%-35s ${RED}%-12s${RESET}\n" "$domain" "nicht erreichbar"
continue
fi
enddate=$(echo "$result" | sed 's/notAfter=//')
expiry_epoch=$(date -j -f "%b %d %T %Y %Z" "$enddate" +%s 2>/dev/null \
|| date -d "$enddate" +%s 2>/dev/null)
days_left=$(( (expiry_epoch - TODAY) / 86400 ))
expiry_fmt=$(date -j -f "%b %d %T %Y %Z" "$enddate" "+%d.%m.%Y" 2>/dev/null \
|| date -d "$enddate" "+%d.%m.%Y" 2>/dev/null)
if (( days_left <= 7 )); then
color=$RED
status="KRITISCH"
elif (( days_left <= 30 )); then
color=$YELLOW
status="bald fällig"
else
color=$GREEN
status="ok"
fi
printf "%-35s ${color}%-12s %-12s %s${RESET}\n" \
"$domain" "$expiry_fmt" "${days_left}d" "$status"
done

View file

@ -295,6 +295,7 @@ fi
alias gitsync="~/git-projekte/dotfiles-rene/bin/git-sync-all.sh"
alias mac-sync="curl -fsSL https://git.motocamp.de/rene/dotfiles-rene/raw/branch/main/bin/git-sync-all.sh | bash"
alias zert-check="~/git-projekte/dotfiles-rene/bin/zert-check"
# 8) Conda-Initialisierung
# ----------------------------------------------------------