Add SSH host/login/password/key when creating VPN servers
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,35 +5,144 @@
|
||||
<h1>Серверы</h1>
|
||||
</div>
|
||||
|
||||
{% if flash %}
|
||||
{% if flash.startswith('error:') %}
|
||||
<div class="flash flash-error">{{ flash[6:] }}</div>
|
||||
{% elif flash == 'created' %}
|
||||
<div class="flash">Сервер добавлен</div>
|
||||
{% elif flash == 'saved' %}
|
||||
<div class="flash">Сохранено</div>
|
||||
{% elif flash == 'deleted' %}
|
||||
<div class="flash">Сервер удалён</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="panel" style="margin-bottom:1.25rem">
|
||||
<div class="panel-head"><strong>Добавить сервер</strong></div>
|
||||
<div class="panel-body">
|
||||
<form method="post" action="/admin/servers" class="stack">
|
||||
<div class="form-grid-2">
|
||||
<label>Название
|
||||
<input name="name" placeholder="Мой VPS" />
|
||||
</label>
|
||||
<label>Протокол
|
||||
<select name="protocol" required>
|
||||
<option value="wireguard">WireGuard</option>
|
||||
<option value="awg2">AmneziaWG 2.0</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3 class="form-section">SSH подключение</h3>
|
||||
<div class="form-grid-2">
|
||||
<label>Host
|
||||
<input name="ssh_host" placeholder="1.2.3.4 или vps.example.com" required />
|
||||
</label>
|
||||
<label>SSH порт
|
||||
<input type="number" name="ssh_port" value="22" required />
|
||||
</label>
|
||||
<label>Логин
|
||||
<input name="ssh_username" value="root" required />
|
||||
</label>
|
||||
<label>Пароль
|
||||
<input type="password" name="ssh_password" placeholder="или оставьте пустым, если ключ" autocomplete="new-password" />
|
||||
</label>
|
||||
</div>
|
||||
<label>Приватный ключ (опционально, вместо пароля)
|
||||
<textarea name="ssh_private_key" rows="5" placeholder="-----BEGIN OPENSSH PRIVATE KEY----- ... -----END OPENSSH PRIVATE KEY-----"></textarea>
|
||||
</label>
|
||||
<p class="muted" style="margin:0">Нужен пароль <em>или</em> приватный ключ.</p>
|
||||
|
||||
<h3 class="form-section">VPN endpoint</h3>
|
||||
<div class="form-grid-2">
|
||||
<label>Public host (если пусто — как SSH host)
|
||||
<input name="public_host" placeholder="тот же IP/домен" />
|
||||
</label>
|
||||
<label>VPN порт
|
||||
<input type="number" name="public_port" placeholder="авто" />
|
||||
</label>
|
||||
<label>DNS
|
||||
<input name="dns" value="1.1.1.1" />
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn btn-accent" type="submit">Добавить сервер</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for s in servers %}
|
||||
<div class="panel" style="margin-bottom:1rem">
|
||||
<div class="panel-head">
|
||||
<strong>{{ s.name }} <span class="badge badge-proto">{{ s.protocol }}</span></strong>
|
||||
<form method="post" action="/admin/servers/{{ s.id }}/sync" class="inline-form">
|
||||
<button class="btn btn-sm btn-ghost" type="submit">Синхронизировать conf</button>
|
||||
</form>
|
||||
<div class="actions">
|
||||
<form method="post" action="/admin/servers/{{ s.id }}/sync" class="inline-form">
|
||||
<button class="btn btn-sm btn-ghost" type="submit">Синхронизировать conf</button>
|
||||
</form>
|
||||
<form method="post" action="/admin/servers/{{ s.id }}/delete" class="inline-form" onsubmit="return confirm('Удалить сервер и всех клиентов?')">
|
||||
<button class="btn btn-sm btn-danger" type="submit">Удалить</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p class="muted" style="margin-top:0">Интерфейс <code>{{ s.interface_name }}</code> · подсеть <code>{{ s.subnet }}</code> · клиентов: {{ s.clients|length }}</p>
|
||||
<p class="muted" style="margin-top:0">
|
||||
Интерфейс <code>{{ s.interface_name }}</code> · подсеть <code>{{ s.subnet }}</code> · клиентов: {{ s.clients|length }}
|
||||
{% if s.ssh_host %}
|
||||
· SSH
|
||||
{% if s.ssh_private_key %}<span class="badge badge-ok">ключ</span>{% endif %}
|
||||
{% if s.ssh_password %}<span class="badge badge-ok">пароль</span>{% endif %}
|
||||
{% else %}
|
||||
· <span class="badge badge-off">SSH не задан</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p><code>Public key:</code> <span class="muted">{{ s.server_public_key }}</span></p>
|
||||
<form method="post" action="/admin/servers/{{ s.id }}" class="form-grid">
|
||||
<label>Public host
|
||||
<input name="public_host" value="{{ s.public_host }}" required />
|
||||
</label>
|
||||
<label>Port
|
||||
<input type="number" name="public_port" value="{{ s.public_port }}" required />
|
||||
|
||||
<form method="post" action="/admin/servers/{{ s.id }}" class="stack">
|
||||
<div class="form-grid-2">
|
||||
<label>Название
|
||||
<input name="name" value="{{ s.name }}" />
|
||||
</label>
|
||||
<label>DNS
|
||||
<input name="dns" value="{{ s.dns }}" />
|
||||
</label>
|
||||
<label>Public host
|
||||
<input name="public_host" value="{{ s.public_host }}" required />
|
||||
</label>
|
||||
<label>VPN порт
|
||||
<input type="number" name="public_port" value="{{ s.public_port }}" required />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<h3 class="form-section">SSH подключение</h3>
|
||||
<div class="form-grid-2">
|
||||
<label>Host
|
||||
<input name="ssh_host" value="{{ s.ssh_host or '' }}" placeholder="1.2.3.4" />
|
||||
</label>
|
||||
<label>SSH порт
|
||||
<input type="number" name="ssh_port" value="{{ s.ssh_port or 22 }}" />
|
||||
</label>
|
||||
<label>Логин
|
||||
<input name="ssh_username" value="{{ s.ssh_username or '' }}" placeholder="root" />
|
||||
</label>
|
||||
<label>Новый пароль
|
||||
<input type="password" name="ssh_password" placeholder="{% if s.ssh_password %}сохранён — введите, чтобы заменить{% else %}не задан{% endif %}" autocomplete="new-password" />
|
||||
</label>
|
||||
</div>
|
||||
<label>Новый приватный ключ
|
||||
<textarea name="ssh_private_key" rows="4" placeholder="{% if s.ssh_private_key %}ключ сохранён — вставьте новый, чтобы заменить{% else %}не задан{% endif %}"></textarea>
|
||||
</label>
|
||||
<div class="actions">
|
||||
<label class="check">
|
||||
<input type="checkbox" name="clear_ssh_password" value="1" /> очистить пароль
|
||||
</label>
|
||||
<label class="check">
|
||||
<input type="checkbox" name="clear_ssh_private_key" value="1" /> очистить ключ
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn btn-accent" type="submit">Сохранить</button>
|
||||
<label style="grid-column: 1 / -1">DNS
|
||||
<input name="dns" value="{{ s.dns }}" />
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="muted">Серверов пока нет — добавьте первый через форму выше.</p>
|
||||
{% endfor %}
|
||||
|
||||
<p class="muted">
|
||||
Конфиги пишутся в volume: <code>/data/wireguard</code> и <code>/data/amneziawg</code>.
|
||||
Подключите их к WG/AWG контейнерам на том же хосте.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user