Skip to content

feat: add password authentication and SSH key passphrase support#6

Merged
inureyes merged 3 commits intomainfrom
feature/password-support
Aug 22, 2025
Merged

feat: add password authentication and SSH key passphrase support#6
inureyes merged 3 commits intomainfrom
feature/password-support

Conversation

@inureyes
Copy link
Member

Summary

  • Add password-based authentication support with -P/--password flag
  • Automatically detect encrypted SSH keys and prompt for passphrases
  • Fix default username to use current user instead of hardcoded 'root'

Key Changes

Authentication Enhancements

  • Password authentication: New -P/--password flag enables secure password prompting
  • Encrypted key support: Automatically detects encrypted SSH keys (both explicit and default paths) and prompts for passphrase
  • Multiple key formats: Checks for ed25519, RSA, ECDSA, and DSA keys in order of preference
  • Secure prompting: Uses rpassword crate for secure password/passphrase input without echo

Default User Improvement

  • Current user detection: Uses logged-in user as default instead of 'root'
  • Multiple detection methods: Checks USER, USERNAME, LOGNAME env vars and system username
  • Security improvement: Prevents accidental root connections for non-root users

Documentation Updates

  • Updated --help output with new authentication options
  • Added comprehensive Authentication section to README.md
  • Updated man page with password and passphrase documentation
  • Improved CLI help text to indicate passphrase support

Test Plan

  • Test password authentication with -P flag
  • Test encrypted SSH key detection and passphrase prompting
  • Verify current user is used as default (not root)
  • Test with various SSH key types (ed25519, RSA, etc.)
  • Verify all commands work with new auth methods (exec, upload, download, ping)
  • Unit tests for authentication method selection

- Add --password flag for password-based authentication
- Automatically detect and prompt for passphrases on encrypted SSH keys
- Support passphrase entry for both explicit and default key paths
- Check multiple default key types (ed25519, rsa, ecdsa, dsa)
- Update all commands (exec, upload, download, ping) to support new auth methods
- Add secure password/passphrase prompting using rpassword crate
- Update man page with password flag and passphrase information
- Add authentication section to README with examples
- Improve help text for identity flag to mention passphrase support
- Keep version number unchanged at 0.3.0
- Replace hardcoded 'root' fallback with current user detection
- Try USER, USERNAME, LOGNAME environment variables first
- Use whoami crate to get system username as last resort
- Add test to verify current user is used correctly
- Ensures non-root users don't accidentally connect as root
@inureyes inureyes added the type:enhancement New feature or request label Aug 22, 2025
@inureyes inureyes self-assigned this Aug 22, 2025
@inureyes inureyes merged commit 1ccdea7 into main Aug 22, 2025
2 checks passed
@inureyes inureyes added priority:medium Medium priority issue status:done Completed feature labels Sep 9, 2025
@inureyes inureyes deleted the feature/password-support branch October 30, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority issue status:done Completed type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant