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

Enhancement Request: Implementing Multiple SSH Keys with Enhanced Management Features #1882

Closed
Tracked by #1533
Mahmoud-Emad opened this issue Jan 4, 2024 · 15 comments
Assignees
Labels
enhancements Small changes that can enhance the code/UI playground type_feature New feature or request
Milestone

Comments

@Mahmoud-Emad
Copy link
Contributor

Description

The current SSH key page offers limited functionality with support for only a single SSH key. To improve user experience and flexibility, I propose the implementation of a feature that allows users to manage multiple SSH keys.

Enhancements Proposed

  1. Multiple SSH Keys:

    • Users should be able to save and manage more than one SSH key.
    • The option to activate only one SSH key at a time should be available.
  2. Key Activation:

    • Users can easily switch between SSH keys and activate/deactivate one.
    • Each SSH key should have a generated fingerprint, and users must enter the fingerprint when activating a key.
  3. Adding SSH Keys:

    • Users should have the ability to add multiple SSH keys with no set limitations.
  4. Deletion Options:

    • Users can delete individual SSH keys.
    • Batch deletion should be supported, allowing users to select multiple keys for deletion.

Benefits:

  • Enhanced flexibility in managing multiple SSH keys.
  • Improved security with unique fingerprints for each key.
  • Streamlined user experience with the ability to add, activate, and delete keys conveniently.

Additional Context:
This enhancement aims to provide users with a more robust and user-friendly interface for managing their SSH keys, catering to scenarios where multiple keys are used for different purposes.

Here are some designs we can stand for generating our design by @ehab-hassan

  • image
  • image
@AlaaElattar AlaaElattar added playground enhancements Small changes that can enhance the code/UI labels Jan 4, 2024
@ramezsaeed ramezsaeed added this to the 2.4.0 milestone Jan 11, 2024
@AhmedHanafy725
Copy link
Contributor

after trying to deploy a vm with more than one ssh key, it works fine. Just set the sshkey env var with all required sshkeys separated by \n.

image

@AhmedHanafy725 AhmedHanafy725 removed their assignment Jan 29, 2024
@AhmedHanafy725 AhmedHanafy725 added the type_feature New feature or request label Jan 29, 2024
@MohamedElmdary MohamedElmdary moved this to Accepted in 3.14.x Feb 14, 2024
@Mahmoud-Emad Mahmoud-Emad self-assigned this Mar 18, 2024
@Mahmoud-Emad Mahmoud-Emad moved this from Accepted to In Progress in 3.14.x Mar 18, 2024
@Mahmoud-Emad
Copy link
Contributor Author

Issue update

Work in progress

Working on the design of adding the multiple ssh-keys feature

Screencast.from.03-18-2024.04.59.50.PM.webm

@Mahmoud-Emad
Copy link
Contributor Author

Issue Update

Work Completed:

  • Implemented a helper function to generate a unique name for the generated key, enhancing the user experience by providing descriptive names.
  • Added activation and deletion logic, enabling users to activate or deactivate keys and delete them when necessary.
  • Developed the feature to delete all selected keys, with preparations underway to delete keys based on types such as active or all keys.

Work in Progress (WIP):

  • Refining the deletion process to ensure seamless removal of keys based on user-selected types (active or all keys).
  • Testing the functionality to ensure proper activation, deactivation, and deletion of keys across different scenarios.

@Mahmoud-Emad
Copy link
Contributor Author

Issue update

Work in progress

during the call with @ehab-hassan we have updated the whole style of the view to be like that

  • image
  • image
  • image
  • image

@Mahmoud-Emad
Copy link
Contributor Author

Issue Update:

Work in Progress (WIP):

  1. Enhanced the UI by adding a new dialog for importing SSH keys and updating the colors of the table.
  2. Calculated the SSH key fingerprint, consolidated form dialogs, and introduced a key details dialog. Also removed a redundant dialog.
  3. Refined the copy input wrapper to conditionally display the copy icon based on field data presence and improved the functionality of the generate dialog.
  • image
  • image
  • image

@Mahmoud-Emad
Copy link
Contributor Author

Issue Update

Work Completed

  • Resolved the issue related to saving the SSH key in the chain.
  • Implemented loading of SSH keys directly from the chain, eliminating the use of dummy data.

Work in Progress

  • Implementing the functionality to display all keys when deploying a deployment, with the requirement that active keys must be selected.
  • Working on updating the chain appropriately when activating, deactivating, or deleting any key to maintain data integrity.
  • Planning to remove the fingerprint from the chain data and calculate it dynamically during loading from the chain instead of storing it directly.
  • Addressing the issue related to the "Close" button in the SSH dialog view to ensure proper functionality.

@Mahmoud-Emad
Copy link
Contributor Author

Working on codescalers/CSHR#353 (comment)

@Mahmoud-Emad
Copy link
Contributor Author

Issue Update:

Work Completed:

  • Implemented a helper function to generate a name for the generated key to be saved with the key.
  • Added activation and deletion logic for SSH keys.
  • Worked on the feature to delete all selected keys, preparing to delete keys based on types like active or all keys.
  • Unified UI elements by removing the tonal theme from cards to maintain consistency with the contracts list view.
  • Enhanced UI by adding another dialog for importing SSH keys and updated the colors of the table.
  • Calculated SSH key fingerprints, consolidated form dialogs, and introduced a key details dialog while removing redundant dialog.
  • Refined the copy input wrapper to conditionally display the copy icon based on field data presence and improved the functionality of the generate dialog.
  • Migrated old SSH keys to the new SSH key type and set them as active keys.
  • Fixed the issue when saving SSH keys by loading them from the chain instead. Work in progress on updating the chain when pressing on active/inactive or deleting keys.
  • Enhanced the way of saving/removing the keys and improved the import key form by adding a rule to validate the entered SSH key.
  • Merged SSH key management functionality into all applications.

@Mahmoud-Emad Mahmoud-Emad moved this from In Progress to Pending Review in 3.14.x Mar 27, 2024
@Mahmoud-Emad Mahmoud-Emad moved this from Pending Review to In Verification in 3.14.x Apr 14, 2024
@khaledyoussef24
Copy link
Contributor

devnet
version : ee9af0e

user can import an existing ssh key but here the validation for the ssh key showed an error

Image

so i closed the dialogue and tried to generate an ssh key

Image

it generated the ssh key and saved it two times ( the first with the name of the dialouge that i closed and the 2nd with the new name and both with the same ssh key

Image
Image

it should only be saved one time and the ssh key should end with the name of the ssh key of the 2nd iteration not the first one

@khaledyoussef24 khaledyoussef24 moved this from In Verification to Accepted in 3.14.x Apr 15, 2024
@Mahmoud-Emad
Copy link
Contributor Author

@khaledyoussef24

Samar is working on it in #2543

@Mahmoud-Emad Mahmoud-Emad moved this from Accepted to In Progress in 3.14.x Apr 15, 2024
@khaledyoussef24
Copy link
Contributor

@Mahmoud-Emad @samaradel
the id also was duplicated after this issue
Screenshot 2024-04-15 at 3 47 37 PM

@Mahmoud-Emad
Copy link
Contributor Author

Issue Update

Work in Progress (WIP):

  • Validation Rule Enhancement: Modified the validation rule to accept SSH keys without names.

  • Key Name Handling: When importing an SSH key, the system now takes the key name if it exists or generates a new one if not.

  • Migration of Old SSH Keys: Implemented a mechanism to migrate old SSH keys after activating the profile manager. This migration process ensures that old SSH keys are transformed into the new SSHKeyData format.

  • Refactoring with SSHKeysManagement Class: Introduced a new class named SSHKeysManagement to centralize all SSH functionality. This class helps avoid code duplication by encapsulating functions that are used across multiple places.

  • Button State Management: Disabled the Import, Generate, and Export buttons while Deleting, Creating, and Updating SSH keys. This prevents errors and ensures data integrity during key manipulation operations.

  • Wait for Chain Completion: Implemented a mechanism to wait for the chain to finish its task before updating the table of SSH keys. This ensures that the table reflects the most up-to-date information after any operations on the SSH keys.

@Mahmoud-Emad Mahmoud-Emad mentioned this issue Apr 18, 2024
5 tasks
@Mahmoud-Emad Mahmoud-Emad moved this from In Progress to Pending Review in 3.14.x Apr 18, 2024
@Mahmoud-Emad Mahmoud-Emad moved this from Pending Review to In Progress in 3.14.x Apr 18, 2024
@Mahmoud-Emad
Copy link
Contributor Author

Issue Update

Work done

  • Rename the tab of 'SSH Key' to 'SSH Keys' to match the new feature
  • Generate a unique name/key and check if any of them exists on the profile keys
  • Check the user balance if enough or not before updating the chain and notify the user
  • Rename the text area and input fields
  • Migrate and take the old key in deployment if the balance isn't enough to avoid errors
  • Removed unused loggers.
  • Update the header font size.
  • Fixed the issue of exporting some keys by looping over the selected keys and filtering all user keys based on the ID and then passing them.

@Mahmoud-Emad Mahmoud-Emad moved this from In Progress to Pending Review in 3.14.x Apr 18, 2024
@Mahmoud-Emad Mahmoud-Emad moved this from Pending Review to In Verification in 3.14.x Apr 21, 2024
@khaledyoussef24
Copy link
Contributor

verified on devnet
version : dd92950
User now can have more than key
he can activate which keys are active for deployments , manage keys before deploying

Image
Image

Image

provided tests covering it
https://app.testlodge.com/a/26076/projects/40893/suites/234374?expand_section=430164#suite_section_430164

@khaledyoussef24 khaledyoussef24 moved this from In Verification to Done in 3.14.x Apr 21, 2024
@ramezsaeed
Copy link
Contributor

Verified:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements Small changes that can enhance the code/UI playground type_feature New feature or request
Projects
Status: Done
Development

No branches or pull requests

6 participants