Playit.gg Tunneling
Complete guide for setting up and managing Playit.gg tunneling for public SSH access.
π Overview
Playit.gg provides secure tunneling that allows public SSH access to your NazDocker Lab environment without exposing your local network.
π§ Setup
1. Get Playit.gg Secret Key
- Sign up at playit.gg
- Create a tunnel for SSH access
- Copy your secret key from the dashboard
2. Configure Environment
# Edit .env file
PLAYIT_SECRET_KEY=your_secret_key_here
# Restart container to apply changes
docker-compose -f docker-compose.ubuntu.yml down && docker-compose -f docker-compose.ubuntu.yml up -d
3. Verify Tunnel Status
# Check tunnel logs
docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "playit\|tunnel\|url"
# Follow logs in real-time
docker-compose -f docker-compose.ubuntu.yml logs -f lab-environment-ubuntu
# Check playit.gg process
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ps aux | grep playit
π Tunnel Management
Check Tunnel Status
# View tunnel logs
docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "playit\|tunnel\|url"
# Follow logs in real-time
docker-compose -f docker-compose.ubuntu.yml logs -f lab-environment-ubuntu
# Check playit.gg process
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ps aux | grep playit
Update Playit.gg Secret Key
Method 1: Environment File (Recommended)
# Edit .env file
nano .env
# Update the secret key
PLAYIT_SECRET_KEY=your_new_secret_key_here
# Restart container
docker-compose -f docker-compose.ubuntu.yml down && docker-compose -f docker-compose.ubuntu.yml up -d
Method 2: Environment Variable
# Stop container
docker-compose -f docker-compose.ubuntu.yml down
# Set environment variable
export PLAYIT_SECRET_KEY=your_new_secret_key_here
# Start with new key
docker-compose -f docker-compose.ubuntu.yml up -d
Method 3: Dockerfile
# In Dockerfile.ubuntu
ENV PLAYIT_SECRET_KEY=your_secret_key_here
π Connecting via Tunnel
Get Tunnel URL
# Check logs for tunnel URL
docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "url\|tunnel"
# Example output:
# [INFO] Tunnel URL: your-lab.playit.gg:12345
SSH Connection
# Connect via tunnel URL
ssh admin@your-lab.playit.gg -p 12345
# Connect to other users
ssh user1@your-lab.playit.gg -p 12345
ssh user2@your-lab.playit.gg -p 12345
# ... etc
SSH Config for Tunnel
# Add to ~/.ssh/config
Host nazdocker-tunnel
HostName your-lab.playit.gg
Port 12345
User admin
IdentityFile ~/.ssh/id_ed25519
ServerAliveInterval 60
ServerAliveCountMax 3
π οΈ Troubleshooting
Tunnel Wonβt Start
# Check if secret key is loaded
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu env | grep PLAYIT
# Restart playit.gg service
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu pkill playit-agent
# Check tunnel connectivity
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ping google.com
Connection Issues
# Test tunnel connectivity
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ping google.com
# Check DNS resolution
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu nslookup google.com
# Check network interfaces
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ifconfig
Secret Key Issues
# Verify secret key is set
docker-compose -f docker-compose.ubuntu.yml config | grep PLAYIT_SECRET_KEY
# Check if key is loaded in container
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu env | grep PLAYIT
# Recreate .env file if needed
cp .env.example .env
# Edit with your secret key
π§ Advanced Configuration
Custom Tunnel Settings
# Access container
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu bash
# Check playit.gg configuration
cat /etc/playit/playit.conf
# Restart playit.gg with custom settings
pkill playit-agent
playit-agent --config /etc/playit/playit.conf
Multiple Tunnels
# Set up multiple tunnel configurations
# Edit .env file with multiple keys
PLAYIT_SECRET_KEY_SSH=your_ssh_tunnel_key
PLAYIT_SECRET_KEY_WEB=your_web_tunnel_key
π Monitoring
Tunnel Status Monitoring
#!/bin/bash
# tunnel-status.sh
echo "=== Playit.gg Tunnel Status ==="
echo ""
echo "1. Tunnel Process:"
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ps aux | grep playit
echo ""
echo "2. Recent Tunnel Logs:"
docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "playit\|tunnel" | tail -10
echo ""
echo "3. Network Connectivity:"
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ping -c 1 google.com
echo ""
echo "4. Environment Variables:"
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu env | grep PLAYIT
echo ""
Tunnel Health Check
#!/bin/bash
# tunnel-health.sh
# Check if tunnel is active
TUNNEL_ACTIVE=$(docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ps aux | grep playit | wc -l)
if [ "$TUNNEL_ACTIVE" -gt 0 ]; then
echo "β
Tunnel is active"
else
echo "β Tunnel is not running"
fi
# Check for tunnel URL in logs
TUNNEL_URL=$(docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "url" | tail -1)
if [ -n "$TUNNEL_URL" ]; then
echo "β
Tunnel URL found: $TUNNEL_URL"
else
echo "β No tunnel URL found in logs"
fi
π Security Considerations
Tunnel Security
- Use HTTPS for tunnel management when possible
- Rotate secret keys regularly
- Monitor tunnel logs for suspicious activity
- Use strong authentication for SSH access
- Limit tunnel access to necessary users only
Best Practices
# Regular tunnel health checks
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu ps aux | grep playit
# Monitor tunnel logs
docker-compose -f docker-compose.ubuntu.yml logs lab-environment-ubuntu | grep -i "playit"
# Check for unauthorized access
docker-compose -f docker-compose.ubuntu.yml exec lab-environment-ubuntu tail -f /var/log/auth.log
π Related Topics
- SSH Access - SSH connection methods
- Advanced Configuration - Network setup and troubleshooting
- Environment Variables - Configuration management
- Troubleshooting - Common tunnel issues
- Security Overview - Security best practices