|
113 | 113 | # - Kernel: keyring limits (maxkeys/maxbytes for UID 100000) |
114 | 114 | # - Storage: rootdir support, vztmpl support, available space |
115 | 115 | # - Network: bridge availability, DNS resolution |
| 116 | +# - Repos: enterprise repo subscription validation |
116 | 117 | # - Cluster: quorum status (if clustered) |
117 | 118 | # - Proxmox: LXC stack health, container ID availability |
118 | 119 | # - Template: download server reachability |
@@ -348,6 +349,42 @@ preflight_dns_resolution() { |
348 | 349 | return 0 |
349 | 350 | } |
350 | 351 |
|
| 352 | +# ------------------------------------------------------------------------------ |
| 353 | +# preflight_repo_access() |
| 354 | +# |
| 355 | +# - Checks if Proxmox enterprise repos are enabled without a valid subscription |
| 356 | +# - Scans /etc/apt/sources.list.d/ for enterprise.proxmox.com entries |
| 357 | +# - Tests HTTP access to detect 401 Unauthorized |
| 358 | +# - Warning only (not a blocker — packages come from no-subscription repo) |
| 359 | +# ------------------------------------------------------------------------------ |
| 360 | +preflight_repo_access() { |
| 361 | + local enterprise_files |
| 362 | + enterprise_files=$(grep -rlE '^\s*deb\s+https://enterprise\.proxmox\.com' /etc/apt/sources.list.d/ 2>/dev/null || true) |
| 363 | + |
| 364 | + if [[ -z "$enterprise_files" ]]; then |
| 365 | + preflight_pass "No enterprise repositories enabled" |
| 366 | + return 0 |
| 367 | + fi |
| 368 | + |
| 369 | + # Enterprise repo found — test if subscription is valid |
| 370 | + local http_code |
| 371 | + http_code=$(curl -sS -o /dev/null -w "%{http_code}" -m 5 "https://enterprise.proxmox.com/debian/pve/dists/" 2>/dev/null) || http_code="000" |
| 372 | + |
| 373 | + if [[ "$http_code" == "401" || "$http_code" == "403" ]]; then |
| 374 | + preflight_warn "Enterprise repo enabled without valid subscription (HTTP ${http_code})" |
| 375 | + echo -e " ${TAB}${INFO} apt-get update will show '401 Unauthorized' errors" |
| 376 | + echo -e " ${TAB}${INFO} Disable in ${GN}/etc/apt/sources.list.d/${CL} or add a subscription key" |
| 377 | + return 0 |
| 378 | + fi |
| 379 | + |
| 380 | + if [[ "$http_code" =~ ^2[0-9]{2}$ ]]; then |
| 381 | + preflight_pass "Enterprise repository accessible (subscription valid)" |
| 382 | + else |
| 383 | + preflight_warn "Enterprise repo check inconclusive (HTTP ${http_code})" |
| 384 | + fi |
| 385 | + return 0 |
| 386 | +} |
| 387 | + |
351 | 388 | # ------------------------------------------------------------------------------ |
352 | 389 | # preflight_cluster_quorum() |
353 | 390 | # |
@@ -567,6 +604,9 @@ run_preflight() { |
567 | 604 | preflight_network_bridge |
568 | 605 | preflight_dns_resolution |
569 | 606 |
|
| 607 | + # --- Repository checks --- |
| 608 | + preflight_repo_access |
| 609 | + |
570 | 610 | # --- Proxmox/Cluster checks --- |
571 | 611 | preflight_cluster_quorum |
572 | 612 | preflight_lxc_stack |
|
0 commit comments