🏠hoatranlab.io.vn 💬Zalo: 0917516878 📞0917516878 ✉️[email protected]

Phase 11: Proxmox Ecosystem (PBS 4.1 + PDM 1.0 + PMG 9.0)

Bài 11.1: Proxmox Backup Server 4.1 — deep dive

Lý thuyết cốt lõi

PBS 4.1 (release 25/11/2025, Debian 13) là sản phẩm tách biệt với PVE, chuyên backup với deduplication rolling hash.

Kiến trúc file format:

  • Image Archives (.img): VM block device raw
  • File Archives (.pxar): LXC/host file tree (proxmox archive format)
  • Binary BLOBs: log, config
  • Catalog (catalog.pcat1): index file trong archive (fast browse)
  • Manifest (index.json): metadata snapshot

Backup namespace (4.x feature):

Phân level datastore → namespace → backup-type → backup-id → snapshot:

big-ds/
├── prod/                    ← namespace
│   ├── vm/100/2026-04-23T02:00Z/
│   └── ct/200/2026-04-23T02:00Z/
├── dev/
└── dr-site/

Namespace → quản lý quyền phân cấp: team dev chỉ access namespace dev, không thấy prod.

Features mới 4.x:

  • S3 backend (GA VE 9.1 + PBS 4.1) — backup trực tiếp lên AWS S3/MinIO/Ceph RGW
  • Tape backup — LTO-8/9 support, changer auto
  • Sync jobs 2-way — PBS primary ↔ PBS DR
  • Remove-vanished trong sync để dọn DR site

Bài tập thực hành

Install PBS 4.1 standalone:

# Tải ISO pbs-4.1 tại proxmox.com, cài giống PVE
# Sau cài xong:
proxmox-backup-manager version
# proxmox-backup-server 4.1.0-1

# 1. Tạo datastore với namespace
proxmox-backup-manager datastore create big-ds /mnt/datastore/big-ds
proxmox-backup-manager namespace create big-ds prod
proxmox-backup-manager namespace create big-ds dev

# 2. Tạo user + ACL theo namespace
proxmox-backup-manager user create backup-prod@pbs --password 'Xxx'
proxmox-backup-manager acl update /datastore/big-ds/prod DatastoreBackup --auth-id backup-prod@pbs

# 3. S3 backend (preview)
proxmox-backup-manager s3-endpoint create aws-sg \
    --endpoint s3.ap-southeast-1.amazonaws.com \
    --region ap-southeast-1 \
    --access-key AKIAXXX --secret-key xxx

proxmox-backup-manager datastore create cold-ds /mnt/s3-cache \
    --backend-type s3 --s3-endpoint aws-sg --bucket hoatranlab-backup

# 4. GC schedule (quan trọng — PBS KHÔNG tự xóa chunk)
proxmox-backup-manager gc-job create big-ds-gc \
    --store big-ds --schedule 'sat *-*-* 04:00'

# 5. Verify job (check bit rot)
proxmox-backup-manager verify-job create big-ds-verify \
    --store big-ds --schedule 'sun *-*-* 05:00' --outdated-after 30

Kết quả đầu ra

$ proxmox-backup-manager datastore list
┌─────────┬──────────────────────┬──────────┬──────────┐
│ name    │ path                 │ used     │ usage %  │
├─────────┼──────────────────────┼──────────┼──────────┤
│ big-ds  │ /mnt/datastore/big-ds│ 1.2 TiB  │ 23%      │
│ cold-ds │ s3://hoatranlab-... │ 450 GiB  │ n/a      │
└─────────┴──────────────────────┴──────────┴──────────┘

$ proxmox-backup-client benchmark --repository backup@[email protected]:big-ds
Uploaded 2048 chunks in 5 seconds.
Time per request: 2441 microseconds.
TLS speed: 421.34 MB/s
SHA256 speed: 1512.67 MB/s
Compression speed: 892.11 MB/s
Decompress speed: 1321.00 MB/s
AES256/GCM speed: 2945.10 MB/s

Troubleshooting

  • Chunk store full dù prune đã chạy: quên GC → chạy proxmox-backup-manager garbage-collection start big-ds
  • S3 upload timeout: giảm --chunk-size, tăng --threads
  • Tape không detect: check lsscsi -g, driver st + ch

Ứng dụng thực tế

Tình huống: Công ty cần compliance 7 năm retention, ngân sách hạn chế.

Giải pháp 3-2-1-1:

  • Tier 1 (0-30 ngày): PBS local HDD RAID-10 ~50 TB
  • Tier 2 (30-365 ngày): PBS sync-job → PBS offsite qua VPN
  • Tier 3 (1-7 năm): PBS S3 backend → AWS S3 Glacier Deep Archive (~1 USD/TB/tháng)
  • Air-gap: LTO-9 tape rotation hàng quý

Bài 11.2: Proxmox Datacenter Manager 1.0 — multi-cluster

Lý thuyết cốt lõi

PDM (release 1.0.0 — 03/12/2025) = "vCenter của Proxmox" — quản lý nhiều PVE cluster + nhiều PBS từ 1 UI duy nhất.

Trước PDM: 10 cluster = 10 Web GUI riêng → khó operate.
Sau PDM: 1 UI → thấy toàn bộ VM/CT trên mọi cluster, migrate cross-cluster.

Status: 1.0.0 GA nhưng vẫn đang phát triển — thiếu một số tính năng như backup orchestration tập trung.

Features chính 1.0:

  • Remotes — add PVE/PBS server qua API token
  • Resource view — list all VM từ mọi cluster, filter/group
  • Customizable dashboard — widget drag-drop
  • Cross-cluster migration — di chuyển VM giữa 2 cluster khác
  • SDN Integration (EVPN) — xem/quản lý SDN zone xuyên cluster
  • Access Control — RBAC riêng PDM, không kế thừa PVE
  • CLI: proxmox-datacenter-manager-admin, proxmox-datacenter-manager-client

Kiến trúc:

┌──────────────────────────────────┐
│     PDM (1 node, standalone)     │ ← Web UI 8443
│   - remotes.cfg                  │
│   - views.cfg                    │
│   - access.cfg                   │
└──────┬──────────┬──────────┬─────┘
       │ API      │ API      │ API (token)
  ┌────▼───┐ ┌───▼────┐ ┌───▼────┐
  │ PVE-HCM│ │ PVE-HN │ │  PBS   │
  │ cluster│ │ cluster│ │ offsite│
  └────────┘ └────────┘ └────────┘

Lưu ý: PDM chỉ cần 1 node standalone (không cần cluster). Resource nhẹ: 2 vCPU, 4 GB RAM, 32 GB disk.

Bài tập thực hành

Install PDM 1.0 (trên VM Debian 13 hoặc ISO official):

# Option A: cài từ Debian 13
echo 'deb http://download.proxmox.com/debian/pdm trixie pdm-no-subscription' \
    > /etc/apt/sources.list.d/pdm.list
wget -O /etc/apt/keyrings/proxmox-release.gpg \
    https://download.proxmox.com/debian/proxmox-release-trixie.gpg
apt update
apt install proxmox-datacenter-manager proxmox-datacenter-manager-ui

# Option B: ISO installer (khuyến nghị)
# Tải ISO tại proxmox.com, cài như PVE

# Verify
proxmox-datacenter-manager-admin versions

Truy cập Web UI: https://<pdm-ip>:8443 (login root@pam).

Add remote PVE cluster:

# 1. Trên PVE cluster: tạo API token cho PDM
# Web GUI PVE: Datacenter > Permissions > API Tokens > Add
#   User: pdm@pve, Token ID: pdm-token, Privilege Separation: no
#   → copy secret ra

# 2. Grant permission cho user pdm@pve
pveum acl modify / --users pdm@pve --roles PVEAdmin

# 3. Trên PDM: add remote
proxmox-datacenter-manager-client remote add pve-hcm \
    --hostname 10.0.0.11 --port 8006 \
    --authid pdm@pve!pdm-token \
    --token 'xxxxxxxx-xxxx-xxxx'

# 4. List remote
proxmox-datacenter-manager-client remote list

# 5. List VM cross-cluster
proxmox-datacenter-manager-client resource list

Cross-cluster migration (feature unique của PDM):

# Web GUI: Resource view → click VM → Migrate → chọn target cluster
# Hoặc CLI:
proxmox-datacenter-manager-client remote migrate \
    --source pve-hcm --source-vm 100 \
    --target pve-hn --target-node pve01-hn \
    --target-storage ceph-rbd --online

Kết quả đầu ra

$ proxmox-datacenter-manager-client remote list
┌──────────┬────────────┬──────┬──────────┬─────────┐
│ name     │ type       │ nodes│ vms      │ status  │
├──────────┼────────────┼──────┼──────────┼─────────┤
│ pve-hcm  │ pve-cluster│ 3    │ 45       │ online  │
│ pve-hn   │ pve-cluster│ 3    │ 28       │ online  │
│ pbs-main │ pbs        │ 1    │ 12 TiB   │ online  │
└──────────┴────────────┴──────┴──────────┴─────────┘

$ proxmox-datacenter-manager-client resource list --type vm
VMID  Name         Cluster   Node       Status   Mem    CPU
100   web-prod-01  pve-hcm   pve01-hcm  running  2 GB   4
101   db-prod-01   pve-hcm   pve02-hcm  running  16 GB  8
200   app-dr-01    pve-hn    pve01-hn   stopped  8 GB   4

Troubleshooting

  • Remote không connect: check API token, firewall port 8006 từ PDM → PVE
  • SSL cert mismatch: accept fingerprint lúc add, hoặc install cert CA
  • Cross-cluster migrate fail: 2 cluster phải có network reachable + shared hoặc duplicated storage name

Ứng dụng thực tế

Tình huống: Tập đoàn 5 chi nhánh, mỗi chi nhánh 1 cluster PVE 3-node + 1 PBS. Tổng 5 Web UI PVE + 5 Web UI PBS = 10 tab browser → admin khổ sở.

Giải pháp: 1 VM PDM 1.0 ở HQ, add 10 remote → 1 dashboard duy nhất thấy toàn bộ 200 VM toàn tập đoàn. RBAC theo chi nhánh: admin HN chỉ thấy VM HN.

Lợi ích: Giảm thời gian operate ~60%, tập trung monitoring, dễ compliance report.


Bài 11.3: Proxmox Mail Gateway 9.0 — email security

Lý thuyết cốt lõi

PMG 9.0.4 (release 29/09/2025) = email gateway anti-spam + anti-virus đặt giữa Internet và mail server nội bộ (Exchange/Zimbra/Postfix).

Kiến trúc:

Internet ──SMTP─→ [PMG cluster] ──SMTP─→ Internal mail server (Exchange)
                       │
                    filter:
                    - SpamAssassin (score-based)
                    - ClamAV (virus)
                    - Rule system (object-oriented)
                    - DKIM/SPF/DMARC
                    - Quarantine

Features PMG 9.0:

  • Spam detection: SpamAssassin + rule custom + Bayesian learning
  • Virus detection: ClamAV + optional signature commercial (KAM)
  • Object-oriented rule system: rule theo from/to/content/attachment với action (accept/reject/quarantine/modify)
  • DKIM signing outbound
  • HA cluster 2-3 node (sync DB via SSL)
  • LDAP integration (AD sync user → validate RCPT TO)
  • Quarantine Web UI — user tự release email (không cần admin)
  • Tracking: log search chi tiết (from, to, subject, time, action)

License: GPL-v2 (free) + optional subscription (~160 EUR/CPU/năm).

Bài tập thực hành

Install PMG từ ISO (Debian 13 base), sau cài xong:

# Verify
pmgversion -v | head -3
# pmg-api: 9.0.4
# postfix: 3.9.x
# spamassassin: 4.0.x

# 1. Config domain nội bộ cần relay
pmgsh create /config/mail --relaydomains corp.local
pmgsh create /config/mail --relay 10.0.10.50   # Exchange IP

# 2. LDAP sync với AD
# Web GUI: Configuration > LDAP > Add
#   Profile: corp-ad
#   Server: dc01.corp.local
#   Base DN: DC=corp,DC=local
#   Bind DN: CN=svc-pmg,CN=Users,DC=corp,DC=local
# → PMG pull list user mỗi giờ → reject email tới user không tồn tại (tiết kiệm quarantine)

# 3. SpamAssassin config
# Web GUI: Configuration > Spam Detector > Options
# Set: spam_tag_level=3, spam_quarantine_level=5, spam_reject_level=8

# 4. ClamAV update (mỗi 4h)
systemctl status clamav-freshclam

# 5. DKIM signing outbound
pmgsh create /config/dkim --enable 1 --selector pmg --domain corp.local
# → copy TXT record ra, add vào DNS corp.local

Rule objects (quan trọng nhất của PMG):

Rule: Block-Executables
  WHO:     * (any sender)
  WHAT:    attachment MIME = application/x-msdownload, .exe, .bat
  ACTION:  block + notify admin
  WHEN:    24/7

Rule: Whitelist-Partners
  WHO:     from:@trustedpartner.com
  WHAT:    any
  ACTION:  accept + skip spam check
  WHEN:    business-hours

Cluster PMG (HA):

# Trên node 1 (primary):
pmgcm create

# Node 2 (join):
pmgcm join 10.0.30.30
# nhập root password node 1

# Verify
pmgcm status

Kết quả đầu ra

$ pmgcm status
Cluster Status:
  Node pmg01 (10.0.30.30)  [ Master ]   OK
  Node pmg02 (10.0.30.31)             OK

$ postqueue -p
-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
(empty)     Mail queue is empty

$ tail -f /var/log/pmg/tracker.log
2026-04-23 10:05:12 QID=abc123 [email protected] [email protected] ACTION=quarantine SCORE=12.5
2026-04-23 10:05:15 QID=def456 [email protected] [email protected] ACTION=accept SCORE=0.5

Troubleshooting

  • Mail bị delay: check postqueue -p, nhiều email queued → tăng RAM, enable multi-instance postfix
  • ClamAV báo "ERROR: Can't connect": systemctl restart clamav-daemon
  • High false-positive spam: train Bayesian từ user feedback, điều chỉnh threshold
  • LDAP sync fail: test ldapsearch -x -H ldap://dc01 -D 'CN=svc-pmg,...' -W

Ứng dụng thực tế

Tình huống: Công ty 500 user dùng Exchange on-premise, bị spam/phishing nhiều (~30% email rác). Không muốn dùng Microsoft Defender for Office 365 (5 USD/user/tháng = 30000 USD/năm).

Giải pháp: 2 node PMG 9.0 HA (4 vCPU, 8 GB RAM, 200 GB mỗi node) chạy trên PVE cluster → MX record trỏ về PMG → PMG filter → relay về Exchange.

Lợi ích:

  • Chi phí: ~0 license (GPL) hoặc 320 EUR/năm community sub
  • Tiết kiệm ~30000 USD/năm so với Defender
  • Quarantine UI cho user self-service giảm tải IT
  • Log tracking chi tiết cho compliance