vastai-security-basics
Security guidelines for protecting Vast.ai credentials and infrastructure access.
Install
mkdir -p .claude/skills/vastai-security-basics && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3076" && unzip -o skill.zip -d .claude/skills/vastai-security-basics && rm skill.zipInstalls to .claude/skills/vastai-security-basics
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Apply Vast.ai security best practices for API keys and instance access.Key capabilities
- →Prevent API keys from being committed to git
- →Load API keys from environment variables
- →Generate dedicated SSH key pairs for Vast.ai
- →Securely wipe data before destroying instances
- →Use SSH tunnels for services on instances
- →Encrypt training data before upload
How it works
The skill provides instructions and code examples for managing API keys as environment variables, generating and uploading dedicated SSH keys, and implementing secure data cleanup procedures for Vast.ai instances.
Inputs & outputs
When to use vastai-security-basics
- →Secure Vast.ai API keys
- →Harden SSH access for GPU instances
- →Audit security configurations
About this skill
Vast.ai Security Basics
Overview
Security best practices for Vast.ai API keys, SSH access to GPU instances, data protection on rented hardware, and credential management. Vast.ai instances run as root on shared hardware, requiring careful attention to data lifecycle.
Prerequisites
- Vast.ai account with API key
- Understanding of SSH key management
- Secrets manager available (optional but recommended)
Instructions
Step 1: API Key Management
# Never commit API keys to git
echo '.vast_api_key' >> .gitignore
echo '.env' >> .gitignore
# Use environment variables, not files in repos
export VASTAI_API_KEY="$(vault kv get -field=api_key secret/vastai)"
# Rotate keys periodically at cloud.vast.ai > Account > API Keys
# Fail fast on missing credentials
import os
def get_api_key():
key = os.environ.get("VASTAI_API_KEY")
if not key:
key_file = os.path.expanduser("~/.vast_api_key")
if os.path.exists(key_file):
key = open(key_file).read().strip()
if not key:
raise ValueError("VASTAI_API_KEY not set and ~/.vast_api_key not found")
return key
Step 2: SSH Key Security
# Generate a dedicated key pair for Vast.ai instances
ssh-keygen -t ed25519 -f ~/.ssh/vastai_key -C "vastai-instances" -N ""
# Upload public key at cloud.vast.ai > Account > SSH Keys
# Use the dedicated key for connections
ssh -i ~/.ssh/vastai_key -p PORT root@HOST
Step 3: Data Protection on Shared Hardware
def secure_cleanup(instance_id, ssh_host, ssh_port):
"""Securely wipe data before destroying an instance."""
import subprocess
# Overwrite sensitive files before instance destruction
subprocess.run([
"ssh", "-p", str(ssh_port), "-o", "StrictHostKeyChecking=no",
f"root@{ssh_host}",
"rm -rf /workspace/data /workspace/checkpoints /root/.ssh/authorized_keys; "
"history -c"
], check=True)
# Then destroy
subprocess.run(["vastai", "destroy", "instance", str(instance_id)], check=True)
Step 4: Network Security
- Use SSH tunnels for any services exposed on instances
- Never expose ports with sensitive data to the public internet
- Transfer data over SCP/SFTP, not unencrypted HTTP
- Encrypt training data before upload; decrypt on-instance
Step 5: Credential Rotation Checklist
- API key rotated every 90 days
- SSH keys dedicated to Vast.ai (not shared with production)
- Old SSH keys removed from cloud.vast.ai after rotation
-
.vast_api_keyfile permissions set to600 - No API keys in shell history (
exportfrom a sourced file, not typed)
Output
- API key loaded from environment or secrets manager
- Dedicated SSH key pair for Vast.ai instances
- Secure cleanup before instance destruction
- Network security guidelines
- Credential rotation checklist
Error Handling
| Error | Cause | Solution |
|---|---|---|
| API key leaked in git | Committed .env or key file | Rotate key immediately; add to .gitignore |
| SSH key rejected | Wrong key or not uploaded | Verify key is at cloud.vast.ai > SSH Keys |
| Data left on destroyed instance | Forgot to clean up | Use secure_cleanup() before destroy |
| Key file world-readable | Wrong permissions | chmod 600 ~/.vast_api_key ~/.ssh/vastai_key |
Resources
Next Steps
For production deployment checklist, see vastai-prod-checklist.
Examples
Vault integration: Load API key from HashiCorp Vault at runtime, never write to disk, and use SSH agent forwarding for key management.
Ephemeral instances: Treat every Vast.ai instance as throwaway. Never store persistent state on instances; always upload data, process, download results, and destroy.
Prerequisites
Limitations
- →API key can be leaked if committed to git
- →SSH key can be rejected if not uploaded or wrong key is used
- →Data can be left on destroyed instance if cleanup is forgotten
How it compares
This skill offers specific security patterns for Vast.ai's shared hardware environment, including secure cleanup and key management, which differs from generic cloud security advice.
Compared to similar skills
vastai-security-basics side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| vastai-security-basics (this skill) | 3 | 27d | Review | Intermediate |
| reverse-engineering-tools | 73 | 4mo | No flags | Advanced |
| game-hacking-techniques | 42 | 2mo | No flags | Advanced |
| solidity-security | 15 | 2mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
reverse-engineering-tools
gmh5225
Guide for reverse engineering tools and techniques used in game security research. Use this skill when working with debuggers, disassemblers, memory analysis tools, binary analysis, or decompilers for game security research.
game-hacking-techniques
gmh5225
Guide for game hacking techniques and cheat development. Use this skill when researching memory manipulation, code injection, ESP/aimbot development, overlay rendering, or game exploitation methodologies.
solidity-security
wshobson
Master smart contract security best practices to prevent common vulnerabilities and implement secure Solidity patterns. Use when writing smart contracts, auditing existing contracts, or implementing security measures for blockchain applications.
1password
openclaw
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
senior-security
davila7
Comprehensive security engineering skill for application security, penetration testing, security architecture, and compliance auditing. Includes security assessment tools, threat modeling, crypto implementation, and security automation. Use when designing security architecture, conducting penetration tests, implementing cryptography, or performing security audits.
ghidra
mitsuhiko
Reverse engineer binaries using Ghidra's headless analyzer. Decompile executables, extract functions, strings, symbols, and analyze call graphs without GUI.