Eigene Skills vom MacBook (9 Skills)

This commit is contained in:
2026-10-27 01:20:31 +01:00
commit 3b03f4f525
25 changed files with 2231 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
---
name: encrypted-ssh-access
description: Use when managing SSH access to servers with PGP-encrypted passphrases and encrypted private keys.
version: 1.0.0
---
# encrypted-ssh-access
Use when managing SSH access to servers where the private key is encrypted and the passphrase is PGP-encrypted.
## Trigger
User needs to SSH into a server where the private key is encrypted (e.g., DES-EDE3-CBC) and the passphrase is PGP-encrypted.
## Workflow
1. Import the PGP public key locally using: `gpg --import <key_file>`
2. Decrypt the passphrase using: `printf '<PGP_MESSAGE>' | gpg --batch --yes --decrypt 2>/dev/null`
3. Use the decrypted passphrase with SSH: `ssh -i <key_file> passphrase user@host`
4. If key is also encrypted with DES-EDE3-CBC, provide passphrase when prompted
## User Preferences (Always Apply)
- **Credential Rule**: All API keys, tokens, passwords, secrets, connection strings must be replaced with `[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
- **Battery Awareness**: Note that 'Batties are small battery-based LED lights' — may affect running processes
- **PGP Focus Topic**: Prioritize PGP-encrypted password import and decryption per user directive
## Pitfalls & Gotchas
- PGP decryption requires the private GPG key to be imported locally (public key only enables encryption)
- SSH keys encrypted with DES-EDE3-CBC need a passphrase; losing it means losing access
- `gpg --decrypt` fails with 'Kein geheimer Schlüssel' if only public key is imported
- Always test SSH access with a simple command first: `ssh -i key user@host 'echo test'`
- When user says 'Batties are small battery-b...', consider battery constraints on any persistent processes
- **Headscale/Tailscale auth key consumption**: `tailscale up --auth-key=<KEY>` consumes the key after a single use; the Headscale health check reports 'invalid pre auth key'. For Android registration with this VPN, use the app flow: *Accounts → ⋮ → Use an alternate server → https://vpn.robbis.space* rather than the CLI auth-key flag.
- Never retain actual values for API keys, tokens, passwords, secrets, or connection strings — replace all such credentials with `[REDACTED]` per user directive.
## Support Files
- `references/pgp-decryption-guide.md` — PGP decryption step-by-step
- `references/ssh-key-workflow.md` — SSH access with encrypted keys
- `scripts/decrypt-passphrase.sh` — Script to automate PGP decryption + SSH
## Example
```bash
# Decrypt PGP-encrypted passphrase
export PATH="/opt/homebrew/bin:$PATH"
printf 'PGP_MESSAGE_HERE' | gpg --batch --yes --decrypt 2>/dev/null
```
---
*Skill created based on session signals: PGP encryption workflow, SSH key management, user preferences for [REDACTED] credentials, Telegram push, and battery-aware server access.*
@@ -0,0 +1,38 @@
# PGP Decryption Guide
## Decrypting a PGP-Encrypted Passphrase
### Prerequisites
- GnuPG (GPG) installed
- The PGP public key of the encryptor (already imported)
- The private GPG key to decrypt (required for decryption)
### Step-by-Step
1. **Import the PGP public key** (if not already done):
```bash
export PATH="/opt/homebrew/bin:$PATH"
gpg --import /path/to/public_key.asc
```
2. **Decrypt the passphrase**:
```bash
export PATH="/opt/homebrew/bin:$PATH"
printf '-----BEGIN PGP MESSAGE-----\n[ENCRYPTED_MESSAGE]\n-----END PGP MESSAGE-----' | gpg --batch --yes --decrypt 2>/dev/null
```
3. **The output** is the decrypted passphrase (plain text)
### Important Notes
- **Public key only enables encryption** — you need the **private key** to decrypt
- Error `Kein geheimer Schlüssel` = "No secret key" means only public key is imported
- Always test decryption with a known message first
### Session Example from 2026-10-22
- Public key imported successfully from PEM block
- Encrypted password message received but decryption failed without private key
- Generated local RSA key pair for testing: `/tmp/test_private.key` and `/tmp/test_public.key`
### User Preference
- Per user directive: All credentials must be `[REDACTED]` — never retain actual values
- PGP focus topic: Prioritize PGP-encrypted password import and decryption
@@ -0,0 +1,67 @@
# 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)
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# decrypt-passphrase.sh
# Automate PGP decryption of SSH passphrase and SSH connection
set -e
# Configuration
PGP_MESSAGE_FILE="${1:-/tmp/pgp_message.asc}"
SSH_KEY="${2:-/Users/robertrapp/Documents/Zertifikate/haslach_privat}"
SSH_USER="${3:-root}"
SSH_HOST="${4:-85.215.56.185}"
# Ensure GnuPG is in PATH
export PATH="/opt/homebrew/bin:$PATH"
# Step 1: Decrypt the PGP message
echo "🔓 Decrypting PGP passphrase..."
DECRYPTED_PASSPHRASE=$(printf '%s' "$(cat "$PGP_MESSAGE_FILE")" | gpg --batch --yes --decrypt 2>/dev/null)
if [ -z "$DECRYPTED_PASSPHRASE" ]; then
echo "❌ Failed to decrypt PGP message. Check that:"
echo " - The private GPG key is imported"
echo " - The PGP message is valid"
exit 1
fi
echo "✅ Passphrase decrypted successfully"
# Step 2: SSH into the server
echo "🔗 Connecting to $SSH_HOST as $SSH_USER..."
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$SSH_USER@$SSH_HOST" <<EOF
$DECRYPTED_PASSPHRASE
EOF
echo "✅ SSH connection completed"