Pangolin Tunnel Setup Guide#
1. Oracle Cloud VPS Instance Setup#
Create VCN (Virtual Cloud Network)#
- Name:
homeip - IPv4 CIDR Blocks:
[REDACTED] - Internet Gateway: Create
ig-homeipin Gateways. - Route Rules: Add Route Rule > Target: Internet Gateway > Destination:
0.0.0.0/0.
Create Subnet#
- Name:
homeip-subnet - IPv4 CIDR Blocks:
[REDACTED] - Type: Public Subnet
- DNS Label:
dns
Create VM Instance#
- Name:
Pangolin - Image: Ubuntu 24.04
- Shape: Ampere VM.Standard.A1.Flex (Always Free-eligible)
- Networking: VNIC Name
pangolin-vnic. Connect public subnet to internet. - Public IP:
[REDACTED] - Username:
ubuntu
2. Google Cloud VPS Setup (Alternative)#
- Region:
us-east1(South Carolina) - Machine Type:
e2-standard-2 - Prerequisites: Billing enabled and project created.
3. Cloudflare & Pangolin Installation#
DNS Configuration#
- Type:
A - Name:
pangolin - Content:
[REDACTED_SERVER_IP] - Proxy status:
Off(Grey cloud)
Installation Commands#
# Prepare directory
cd /home/marc/docker-compose
mkdir -p pangolin && cd pangolin# Download and run installer
curl -fsSL [https://static.pangolin.net/get-installer.sh](https://static.pangolin.net/get-installer.sh) | bash
sudo ./installerWildcard Certificates#
Edit the configuration for wildcard domains:
nano /home/marc/docker-compose/pangolin/config/traefik/traefik_config.yaml4. Crowdsec Management#
Maintenance & Metrics#
# Unban a specific IP
docker exec crowdsec-pangolin cscli decisions delete -i [REDACTED]# View active decisions and metrics
docker exec crowdsec-pangolin cscli decisions list
docker exec crowdsec-pangolin cscli metrics
docker exec -it crowdsec-pangolin cscli bouncers metricsPersistent Whitelisting#
- Create Whitelist File:
nano /home/marc/docker-compose/pangolin/config/crowdsec/my-whitelist.yamlContent:
name: whitelist
description: "Trusted IPs"
whitelist:
reason: "Trusted source"
ip:
- [REDACTED]- Update docker-compose.yml: Add to the Crowdsec volumes section:
volumes:
- ./config/crowdsec/my-whitelist.yaml:/etc/crowdsec/parsers/s02-enrich/my-whitelist.yaml:ro- Verify Whitelist Parsing:
docker exec crowdsec-pangolin cscli parsers listdocker exec -it crowdsec-pangolin sh -c 'grep -R "^[[:space:]]*-" /etc/crowdsec/parsers/s02-enrich/*.yaml'5. Backups (New Backup Strategy)#
Manual Backups#
# Compress pangolin directory
cd /home/marc/docker-compose
tar -czvf "$(date '+%Y-%m-%d_%Hh%M')_Pangolin.tar.gz" pangolin# Decompress/Restore
tar -xzvf [BACKUP_FILE_NAME].tar.gzAutomated Cronjobs#
Option 1: Backup with Error Log Only
0 * * * * mkdir -p /home/marc/docker-compose/$(date '+\%Y-\%m-\%d') && tar -czvf "/home/marc/docker-compose/$(date '+\%Y-\%m-\%d')/$(date '+\%Y-\%m-\%d_\%Hh\%M')_Pangolin.tar.gz" /home/marc/docker-compose/pangolin > /dev/null 2>> /home/marc/docker-compose/pangolin_backup_error.logOption 2: Full Verbose Logging
0 * * * * echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] Backup started" >> /home/marc/docker-compose/pangolin_backup.log && mkdir -p /home/marc/docker-compose/$(date '+\%Y-\%m-\%d') && tar -czvf "/home/marc/docker-compose/$(date '+\%Y-\%m-\%d')/$(date '+\%Y-\%m-\%d_\%Hh\%M')_Pangolin.tar.gz" /home/marc/docker-compose/pangolin >> /home/marc/docker-compose/pangolin_backup.log 2>&1 && echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] Backup finished" >> /home/marc/docker-compose/pangolin_backup.log6. CrowdSec Host Firewall Integration#
To allow the CrowdSec instance inside the Pangolin container to control the Ubuntu host firewall:
Install Firewall Bouncer on Host#
# Add repo and install bouncer
curl -s https://install.crowdsec.net | sudo sh && sudo apt update && sudo apt install -y crowdsec-firewall-bouncer-iptables
# Check status
sudo systemctl status crowdsec-firewall-bouncerLink Bouncer to Container#
- Generate API Key:
docker exec crowdsec-pangolin cscli bouncers add host-bouncer- Configure Bouncer:
sudo nano /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml- api_url: Set to
http://127.0.0.1:8080/ - api_key: Paste the key generated in the previous step.
- iptables_chains: Ensure the following are present to protect Docker containers:
iptables_chains:
- INPUT
- DOCKER-USER- Restart and Verify:
sudo systemctl restart crowdsec-firewall-bouncer
docker exec crowdsec-pangolin cscli bouncers list
docker exec crowdsec-pangolin cscli decisions list7. CrowdSec Hub & Console Management#
Console Integration#
# Connect instance to https://app.crowdsec.net/
docker exec crowdsec-pangolin cscli console enable tainted
docker exec crowdsec-pangolin cscli console enable customHub Update Sequence#
# 1. Download the latest attack signatures
docker exec crowdsec-pangolin cscli hub update
# 2. Upgrade all installed collections (Traefik, SSH, CVEs, etc.)
docker exec crowdsec-pangolin cscli hub upgrade
# 3. Restart the container to apply new rules
docker restart crowdsec-pangolin
# 4. Verify status
docker exec crowdsec-pangolin cscli collections listWhitelist Management#
- View Whitelist:
docker exec crowdsec-pangolin cat /etc/crowdsec/parsers/s02-enrich/my-whitelist.yaml - Modify Whitelist:
sudo nano /home/marc/docker-compose/pangolin/config/crowdsec/my-whitelist.yaml - Apply Changes:
docker restart crowdsec-pangolin
8. Maintenance & Security#
Vulnerability Scanning (Trivy)#
Check all running images for critical vulnerabilities:
docker ps --format "{{.Image}}" | sort -u | xargs -I {} trivy image --severity CRITICAL --quiet --no-progress {}Traefik Log Rotation#
- Check log size:
ls -lh /home/marc/docker-compose/pangolin/config/traefik/logs/- Configure Logrotate:
sudo nano /etc/logrotate.d/traefikContent:
/home/marc/docker-compose/pangolin/config/traefik/logs/access.log {
daily
rotate 7
missingok
notifempty
compress
delaycompress
copytruncate
}