This repository was archived by the owner on Jul 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Cloudflare API Token Validator für OliveTin
3+
4+ TOKEN=" $1 "
5+
6+ if [ -z " $TOKEN " ]; then
7+ echo " ❌ Fehler: Kein Token angegeben!"
8+ exit 1
9+ fi
10+
11+ echo " Prüfe Token gegen Cloudflare API..."
12+
13+ # Token verifizieren
14+ RESPONSE=$( curl -s -X GET " https://api.cloudflare.com/client/v4/user/tokens/verify"
15+ -H " Authorization: Bearer $TOKEN "
16+ -H " Content-Type: application/json" )
17+
18+ # Prüfen, ob "success": true in der Antwort steht (mit jq)
19+ IS_VALID=$( echo " $RESPONSE " | jq -r ' .success' )
20+ STATUS=$( echo " $RESPONSE " | jq -r ' .messages[0].message' )
21+
22+ if [ " $IS_VALID " == " true" ]; then
23+ echo " ✅ ERFOLG: Der API Key ist GÜLTIG!"
24+ echo " Status: $STATUS "
25+ exit 0
26+ else
27+ echo " ❌ FEHLER: Der API Key ist UNGÜLTIG oder hat keine Rechte!"
28+ # Zeige die Fehlermeldung von Cloudflare an, bereinigt
29+ ERROR_MSG=$( echo " $RESPONSE " | jq -r ' .errors[0].message' )
30+ echo " Grund: $ERROR_MSG "
31+ exit 1
32+ fi
Original file line number Diff line number Diff line change 2222 # SRE: Pakete für die Shell-Aktionen bereitstellen
2323 path = with pkgs ; [
2424 bash openssl jq coreutils gnused systemd
25- nixos-rebuild nix-output-monitor
25+ nixos-rebuild nix-output-monitor curl
2626 ] ;
2727
2828 settings = {
4040 }
4141 {
4242 title = "mTLS: Neues Client-Zertifikat erstellen" ;
43- shell = "sudo ${ mtlsScript } 'browser-client '" ;
43+ shell = "sudo ${ mtlsScript } '{{ cert_name }} '" ;
4444 icon = "🔒" ;
45+ arguments = [
46+ {
47+ name = "cert_name" ;
48+ type = "ascii" ;
49+ description = "Name für das Zertifikat (z.B. handy-moritz)" ;
50+ }
51+ ] ;
52+ }
53+ {
54+ title = "API Key: Cloudflare Token prüfen" ;
55+ shell = "/etc/nixos/00-core/scripts/validate-cloudflare-key.sh '{{ cf_token }}'" ;
56+ icon = "🔑" ;
57+ arguments = [
58+ {
59+ name = "cf_token" ;
60+ type = "ascii" ;
61+ description = "Cloudflare API Token einfügen (wird direkt gegen die API geprüft)" ;
62+ }
63+ ] ;
4564 }
4665 {
4766 title = "mTLS: Download-Link anzeigen" ;
You can’t perform that action at this time.
0 commit comments