Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve bug during upgrade from 2.0.7 #267

Merged
merged 2 commits into from
Feb 15, 2025

Conversation

psyray
Copy link
Contributor

@psyray psyray commented Feb 14, 2025

fix #263

Improve installation script and update handling from version below 2.1.0

This set of changes enhances the installation script and update mechanism of reNgine-ng. The installation script now handles potential issues with Docker images and volumes, ensuring a smoother installation process. The update check has been improved to reduce API calls and provide a better user experience. Additionally, configuration files for certain tools are now managed during installation.

This set of changes enhances the installation process and update checking mechanism. The installation script now removes old Docker images, fixes permissions for Docker volumes and the project directory, and handles configuration files for various tools. The update check has been improved to reduce unnecessary API calls. Additionally, minor updates have been made to the documentation links and Docker configuration.
This change modifies how reNgine checks for updates. Instead of always showing a UI notification when an update is available, the notification is now suppressed unless explicitly requested by the user (by clicking "Check for Updates" in the menu) or a day has passed since the last check. The update check itself still runs regularly in the background.
@psyray psyray added the bug Something isn't working label Feb 14, 2025
@psyray psyray self-assigned this Feb 14, 2025
Copy link
Contributor

sourcery-ai bot commented Feb 14, 2025

Reviewer's Guide by Sourcery

This pull request enhances the installation script and update mechanism for reNgine-ng, focusing on handling Docker images and volumes, improving update checks, and managing configuration files. Key changes include the addition of functions to remove old Docker images, fix volume permissions, and manage project ownership. The update mechanism now reduces API calls and provides a better user experience by checking for updates more efficiently.

Sequence diagram for Docker image and volume handling during installation

sequenceDiagram
    participant User
    participant InstallScript
    participant Docker
    User->>InstallScript: Run installation script
    InstallScript->>Docker: Check for old Docker images
    Docker-->>InstallScript: List of old images
    InstallScript->>Docker: Remove old images
    Docker-->>InstallScript: Confirmation of removal
    InstallScript->>Docker: Check and fix volume permissions
    Docker-->>InstallScript: Confirmation of permission fix
    InstallScript->>User: Installation complete
Loading

Sequence diagram for update check mechanism

sequenceDiagram
    participant User
    participant WebApp
    participant LocalStorage
    participant API
    User->>WebApp: Initiate update check
    WebApp->>LocalStorage: Check 'update_available' flag
    alt Update available
        WebApp->>API: Fetch update details
        API-->>WebApp: Update details
        WebApp->>LocalStorage: Update 'update_available' and details
        WebApp->>User: Notify update available
    else No update available
        WebApp->>LocalStorage: Check last update date
        alt One day passed
            WebApp->>API: Fetch update details
            API-->>WebApp: No update available
            WebApp->>LocalStorage: Update 'last_update_checked'
            WebApp->>User: Notify no update
        else Same day
            WebApp->>User: Notify no update
        end
    end
Loading

Class diagram for installation script enhancements

classDiagram
    class InstallScript {
        +install_make()
        +remove_old_images()
        +fix_volumes_permissions(user_id, group_id)
        +fix_project_ownership(user_id, group_id)
        +main()
    }
    class Docker {
        +ps()
        +rmi(image)
        +volume_inspect(volume)
        +run(command)
    }
    InstallScript --> Docker : uses
Loading

File-Level Changes

Change Details Files
Enhance installation script to handle Docker images and volumes.
  • Added function to remove old Docker images from version 2.0.7.
  • Implemented function to fix permissions for Docker volumes.
  • Introduced function to set correct ownership of the project directory.
install.sh
Improve update check mechanism in the web interface.
  • Replaced daily update check with a more efficient update check function.
  • Removed redundant code for update badge visibility.
  • Refactored update check logic to reduce API calls and handle rate limits.
web/templates/base/base.html
Manage configuration files during installation.
  • Added logic to copy configuration files for tools like theHarvester, amass, and gau.
  • Created symbolic link for theHarvester configuration if it doesn't exist.
install.sh
Update Docker Compose configuration to include new volume.
  • Added 'github_repos' volume to Docker Compose services.
  • Removed unused 'static_volume' from Docker Compose configuration.
docker/docker-compose.yml
Update UI elements related to update checks.
  • Modified top bar to use the new update check function.
  • Simplified update check UI text.
web/templates/base/_items/top_bar.html

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@psyray psyray requested a review from 0b3ud February 14, 2025 20:58
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @psyray - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a rollback mechanism or detailed logging for the Docker image removal process to aid in debugging failed removals.
  • The update logic in the web template could be simplified by extracting the API call into a separate function.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@0b3ud 0b3ud left a comment

Choose a reason for hiding this comment

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

By following the wiki step by step it works
No issues or bugs are detected

@0b3ud 0b3ud merged commit 20b3bfa into release/2.1.1 Feb 15, 2025
13 checks passed
@0b3ud 0b3ud deleted the fix/263-tools-config-files branch February 15, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(tools): Amass, GAU and theHarvester config files not present when updating
2 participants