2025-08-01 14:56:30 +05:00
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "SSH and CageFS - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
< link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css" >
< script src = "https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js" > < / script >
< style >
/* Ultra-Modern CyberPanel Design System */
:root {
--primary-color: #6366f1;
--primary-hover: #5558e3;
--primary-light: #eef2ff;
--secondary-color: #8b5cf6;
--accent-color: #ec4899;
--success-color: #10b981;
--danger-color: #ef4444;
--warning-color: #f59e0b;
--info-color: #3b82f6;
--bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--bg-gradient-alt: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
--bg-gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
--bg-light: #f8fafc;
--bg-card: #ffffff;
--bg-hover: #f1f5f9;
--border-color: #e2e8f0;
--border-light: #f1f5f9;
--text-primary: #1e293b;
--text-secondary: #64748b;
--text-muted: #94a3b8;
--shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
--shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
--shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
--shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
--radius-full: 9999px;
--transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Container Styling */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
min-height: 100vh;
background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}
/* Page Title Section */
#page-title {
background: var(--bg-gradient);
color: white;
padding: 40px;
border-radius: var(--radius-xl);
margin-bottom: 30px;
box-shadow: var(--shadow-xl);
position: relative;
overflow: hidden;
}
#page-title::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.5; }
50% { transform: scale(1.1); opacity: 0.3; }
}
#page-title h2 {
font-size: 32px;
font-weight: 700;
margin-bottom: 10px;
letter-spacing: -0.5px;
position: relative;
z-index: 1;
}
#page-title p {
font-size: 16px;
opacity: 0.95;
margin: 0;
position: relative;
z-index: 1;
line-height: 1.6;
}
/* Main Panel */
.panel {
background: var(--bg-card);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-lg);
border: 1px solid var(--border-color);
overflow: hidden;
position: relative;
}
.panel-body {
padding: 0;
}
/* Content Box Header */
.content-box-header {
background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-light) 100%);
padding: 25px 30px;
margin: 0;
font-size: 20px;
font-weight: 700;
color: var(--text-primary);
border-bottom: 1px solid var(--border-color);
letter-spacing: -0.3px;
display: flex;
align-items: center;
gap: 15px;
}
.content-box-header img {
width: 24px;
height: 24px;
}
/* Form Wrapper */
.example-box-wrapper {
padding: 30px;
}
/* Form Styling */
.form-horizontal {
background: var(--bg-light);
padding: 30px;
border-radius: var(--radius-lg);
border: 1px solid var(--border-color);
margin-bottom: 30px;
}
.form-group {
margin-bottom: 25px;
transition: var(--transition-base);
}
.form-group:hover {
transform: translateX(5px);
}
.control-label {
font-weight: 600;
color: var(--text-primary);
margin-bottom: 8px;
font-size: 14px;
letter-spacing: 0.3px;
display: flex;
align-items: center;
gap: 8px;
}
.form-control {
border: 2px solid var(--border-color);
border-radius: var(--radius-md);
padding: 12px 16px;
font-size: 15px;
transition: var(--transition-base);
background: white;
}
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
outline: none;
}
textarea.form-control {
resize: vertical;
min-height: 120px;
}
/* Enhanced Buttons */
.btn {
padding: 14px 32px;
border-radius: var(--radius-md);
font-weight: 600;
transition: var(--transition-base);
border: none;
font-size: 15px;
letter-spacing: 0.3px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
position: relative;
overflow: hidden;
cursor: pointer;
text-decoration: none;
}
.btn::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
.btn:active::before {
width: 300px;
height: 300px;
}
.btn-primary {
background: var(--bg-gradient);
color: white;
box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
color: white;
}
.btn-success {
background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
color: white;
box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
color: white;
}
.btn-warning {
background: linear-gradient(135deg, var(--warning-color) 0%, #dc2626 100%);
color: white;
box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
color: white;
}
.btn-link {
background: transparent;
color: var(--primary-color);
box-shadow: none;
padding: 8px 16px;
font-size: 14px;
}
.btn-link:hover {
color: var(--primary-hover);
text-decoration: underline;
}
.btn-lg {
padding: 16px 40px;
font-size: 16px;
}
/* Terminal Button */
.terminal-btn-wrapper {
position: relative;
z-index: 2;
}
/* SSH Keys Table */
.table-wrapper {
background: var(--bg-card);
border-radius: var(--radius-lg);
overflow: hidden;
box-shadow: var(--shadow-sm);
margin-bottom: 30px;
}
.table {
margin: 0;
border: none;
border-radius: 0;
}
.table thead {
background: var(--bg-gradient);
}
.table thead th {
border: none;
color: white;
font-weight: 600;
padding: 18px;
font-size: 14px;
text-transform: uppercase;
letter-spacing: 0.6px;
}
.table tbody tr {
transition: all var(--transition-base);
border-bottom: 1px solid var(--border-light);
}
.table tbody tr:last-child {
border-bottom: none;
}
.table tbody tr:hover {
background: var(--bg-hover);
box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.table tbody td {
padding: 18px;
border: none;
vertical-align: middle;
color: var(--text-primary);
}
/* Delete Button in Table */
.delete-key {
width: 32px;
height: 32px;
background: var(--danger-color);
color: white;
border-radius: var(--radius-sm);
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: var(--transition-base);
font-weight: 700;
}
.delete-key:hover {
background: #dc2626;
transform: scale(1.1);
box-shadow: var(--shadow-md);
}
/* Alerts */
.alert {
border-radius: var(--radius-lg);
border: none;
padding: 20px 24px;
margin-bottom: 25px;
font-weight: 500;
display: flex;
align-items: flex-start;
gap: 12px;
}
.alert-danger {
background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
color: #991b1b;
border: 1px solid #fca5a5;
}
.alert-warning {
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
color: #92400e;
border: 1px solid #fcd34d;
}
/* Modal Styling */
.modal-content {
border-radius: var(--radius-xl);
border: none;
box-shadow: var(--shadow-xl);
}
.modal-header {
background: var(--bg-gradient);
color: white;
border-bottom: none;
padding: 20px 25px;
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title {
font-weight: 600;
font-size: 18px;
}
.modal-body {
padding: 25px;
}
.modal-header .close {
color: white;
opacity: 0.8;
font-size: 24px;
}
.modal-header .close:hover {
opacity: 1;
}
/* Terminal Container */
#xterm-container {
border-radius: var(--radius-md);
overflow: hidden;
box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
/* Section Headers */
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 25px;
}
.section-header h3 {
font-size: 20px;
font-weight: 700;
color: var(--text-primary);
margin: 0;
display: flex;
align-items: center;
gap: 10px;
}
.section-header h3::before {
content: '';
width: 4px;
height: 24px;
background: var(--bg-gradient);
border-radius: 2px;
}
/* Loading Animation */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#wpInstallLoading {
animation: spin 1s linear infinite;
width: 20px;
height: 20px;
vertical-align: middle;
}
/* Responsive */
@media (max-width: 768px) {
.container {
padding: 15px;
}
#page-title {
padding: 25px;
}
#page-title h2 {
font-size: 24px;
}
.form-horizontal {
padding: 20px;
}
.control-label {
margin-bottom: 10px;
}
.btn-lg {
padding: 12px 28px;
font-size: 14px;
}
.terminal-btn-wrapper {
margin-top: 20px;
}
}
< / style >
< div ng-controller = "sshAccess" class = "container" >
< div id = "page-title" >
< div style = "display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px;" >
< div style = "flex: 1;" >
< h2 >
< i class = "fas fa-terminal" style = "margin-right: 10px;" > < / i >
{% trans "SSH Access" %}
< / h2 >
< p > {% trans "Set up SSH access and enable/disable CageFS for" %} < span id = "domainName" > {{ domainName }}< / span > . {% trans "CageFS requires CloudLinux OS." %}< / p >
< / div >
< div class = "terminal-btn-wrapper" >
< button type = "button" class = "btn btn-success btn-lg" ng-click = "openWebTerminal()" >
< i class = "fas fa-desktop" > < / i >
{% trans "Open Terminal" %}
< / button >
< / div >
< / div >
< / div >
< div class = "panel" >
< div class = "panel-body" >
< div class = "example-box-wrapper" >
{% if accessed_via_ip %}
< div class = "alert alert-danger" >
< i class = "fas fa-exclamation-triangle" style = "font-size: 20px;" > < / i >
< div >
< strong > {% trans "Notice:" %}< / strong > {% trans "You are accessing CyberPanel via an IP address." %}< br >
{% trans "The Web Terminal will not work when accessed via IP. Please issue a hostname SSL and access the panel using your hostname (with valid SSL) to enable the terminal." %}< br >
2025-09-13 17:44:37 +02:00
< a href = "{{ ssl_issue_link }}" target = "_blank" rel = "noopener" class = "btn btn-warning" style = "margin-top:10px;" >
2025-08-01 14:56:30 +05:00
< i class = "fas fa-lock" > < / i >
{% trans "Issue Hostname SSL" %}
< / a >
< / div >
< / div >
{% endif %}
{% if is_selfsigned_ssl %}
< div class = "alert alert-warning" >
< i class = "fas fa-shield-alt" style = "font-size: 20px;" > < / i >
< div >
< strong > {% trans "Warning:" %}< / strong > {% trans "Your server is using a self-signed SSL certificate for the web terminal." %}< br >
{% trans "For security and browser compatibility, please issue a valid hostname SSL certificate." %}< br >
2025-09-13 17:44:37 +02:00
< a href = "{{ ssl_issue_link }}" target = "_blank" rel = "noopener" class = "btn btn-warning" style = "margin-top:10px;" >
2025-08-01 14:56:30 +05:00
< i class = "fas fa-lock" > < / i >
{% trans "Issue SSL Now" %}
< / a >
< / div >
< / div >
{% endif %}
< div class = "section-header" >
< h3 >
{% trans "SSH Configuration" %}
< img ng-hide = "wpInstallLoading" src = "{% static 'images/loading.gif' %}" style = "display: none;" id = "wpInstallLoading" >
< / h3 >
2025-09-13 17:44:37 +02:00
< a target = "_blank" rel = "noopener" href = "https://cyberpanel.net/KnowledgeBase/home/ssh-manager-cyberpanel/" class = "btn btn-link" >
2025-08-01 14:56:30 +05:00
< i class = "fas fa-book" > < / i >
{% trans "SFTP Docs" %}
< / a >
< / div >
< form name = "websiteCreationForm" action = "/" id = "createPackages" class = "form-horizontal bordered-row" >
< div ng-hide = "installationDetailsForm" class = "form-group" >
< label class = "col-sm-3 control-label" > {% trans "SSH User" %}< / label >
< div class = "col-sm-6" >
< div style = "padding: 12px 16px; background: var(--bg-light); border-radius: var(--radius-md); border: 1px solid var(--border-color);" >
< strong id = "externalApp" > {{ externalApp }}< / strong >
< span style = "color: var(--text-secondary); margin-left: 10px;" >
({% trans "for domain" %} {{ domainName }})
< / span >
< / div >
< / div >
< / div >
< div class = "form-group" >
< label class = "col-sm-3 control-label" >
< i class = "fas fa-key" > < / i >
{% trans "Password" %}
< / label >
< div class = "col-sm-6" >
< input type = "password" class = "form-control" ng-model = "password" placeholder = "{% trans 'Enter new password' %}" required >
< / div >
< / div >
< div ng-hide = "installationDetailsForm" class = "form-group" >
< label class = "col-sm-3 control-label" > < / label >
< div class = "col-sm-6" >
< button type = "button" ng-click = "setupSSHAccess()" class = "btn btn-primary btn-lg" >
< i class = "fas fa-save" > < / i >
{% trans "Save Changes" %}
< / button >
< / div >
< / div >
< / form >
< div class = "section-header" style = "margin-top: 50px;" >
< h3 > {% trans "SSH Keys" %}< / h3 >
< / div >
< div class = "table-wrapper" >
< table class = "table" >
< thead >
< tr >
< th > {% trans "User Name" %}< / th >
< th > {% trans "Key" %}< / th >
< th style = "width: 100px;" > {% trans "Delete" %}< / th >
< / tr >
< / thead >
< tbody >
< tr ng-repeat = "record in records track by $index" >
< td ng-bind = "record.userName" > < / td >
< td >
< code style = "background: var(--bg-light); padding: 4px 8px; border-radius: 4px; font-size: 12px;" ng-bind = "record.key.substring(0, 50) + (record.key.length > 50 ? '...' : '')" >
< / code >
< / td >
< td >
< div class = "delete-key" ng-click = "deleteKey(record.key)" >
< i class = "fas fa-times" > < / i >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div ng-hide = "keyBox" style = "margin-bottom: 20px;" >
< textarea placeholder = "{% trans 'Paste your public key here...' %}"
ng-model="keyData"
rows="6"
class="form-control"
style="font-family: 'Courier New', monospace; font-size: 13px;">{{ logs }}< / textarea >
< / div >
< div ng-hide = "showKeyBox" style = "margin-bottom: 20px;" >
< button type = "button" ng-click = "addKey()" class = "btn btn-primary" >
< i class = "fas fa-plus" > < / i >
{% trans "Add Key" %}
< / button >
< / div >
< div ng-hide = "saveKeyBtn" >
< button type = "button" ng-click = "saveKey()" class = "btn btn-success" >
< i class = "fas fa-save" > < / i >
{% trans "Save Key" %}
< / button >
< / div >
< / div >
< / div >
< / div >
<!-- Web Terminal Modal -->
< div id = "web-terminal-modal" class = "modal fade" tabindex = "-1" role = "dialog" >
< div class = "modal-dialog modal-lg" role = "document" >
< div class = "modal-content" >
< div class = "modal-header" >
< h4 class = "modal-title" >
< i class = "fas fa-terminal" style = "margin-right: 10px;" > < / i >
{% trans "Web SSH Terminal" %}
< / h4 >
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close" >
< span aria-hidden = "true" > × < / span >
< / button >
< / div >
< div class = "modal-body" >
{% if not has_addons %}
< div class = "alert alert-warning" >
< i class = "fas fa-info-circle" style = "font-size: 20px;" > < / i >
< div >
< strong > {% trans "This feature requires the CyberPanel Add-ons bundle." %}< / strong > < br >
2025-09-13 17:44:37 +02:00
< a href = "https://cyberpanel.net/cyberpanel-addons" target = "_blank" rel = "noopener" style = "color: var(--primary-color); text-decoration: underline; font-weight: 600;" >
2025-08-01 14:56:30 +05:00
{% trans "Learn more & upgrade" %}
< / a >
< / div >
< / div >
< div style = "position: relative; width: 100%; height: 400px;" >
< div id = "xterm-container" style = "width:100%;height:400px;background:#000;" > < / div >
< div style = "position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.9); display: flex; align-items: center; justify-content: center; z-index: 10; border-radius: var(--radius-md); backdrop-filter: blur(5px);" >
< div style = "text-align: center;" >
< i class = "fas fa-lock" style = "font-size: 48px; color: var(--text-muted); margin-bottom: 20px; display: block;" > < / i >
< p style = "font-size: 16px; color: var(--text-secondary); font-weight: 600;" >
{% trans "Web Terminal is disabled. Please upgrade to CyberPanel Add-ons to enable this feature." %}
< / p >
< / div >
< / div >
< / div >
{% else %}
< div id = "xterm-container" style = "width:100%;height:400px;background:#000;" > < / div >
{% endif %}
< / div >
< / div >
< / div >
< / div >
< / div >
{% endblock %}