Resolved multiple critical discovery system issues: ## Discovery System Fixes - Fixed console commands not being discovered on first run - Implemented fallback discovery for empty caches - Added context-aware caching with separate cache keys - Fixed object serialization preventing __PHP_Incomplete_Class ## Cache System Improvements - Smart caching that only caches meaningful results - Separate caches for different execution contexts (console, web, test) - Proper array serialization/deserialization for cache compatibility - Cache hit logging for debugging and monitoring ## Object Serialization Fixes - Fixed DiscoveredAttribute serialization with proper string conversion - Sanitized additional data to prevent object reference issues - Added fallback for corrupted cache entries ## Performance & Reliability - All 69 console commands properly discovered and cached - 534 total discovery items successfully cached and restored - No more __PHP_Incomplete_Class cache corruption - Improved error handling and graceful fallbacks ## Testing & Quality - Fixed code style issues across discovery components - Enhanced logging for better debugging capabilities - Improved cache validation and error recovery Ready for production deployment with stable discovery system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
127 lines
3.9 KiB
YAML
127 lines
3.9 KiB
YAML
---
|
|
# WireGuard Server konfigurieren
|
|
- name: Erstelle WireGuard-Verzeichnis
|
|
file:
|
|
path: /etc/wireguard
|
|
state: directory
|
|
mode: '0700'
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Erstelle Client-Config-Verzeichnis
|
|
file:
|
|
path: /etc/wireguard/clients
|
|
state: directory
|
|
mode: '0700'
|
|
owner: root
|
|
group: root
|
|
|
|
# Server-Schlüssel verwalten
|
|
- name: Prüfe ob Server-Schlüssel existieren
|
|
stat:
|
|
path: /etc/wireguard/server-private.key
|
|
register: server_private_key_stat
|
|
|
|
- name: Generiere Server-Schlüssel
|
|
shell: |
|
|
wg genkey | tee /etc/wireguard/server-private.key | wg pubkey > /etc/wireguard/server-public.key
|
|
chmod 600 /etc/wireguard/server-private.key /etc/wireguard/server-public.key
|
|
when: not server_private_key_stat.stat.exists
|
|
|
|
- name: Lese Server-Schlüssel
|
|
slurp:
|
|
src: /etc/wireguard/server-private.key
|
|
register: server_private_key_content
|
|
|
|
- name: Lese Server-Public-Key
|
|
slurp:
|
|
src: /etc/wireguard/server-public.key
|
|
register: server_public_key_content
|
|
|
|
- name: Setze Server-Schlüssel als Facts
|
|
set_fact:
|
|
wg_server_private_key: "{{ server_private_key_content.content | b64decode | trim }}"
|
|
wg_server_public_key: "{{ server_public_key_content.content | b64decode | trim }}"
|
|
|
|
# Client-Schlüssel generieren
|
|
- name: Generiere Client-Schlüssel
|
|
shell: |
|
|
cd /etc/wireguard/clients
|
|
if [ ! -f "{{ item.name }}-private.key" ]; then
|
|
wg genkey | tee "{{ item.name }}-private.key" | wg pubkey > "{{ item.name }}-public.key"
|
|
chmod 600 "{{ item.name }}-private.key" "{{ item.name }}-public.key"
|
|
fi
|
|
loop: "{{ wireguard_clients }}"
|
|
|
|
# Generiere Pre-shared Keys
|
|
- name: Generiere Pre-shared Keys für Clients
|
|
shell: |
|
|
cd /etc/wireguard/clients
|
|
if [ ! -f "{{ item.name }}-psk.key" ]; then
|
|
wg genpsk > "{{ item.name }}-psk.key"
|
|
chmod 600 "{{ item.name }}-psk.key"
|
|
fi
|
|
loop: "{{ wireguard_clients }}"
|
|
when: wireguard_pre_shared_key | default(false)
|
|
|
|
# Lade alle Client-Keys
|
|
- name: Lese Client-Private-Keys
|
|
slurp:
|
|
src: /etc/wireguard/clients/{{ item.name }}-private.key
|
|
loop: "{{ wireguard_clients }}"
|
|
register: client_private_keys
|
|
|
|
- name: Lese Client-Public-Keys
|
|
slurp:
|
|
src: /etc/wireguard/clients/{{ item.name }}-public.key
|
|
loop: "{{ wireguard_clients }}"
|
|
register: client_public_keys
|
|
|
|
- name: Lese Pre-shared Keys
|
|
slurp:
|
|
src: /etc/wireguard/clients/{{ item.name }}-psk.key
|
|
loop: "{{ wireguard_clients }}"
|
|
register: client_psk_keys
|
|
when: wireguard_pre_shared_key | default(false)
|
|
|
|
# Erstelle Key-Dictionaries
|
|
- name: Erstelle Client-Key-Dictionary
|
|
set_fact:
|
|
wg_client_private_keys: "{{ dict(wireguard_clients | map(attribute='name') | list | zip(client_private_keys.results | map(attribute='content') | map('b64decode') | map('trim') | list)) }}"
|
|
wg_client_public_keys: "{{ dict(wireguard_clients | map(attribute='name') | list | zip(client_public_keys.results | map(attribute='content') | map('b64decode') | map('trim') | list)) }}"
|
|
|
|
- name: Erstelle Pre-shared Key Dictionary
|
|
set_fact:
|
|
wg_client_psk_keys: "{{ dict(wireguard_clients | map(attribute='name') | list | zip(client_psk_keys.results | map(attribute='content') | map('b64decode') | map('trim') | list)) }}"
|
|
when:
|
|
- wireguard_pre_shared_key | default(false)
|
|
- client_psk_keys is defined
|
|
|
|
# Server-Konfiguration erstellen
|
|
- name: Erstelle WireGuard-Server-Konfiguration
|
|
template:
|
|
src: wg0.conf.j2
|
|
dest: /etc/wireguard/wg0.conf
|
|
mode: '0600'
|
|
owner: root
|
|
group: root
|
|
notify: restart wireguard
|
|
|
|
# Client-Konfigurationen erstellen
|
|
- name: Erstelle Client-Konfigurationen
|
|
template:
|
|
src: client.conf.j2
|
|
dest: /etc/wireguard/clients/{{ item.name }}.conf
|
|
mode: '0600'
|
|
owner: root
|
|
group: root
|
|
loop: "{{ wireguard_clients }}"
|
|
|
|
# WireGuard-Service konfigurieren
|
|
- name: Aktiviere WireGuard-Service
|
|
systemd:
|
|
name: wg-quick@wg0
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: true
|