Skip to content

Add optional provider cleanup with environment detection#56

Merged
buildplan merged 77 commits intomainfrom
options
Oct 17, 2025
Merged

Add optional provider cleanup with environment detection#56
buildplan merged 77 commits intomainfrom
options

Conversation

@buildplan
Copy link
Copy Markdown
Owner

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.

@buildplan buildplan self-assigned this Oct 13, 2025
@buildplan buildplan added the enhancement New feature or request label Oct 13, 2025
@buildplan buildplan marked this pull request as draft October 13, 2025 22:11
Comment thread du_setup.sh Fixed
Comment thread du_setup.sh Fixed
Comment thread du_setup.sh Fixed
Comment thread du_setup.sh Fixed
Comment thread du_setup.sh Fixed
@buildplan buildplan requested a review from Copilot October 14, 2025 08:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive provider cleanup functionality to automatically detect and optionally remove cloud provider packages, monitoring agents, and default users from VPS instances for enhanced security.

  • Implements environment detection to distinguish between commercial cloud VPS, personal VMs, and bare metal servers
  • Adds three new command-line flags for cleanup control: --cleanup-preview, --cleanup-only, and --skip-cleanup
  • Introduces intelligent cleanup functionality that detects 59+ provider packages, default users, SSH keys, and services with safety warnings

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
du_setup.sh Implements provider cleanup functionality with environment detection, new CLI flags, and comprehensive package/user removal features
README.md Updates documentation to reflect new v0.70 features including cleanup options and usage examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread du_setup.sh Outdated
Comment thread du_setup.sh
Comment thread du_setup.sh
Comment thread du_setup.sh Outdated
Comment thread du_setup.sh
Comment thread README.md Outdated
@buildplan buildplan requested a review from Copilot October 14, 2025 09:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread du_setup.sh
Comment thread du_setup.sh Fixed
@buildplan buildplan marked this pull request as ready for review October 17, 2025 21:46
@buildplan buildplan requested a review from Copilot October 17, 2025 21:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread du_setup.sh Outdated
Comment thread du_setup.sh Outdated
@buildplan buildplan merged commit a7edeb8 into main Oct 17, 2025
6 checks passed
@buildplan buildplan deleted the options branch October 19, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants