[PR #56] [MERGED] Add optional provider cleanup with environment detection #61

Closed
opened 2026-03-02 02:59:35 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/buildplan/du_setup/pull/56
Author: @buildplan
Created: 10/13/2025
Status: Merged
Merged: 10/17/2025
Merged by: @buildplan

Base: mainHead: options


📝 Commits (10+)

  • 7412fcf feat: Add optional provider cleanup with environment detection
  • 595d406 add help flag
  • 4938dd0 fix shellcheck warnings
  • 1d5bcbc fix echo colour codes
  • d1da2b6 Improve VPS detection
  • 8b78fdd Update changelog
  • 6109cda new feature provider cleanup
  • 3d8d304 USERNAME veriable not set error
  • dec08d0 Set default user for clean-up mode
  • 143cc3e Improve clean-up

📊 Changes

3 files changed (+1293 additions, -288 deletions)

View changed files

📝 README.md (+145 -122)
📝 du_setup.sh (+1147 -165)
📝 du_setup.sh.sha256 (+1 -1)

📄 Description

Add comprehensive provider cleanup functionality to detect and optionally
remove cloud provider packages, agents, and default users.

Key Features:

  • Automatic environment detection (cloud VPS vs personal VM vs bare metal)
  • Intelligent recommendations based on detected environment
  • Preview mode (--cleanup-preview) to simulate changes
  • Standalone cleanup mode (--cleanup-only) for existing servers
  • SSH key audit with backup and validation
  • Cloud-init disabling (not removal) following best practices
  • Extended package detection (59+ provider packages)
  • Robust user deletion with process termination
  • Comprehensive logging of all actions

New Flags:

  • --cleanup-preview: Show what would be done without making changes
  • --cleanup-only: Run only cleanup function (useful for existing servers)
  • --skip-cleanup: Skip cleanup entirely in full script run

Security Improvements:

  • Detects provider-installed monitoring agents
  • Audits /root/.ssh/authorized_keys for unexpected keys
  • Identifies and removes default provisioning users
  • Safely disables cloud-init while preserving re-enable capability

Supports major cloud providers: AWS, GCP, Azure, Oracle, DigitalOcean,
Linode, Vultr, Hetzner, OVH, Scaleway, and more.

Testing required before merge to main branch.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/buildplan/du_setup/pull/56 **Author:** [@buildplan](https://github.com/buildplan) **Created:** 10/13/2025 **Status:** ✅ Merged **Merged:** 10/17/2025 **Merged by:** [@buildplan](https://github.com/buildplan) **Base:** `main` ← **Head:** `options` --- ### 📝 Commits (10+) - [`7412fcf`](https://github.com/buildplan/du_setup/commit/7412fcf229be26ed79f000957e77d46e032bbc71) feat: Add optional provider cleanup with environment detection - [`595d406`](https://github.com/buildplan/du_setup/commit/595d40622d06b713645abd6bd4e5c9a9c8eac8c4) add help flag - [`4938dd0`](https://github.com/buildplan/du_setup/commit/4938dd0b9ac00dc213308d7366b90f538ac33e69) fix shellcheck warnings - [`1d5bcbc`](https://github.com/buildplan/du_setup/commit/1d5bcbcc3e6ede87d353d820192e2944dfd83f23) fix echo colour codes - [`d1da2b6`](https://github.com/buildplan/du_setup/commit/d1da2b61422732faab3a46e701241ae68ab6479f) Improve VPS detection - [`8b78fdd`](https://github.com/buildplan/du_setup/commit/8b78fdd3e5c8727a5f757cea12b21a17f1347d0b) Update changelog - [`6109cda`](https://github.com/buildplan/du_setup/commit/6109cdadba4dffc40a6e022eccca47931bec9368) new feature provider cleanup - [`3d8d304`](https://github.com/buildplan/du_setup/commit/3d8d304ac7260b8feb6edd3e14aa5bebcaf14757) USERNAME veriable not set error - [`dec08d0`](https://github.com/buildplan/du_setup/commit/dec08d0e4f3a2ff2c29ef623e89085c12beed98a) Set default user for clean-up mode - [`143cc3e`](https://github.com/buildplan/du_setup/commit/143cc3eb25cd2ffe1d58da4aae9c5ef832276c31) Improve clean-up ### 📊 Changes **3 files changed** (+1293 additions, -288 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+145 -122) 📝 `du_setup.sh` (+1147 -165) 📝 `du_setup.sh.sha256` (+1 -1) </details> ### 📄 Description Add comprehensive provider cleanup functionality to detect and optionally remove cloud provider packages, agents, and default users. Key Features: - Automatic environment detection (cloud VPS vs personal VM vs bare metal) - Intelligent recommendations based on detected environment - Preview mode (--cleanup-preview) to simulate changes - Standalone cleanup mode (--cleanup-only) for existing servers - SSH key audit with backup and validation - Cloud-init disabling (not removal) following best practices - Extended package detection (59+ provider packages) - Robust user deletion with process termination - Comprehensive logging of all actions New Flags: - --cleanup-preview: Show what would be done without making changes - --cleanup-only: Run only cleanup function (useful for existing servers) - --skip-cleanup: Skip cleanup entirely in full script run Security Improvements: - Detects provider-installed monitoring agents - Audits /root/.ssh/authorized_keys for unexpected keys - Identifies and removes default provisioning users - Safely disables cloud-init while preserving re-enable capability Supports major cloud providers: AWS, GCP, Azure, Oracle, DigitalOcean, Linode, Vultr, Hetzner, OVH, Scaleway, and more. Testing required before merge to main branch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 02:59:35 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/du_setup#61
No description provided.