feat: Add SSH public key storage for users

- Add ssh_public_key column to User model for storing SSH keys
- Add database migration for ssh_public_key column
- Add SSH key section in user profile settings with validation
- Auto-inject user's SSH key when deploying VMs from templates
- Auto-inject user's SSH key when creating LXC containers
- Support for both regular and smart LXC creation endpoints
- Add i18n translations for SSH key UI (ru/en)
- Validate SSH key format (ssh-rsa, ssh-ed25519, ecdsa-sha2, ssh-dss)

Users can now save their SSH public key in Settings -> Account,
and it will be automatically added to any VM or LXC container
they create, enabling passwordless SSH access.
This commit is contained in:
2025-12-15 20:22:42 +05:00
parent 2b78d93710
commit 379afd0353
8 changed files with 162 additions and 4 deletions

View File

@@ -3962,6 +3962,36 @@ class I18nService:
"en": "Password must contain at least one special character"
},
# SSH Public Key
"ssh_public_key": {
"ru": "SSH Публичный ключ",
"en": "SSH Public Key"
},
"ssh_public_key_label": {
"ru": "Ваш SSH публичный ключ",
"en": "Your SSH Public Key"
},
"ssh_public_key_help": {
"ru": "Этот ключ будет автоматически добавляться при создании VM/LXC. Поддерживаются ключи ssh-rsa, ssh-ed25519, ecdsa.",
"en": "This key will be automatically added when creating VM/LXC instances. Supports ssh-rsa, ssh-ed25519, ecdsa keys."
},
"save_ssh_key": {
"ru": "Сохранить ключ",
"en": "Save Key"
},
"ssh_key_saved": {
"ru": "SSH ключ успешно сохранён",
"en": "SSH key saved successfully"
},
"error_saving_ssh_key": {
"ru": "Ошибка сохранения SSH ключа",
"en": "Error saving SSH key"
},
"invalid_ssh_key_format": {
"ru": "Неверный формат SSH ключа. Ключ должен начинаться с ssh-rsa, ssh-ed25519, ecdsa-sha2 или ssh-dss",
"en": "Invalid SSH key format. Key must start with ssh-rsa, ssh-ed25519, ecdsa-sha2 or ssh-dss"
},
# IP Blacklist
"ip_blacklist": {
"ru": "Чёрный список IP",