[PR #16] [CLOSED] feat: Add SSH key authentication support #118

Closed
opened 2025-11-20 04:12:55 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/16
Author: @RXWatcher
Created: 10/3/2025
Status: Closed

Base: developmentHead: feat/ssh-key-authentication


📝 Commits (3)

  • 5823e54 Add GitHub templates and configuration (#8)
  • 5582d28 Update note from 'beat' to 'beta' in README
  • be65cee feat: Add SSH key authentication support

📊 Changes

12 files changed (+740 additions, -150 deletions)

View changed files

.github/CODEOWNERS (+15 -0)
.github/ISSUE_TEMPLATE/bug_report.yml (+50 -0)
.github/ISSUE_TEMPLATE/feature_request.yml (+33 -0)
.github/pull_request_template.md (+24 -0)
📝 README.md (+1 -1)
📝 src/app/_components/ServerForm.tsx (+80 -4)
📝 src/app/api/servers/[id]/route.ts (+19 -4)
📝 src/app/api/servers/route.ts (+19 -4)
📝 src/server/database.js (+11 -9)
📝 src/server/ssh-execution-service.js (+294 -106)
📝 src/server/ssh-service.js (+188 -20)
📝 src/types/server.ts (+6 -2)

📄 Description

Summary

  • Adds SSH key authentication as an alternative to password authentication for Proxmox servers
  • Resolves issues with servers that have password SSH authentication disabled
  • Maintains full backward compatibility with existing password authentication

Changes Made

Backend Infrastructure

  • Database Schema: Added ssh_key and auth_method fields to servers table with proper constraints
  • SSH Services: Updated all SSH-related services to support both authentication methods
  • Security: Implemented secure temporary SSH key file handling with proper permissions (0600) and automatic cleanup
  • Type Safety: Added comprehensive TypeScript type definitions and validation

Frontend Enhancements

  • Dynamic UI: Added authentication method selector with conditional form fields
  • Validation: Implemented SSH key format validation and comprehensive error handling
  • User Experience: Clear instructions and helpful error messages for both auth methods

API Updates

  • Endpoints: Updated all server CRUD operations to handle new authentication fields
  • Validation: Added proper server-side validation for authentication methods and credentials
  • Compatibility: Maintains backward compatibility with existing password-based configurations

Technical Details

Authentication Flow

  1. Password Authentication: Uses sshpass for password-based connections (existing behavior)
  2. SSH Key Authentication: Creates temporary key files with secure permissions, authenticates, then cleans up
  3. Validation: Both connection testing and script execution support both methods seamlessly

Security Features

  • SSH private keys are stored temporarily with 0600 permissions
  • Automatic cleanup of temporary key files on completion or error
  • Path validation and access controls maintained
  • Input sanitization and validation for both auth methods

Database Migration

The changes include automatic database schema updates that add the new fields while preserving existing data. No manual migration required.

Test Plan

  • Build verification: TypeScript compilation and linting passes
  • Form validation: Both password and SSH key validation working
  • API validation: Server-side validation for all auth method combinations
  • Backward compatibility: Existing password-based servers continue to work
  • Security: Temporary key files created with proper permissions and cleaned up

Breaking Changes

None - this is a fully backward-compatible enhancement.

🤖 Generated with Claude Code


🔄 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/community-scripts/ProxmoxVE-Local/pull/16 **Author:** [@RXWatcher](https://github.com/RXWatcher) **Created:** 10/3/2025 **Status:** ❌ Closed **Base:** `development` ← **Head:** `feat/ssh-key-authentication` --- ### 📝 Commits (3) - [`5823e54`](https://github.com/community-scripts/ProxmoxVE-Local/commit/5823e544641c3fcbbbdacf0f945e0cb60d674162) Add GitHub templates and configuration (#8) - [`5582d28`](https://github.com/community-scripts/ProxmoxVE-Local/commit/5582d288d708dac7557b0e89935c923c02cb69af) Update note from 'beat' to 'beta' in README - [`be65cee`](https://github.com/community-scripts/ProxmoxVE-Local/commit/be65cee6adfa19d922bb42b4dc3654262fdb4fd3) feat: Add SSH key authentication support ### 📊 Changes **12 files changed** (+740 additions, -150 deletions) <details> <summary>View changed files</summary> ➕ `.github/CODEOWNERS` (+15 -0) ➕ `.github/ISSUE_TEMPLATE/bug_report.yml` (+50 -0) ➕ `.github/ISSUE_TEMPLATE/feature_request.yml` (+33 -0) ➕ `.github/pull_request_template.md` (+24 -0) 📝 `README.md` (+1 -1) 📝 `src/app/_components/ServerForm.tsx` (+80 -4) 📝 `src/app/api/servers/[id]/route.ts` (+19 -4) 📝 `src/app/api/servers/route.ts` (+19 -4) 📝 `src/server/database.js` (+11 -9) 📝 `src/server/ssh-execution-service.js` (+294 -106) 📝 `src/server/ssh-service.js` (+188 -20) 📝 `src/types/server.ts` (+6 -2) </details> ### 📄 Description ## Summary - Adds SSH key authentication as an alternative to password authentication for Proxmox servers - Resolves issues with servers that have password SSH authentication disabled - Maintains full backward compatibility with existing password authentication ## Changes Made ### Backend Infrastructure - **Database Schema**: Added `ssh_key` and `auth_method` fields to servers table with proper constraints - **SSH Services**: Updated all SSH-related services to support both authentication methods - **Security**: Implemented secure temporary SSH key file handling with proper permissions (0600) and automatic cleanup - **Type Safety**: Added comprehensive TypeScript type definitions and validation ### Frontend Enhancements - **Dynamic UI**: Added authentication method selector with conditional form fields - **Validation**: Implemented SSH key format validation and comprehensive error handling - **User Experience**: Clear instructions and helpful error messages for both auth methods ### API Updates - **Endpoints**: Updated all server CRUD operations to handle new authentication fields - **Validation**: Added proper server-side validation for authentication methods and credentials - **Compatibility**: Maintains backward compatibility with existing password-based configurations ## Technical Details ### Authentication Flow 1. **Password Authentication**: Uses `sshpass` for password-based connections (existing behavior) 2. **SSH Key Authentication**: Creates temporary key files with secure permissions, authenticates, then cleans up 3. **Validation**: Both connection testing and script execution support both methods seamlessly ### Security Features - SSH private keys are stored temporarily with 0600 permissions - Automatic cleanup of temporary key files on completion or error - Path validation and access controls maintained - Input sanitization and validation for both auth methods ### Database Migration The changes include automatic database schema updates that add the new fields while preserving existing data. No manual migration required. ## Test Plan - [x] Build verification: TypeScript compilation and linting passes - [x] Form validation: Both password and SSH key validation working - [x] API validation: Server-side validation for all auth method combinations - [x] Backward compatibility: Existing password-based servers continue to work - [x] Security: Temporary key files created with proper permissions and cleaned up ## Breaking Changes None - this is a fully backward-compatible enhancement. 🤖 Generated with [Claude Code](https://claude.ai/code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 04:12:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE-Local#118