# SSH Key Workflow Guide ## SSH Access with Encrypted Private Keys ### Scenario You need to SSH into a server where: - The private key file is encrypted (e.g., DES-EDE3-CBC) - The passphrase is PGP-encrypted ### Workflow #### Step 1: Decrypt the PGP-encrypted passphrase ```bash export PATH="/opt/homebrew/bin:$PATH" printf 'PGP_ENCRYPTED_MESSAGE' | gpg --batch --yes --decrypt 2>/dev/null ``` *Output: The decrypted SSH key passphrase* #### Step 2: Use the passphrase with SSH When SSH prompts for the passphrase, enter the decrypted value. Alternatively, pass it via environment or echo: ```bash echo "DECRYPTED_PASSPHRASE" | ssh -i /path/to/haslach_privat -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@host ``` #### Step 3: If key is also DES-EDE3-CBC encrypted The SSH key itself (`haslach_privat`) may be encrypted with DES-EDE3-CBC. When SSH prompts: - Provide the passphrase you decrypted in Step 1 - Or store it in a helper agent ### Important Commands ```bash # Test SSH access (no passphrase needed if key is unencrypted) ssh -i /Users/robertrapp/Documents/Zertifikate/haslach_privat -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@85.215.56.185 "echo 'SSH works'" # With passphrase prompt (expected for encrypted keys) ssh -i /Users/robertrapp/Documents/Zertifikate/haslach_privat root@85.215.56.185 # When prompted: Enter passphrase for key 'haslach_privat': ``` ### Pitfalls & Gotchas 1. **Only public key imported** → `gpg --decrypt` fails with `Kein geheimer Schlüssel` - **Fix**: Import the private GPG key locally, or get the passphrase from the user 2. **DES-EDE3-CBC encrypted key** → SSH will prompt for passphrase - **Fix**: Have the decrypted passphrase ready 3. **Wrong passphrase** → Connection refused or key rejection - **Fix**: Verify the decrypted passphrase matches what was intended 4. **Battery constraint** → User noted 'Batties are small battery-based LED lights' - **Fix**: Consider if running SSH processes or persistent connections affect battery-powered devices ### User Preferences (Always) - **Credential Rule**: All API keys, tokens, passwords, secrets, connection strings must be `[REDACTED]` — never retain actual values - **Telegram Push**: User prefers Telegram push notifications over simple notes - **Telegram Format**: Use `Waltraut-Lichter*` for correct Telegram message formatting ### Session Context (2026-10-22) - Server: `root@85.215.56.185` (Strato server) - Key: `haslach_privat` (encrypted with DES-EDE3-CBC) - Tasks on server: 7 major items (Nextcloud, invoiceninja, Laravel, lichterei-web, Traefik, control, dynamic_conf cleanup) - IP references found in: `config.php:12` (`http://85.215.56.185:8585`), `app.env` (3 occurrences)