Tags: codaxa/tunnelR
Tags
Dev (#20) * Feature/cli skeleton (#5) * Add initial configuration files and scripts for project setup (#1) - Create CI pipeline configuration for automated builds and tests - Add auto review settings for code consistency checks - Include .gitignore to exclude sensitive files - Set up golangci-lint configuration for code quality checks - Implement Taskfile for managing development tasks - Add Go module file for dependency management - Create scripts for encrypting and decrypting environment files * Refactor CLI structure and enhance task definitions in Taskfile.yml; add connect command with user and machine flags; update package comments for clarity. * removed unnecessary file * fix connection to a server not a machine * tidy mod file * fix(build): ensure dependencies are declared and create bin directory before build --------- Co-authored-by: Ahmed Samir <134155493+ahmd7@users.noreply.github.com> * Implement backend server with health and version endpoints, add configuration management, and update Taskfile for CLI operations (#6) * Implement login command with improved config handling (#7) * Implement login command with server configuration loading and token management * Fix config directory path from ~/.tempssh to ~/.tunnelr in connect and login commands * Improve error handling for response body closure in connect and login commands * Implement CLI commands for login and connect, add backend server initialization, and update Taskfile for building CLI and API applications --------- Co-authored-by: Menna Hassan <h.menna85@gmail.com> * feat: add initial database setup and user authentication (#8) * feat: add initial database setup and user authentication - Introduced `atlas.hcl` for environment configuration and database connection strings. - Updated `main.go` to initialize database connection and set up user repository and authentication service. - Enhanced `configs.go` to manage database and JWT configurations with sensible defaults. - Implemented user model and repository for user management. - Created authentication service for user registration and login functionalities. - Added HTTP handlers for user operations including registration and login. - Implemented middleware for JWT authentication and role-based access control. - Established database migrations for user table schema. - Removed deprecated router implementation and organized routes with Chi router. * resolve coderabbit comments * fix linting * Implement CLI and backend server with user authentication (#9) * feat: add GetUserInfo endpoint and whoami command for user information retrieval * feat: enhance GetUserInfo to handle JWT claims normalization * Implement CLI and backend server with user authentication (#10) * feat: add GetUserInfo endpoint and whoami command for user information retrieval * feat: enhance GetUserInfo to handle JWT claims normalization * feat: implement team management functionality with repository, service, and handler layers * feat: enhance team service with JWT role extraction and user admin checks * feat: implement team deletion functionality and enforce unique team names * feat: update API versioning and enhance team-user relationships in models * feat: remove unused JWT utility function for role extraction * feat: enhance team management by adding GetTeamUsers method and updating team routes * refactor: rename ExtractUserRole to extractUserRole for consistency and clarity --------- Co-authored-by: Menna Hassan <h.menna85@gmail.com> * feat: enhance login command and add team management functionality (#12) * feat: enhance login command and add team management functionality * fix: linting * refactor: coderabbit comments * Add user information retrieval and team management features (#13) * feat: add GetUserInfo endpoint and whoami command for user information retrieval * feat: enhance GetUserInfo to handle JWT claims normalization * feat: implement team management functionality with repository, service, and handler layers * feat: enhance team service with JWT role extraction and user admin checks * feat: implement team deletion functionality and enforce unique team names * feat: update API versioning and enhance team-user relationships in models * feat: remove unused JWT utility function for role extraction * feat: enhance team management by adding GetTeamUsers method and updating team routes * refactor: rename ExtractUserRole to extractUserRole for consistency and clarity * feat: implement AddUserToTeam functionality with corresponding HTTP handler and router endpoint * feat: add RemoveUserFromTeam functionality with corresponding HTTP handler and router endpoint * refactor: clean up imports and remove unnecessary whitespace in whoami command --------- Co-authored-by: Menna Hassan <h.menna85@gmail.com> * feat: Add machine management functionality (#14) - Implemented GetMachinesByTeamID method in TeamService to retrieve machines associated with a team. - Created Machine model to represent machine data in the application. - Added MachineRepository interface for machine data operations. - Developed repository methods for creating, updating, retrieving, and deleting machines. - Introduced MachineHandler for handling HTTP requests related to machine operations. - Added routes for machine management in the router. - Implemented user and team access checks for machine operations. - Created SQL migration scripts for machines and machine_teams tables. - Added utility functions for extracting user ID from JWT claims. * Implement CLI and backend server with user and machine management (#15) * feat: implement machines management commands for CLI * feat: enhance machines command with team management and detailed operations * feat: implement machines management commands for CLI * feat: enhance machines command with team management and detailed operations * fix: update machine ID reference and clean up team addition command flags * refactor: streamline machine removal and response handling; improve error logging * feat: enhance machine removal command with URL encoding and add alias for delete * Implement CLI and backend server with user and machine management (#16) * feat: implement machines management commands for CLI * feat: enhance machines command with team management and detailed operations * feat: implement machines management commands for CLI * feat: enhance machines command with team management and detailed operations * fix: update machine ID reference and clean up team addition command flags * refactor: streamline machine removal and response handling; improve error logging * feat: enhance machine removal command with URL encoding and add alias for delete * fix: update key field type to text for better handling of larger key data * Refactor/cli teams commands (#18) * Refactor CLI commands to utilize centralized config and request handling - Moved configuration loading to utils package and updated CLI commands (connect, login, machines, team, whoami) to use utils.LoadConfig(). - Implemented MakeAuthenticatedRequest in utils to handle authenticated HTTP requests, replacing direct request handling in CLI commands. - Removed redundant loadConfig function from CLI commands. - Added team management commands (add, remove, get) with appropriate request handling and response parsing. - Updated router to include team-related endpoints. * feat: add shared types for Team, User, Machine, and responses - Introduced shared types for Team, User, and Machine in `cmd/cli/shared/types.go`. - Added response types for listing team members and machines in `cmd/cli/shared/types.go`. feat: implement table printing utilities for machines, users, and teams - Created utility functions in `cmd/cli/utils/tables.go` to print formatted tables for machines, users, and teams. refactor: update team service to return machines with team details - Modified `GetMachinesByTeamID` in `internal/api/app/service/team_service.go` to return a team with its machines. - Updated `GetTeamByID` to remove user ID check, simplifying the function. fix: adjust repository and model definitions for teams and machines - Updated `internal/api/core/model/team.go` to include a slice of machines in the Team model. - Changed return types in `TeamRepository` and its implementation to return slices of machines instead of pointers. chore: clean up unused migration files - Deleted initial schema migration files that are no longer needed in `internal/cli/infrastructure/migrations`. * refactor: update utils references to cliutils across multiple files * fix coderabbit comments * Implement access logging and ephemeral user management for shell access (#17) * feat: Implement access logging and ephemeral user management for shell access - Added AccessLogService and AccessLogRepository for managing access logs. - Created AccessLog model to represent SSH access records. - Enhanced MachineRepository to include password and key fields in GetMachineByID. - Introduced ShellHandler for WebSocket connections, enabling shell access with ephemeral accounts. - Implemented ephemeral account creation, management, and cleanup on target machines. - Added WebSocket endpoint for shell access, including session management and error handling. - Updated router to include new WebSocket endpoint and access log service. - Enhanced authentication middleware to log incoming requests. - Added utility functions to extract username from JWT claims. * fix: add access logs to atlas * added migration files * feat: Enhance access log service and WebSocket handler with context management and error handling * feat: Improve error handling and logging in WebSocket and SSH session management - Enhanced error handling for writing messages and closing connections in WebSocket handlers. - Refactored WebSocket session management to improve readability and maintainability by extracting setup and lifecycle management into helper functions. - Added context management for SSH session setup and ephemeral user creation, ensuring proper cleanup and error logging. - Updated access log status handling to ensure accurate session state tracking. * feat: Add WebSocket SSH access command and improve session handling (#19) * fix: Correct LoadConfig function reference in access command * coderabbit comments --------- Co-authored-by: Menna Hassan <h.menna85@gmail.com> * remove test ssh endpoint --------- Co-authored-by: Ahmed Samir <134155493+ahmd7@users.noreply.github.com>