feat(remnawave): declarative panel on core-net and SelfSteal node on ger-nod-02
ansible-core-mon / deploy (push) Successful in 25s
ansible-core-secrets / deploy (push) Canceled after 0s
ansible-ger-nod-02 / deploy (push) Canceled after 0s
ansible-opnsense / deploy (push) Canceled after 0s
ansible-rus-central / deploy (push) Canceled after 0s
ansible-core-net / deploy (push) Failing after 26s
ansible-core-mon / deploy (push) Successful in 25s
ansible-core-secrets / deploy (push) Canceled after 0s
ansible-ger-nod-02 / deploy (push) Canceled after 0s
ansible-opnsense / deploy (push) Canceled after 0s
ansible-rus-central / deploy (push) Canceled after 0s
ansible-core-net / deploy (push) Failing after 26s
Add Remnawave panel+subscription behind Traefik (rw/sub.gunihome.ru), API bootstrap into Infisical, and ger-nod-02 node with Cloudflare DNS-01 SelfSteal (yali.gunis.top). Leaves remna.gunihome.ru on Golova untouched. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a0ec829eee
commit
8caaddc779
25 files changed
+1401
-5
No files matched your search
@@ -0,0 +1,39 @@
|
||||
---
|
||||
remnawave_dir: /opt/remnawave
|
||||
remnawave_subscription_dir: "{{ remnawave_dir }}/subscription"
|
||||
|
||||
remnawave_panel_domain: "rw.gunihome.ru"
|
||||
remnawave_sub_domain: "sub.gunihome.ru"
|
||||
remnawave_panel_url: "https://{{ remnawave_panel_domain }}"
|
||||
|
||||
remnawave_backend_image: "remnawave/backend:3"
|
||||
remnawave_subscription_image: "remnawave/subscription-page:latest"
|
||||
remnawave_postgres_image: "postgres:18.4"
|
||||
remnawave_redis_image: "valkey/valkey:9-alpine"
|
||||
|
||||
remnawave_app_port: 3000
|
||||
remnawave_metrics_port: 3001
|
||||
remnawave_subscription_port: 3010
|
||||
|
||||
remnawave_admin_username: "{{ lookup('env', 'ADMIN_USER', default='karpenok') }}"
|
||||
remnawave_admin_password: "{{ lookup('env', 'ADMIN_PASSWORD', default='') }}"
|
||||
|
||||
remnawave_app_secret: "{{ lookup('env', 'REMNAWAVE_APP_SECRET', default='') }}"
|
||||
remnawave_postgres_password: "{{ lookup('env', 'REMNAWAVE_POSTGRES_PASSWORD', default='') }}"
|
||||
remnawave_metrics_pass: "{{ lookup('env', 'REMNAWAVE_METRICS_PASS', default='') }}"
|
||||
remnawave_webhook_secret: "{{ lookup('env', 'REMNAWAVE_WEBHOOK_SECRET_HEADER', default='') }}"
|
||||
remnawave_api_token: "{{ lookup('env', 'REMNAWAVE_API_TOKEN', default='') }}"
|
||||
|
||||
# Нода Ger-nod-02 / SelfSteal — создаётся через API панели
|
||||
remnawave_node_name: "Ger-nod-02"
|
||||
remnawave_node_address: "150.241.64.209"
|
||||
remnawave_node_port: 2222
|
||||
remnawave_node_country: "DE"
|
||||
remnawave_selfsteal_domain: "yali.gunis.top"
|
||||
remnawave_xhttp_path: "/xhttp-yali"
|
||||
remnawave_profile_name: "DE-Yali"
|
||||
remnawave_inbound_tag: "Steal-Yali"
|
||||
remnawave_host_remark: "🇩🇪 Yali"
|
||||
remnawave_api_token_name: "infra-automation"
|
||||
|
||||
remnawave_panel_egress_ip: "213.128.28.107"
|
||||
@@ -0,0 +1,161 @@
|
||||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"dns": {
|
||||
"servers": [
|
||||
{
|
||||
"address": "https://dns.google/dns-query",
|
||||
"skipFallback": false
|
||||
}
|
||||
],
|
||||
"queryStrategy": "UseIPv4"
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"tag": "Steal-Yali",
|
||||
"port": 443,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [],
|
||||
"decryption": "none"
|
||||
},
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": ["http", "tls", "quic"]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "xhttp",
|
||||
"security": "reality",
|
||||
"xhttpSettings": {
|
||||
"host": "yali.gunis.top",
|
||||
"mode": "stream-one",
|
||||
"path": "/xhttp-yali"
|
||||
},
|
||||
"realitySettings": {
|
||||
"dest": "/dev/shm/nginx.sock",
|
||||
"show": false,
|
||||
"xver": 1,
|
||||
"spiderX": "",
|
||||
"shortIds": ["__REALITY_SHORT_ID__"],
|
||||
"privateKey": "__REALITY_PRIVATE_KEY__",
|
||||
"serverNames": ["yali.gunis.top"]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"tag": "DIRECT",
|
||||
"protocol": "freedom"
|
||||
},
|
||||
{
|
||||
"tag": "BLOCK",
|
||||
"protocol": "blackhole"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"regexp:^([a-z0-9-]+\\.)*2ip\\.[a-z0-9.-]+$",
|
||||
"domain:ifconfig.me",
|
||||
"domain:www.ifconfig.me",
|
||||
"domain:ifconfig.co",
|
||||
"domain:www.ifconfig.co",
|
||||
"domain:ifconfig.io",
|
||||
"domain:www.ifconfig.io",
|
||||
"domain:ifconfig.so",
|
||||
"domain:checkip.amazonaws.com",
|
||||
"domain:api.ipify.org",
|
||||
"domain:ipify.org",
|
||||
"domain:ip.sb",
|
||||
"domain:www.ip.sb",
|
||||
"domain:api-ipv4.ip.sb",
|
||||
"domain:api.ipv6.ip.sb",
|
||||
"domain:ip-api.com",
|
||||
"domain:api.ipapi.is",
|
||||
"domain:ipapi.co",
|
||||
"domain:ipapi.com",
|
||||
"domain:iplocation.net",
|
||||
"domain:iplocation.io",
|
||||
"domain:iplocation.com",
|
||||
"domain:ipwho.is",
|
||||
"domain:ipwhois.io",
|
||||
"domain:ipinfo.io",
|
||||
"domain:www.ipinfo.io",
|
||||
"domain:ident.me",
|
||||
"domain:myip.com",
|
||||
"domain:whatismyipaddress.com",
|
||||
"domain:wtfismyip.com",
|
||||
"domain:whatismyip.com",
|
||||
"domain:showmyip.com",
|
||||
"domain:icanhazip.com",
|
||||
"domain:geojs.io",
|
||||
"domain:ipleak.net",
|
||||
"domain:ipleak.org",
|
||||
"domain:browserleaks.com",
|
||||
"domain:dnsleaktest.com",
|
||||
"domain:dnscheck.tools",
|
||||
"domain:whoer.net",
|
||||
"domain:hidemy.name",
|
||||
"domain:sypexgeo.net",
|
||||
"domain:api.sypexgeo.net",
|
||||
"domain:mail.ru",
|
||||
"domain:ip.mail.ru",
|
||||
"full:ipv4-internet.yandex.net",
|
||||
"full:ipv6-internet.yandex.net",
|
||||
"full:www.cloudflare.com/cdn-cgi/trace"
|
||||
],
|
||||
"outboundTag": "BLOCK"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"domain:habr.com",
|
||||
"domain:4pda.to",
|
||||
"domain:4pda.ru",
|
||||
"domain:kemono.su",
|
||||
"domain:jut.su",
|
||||
"domain:kara.su",
|
||||
"domain:theins.ru",
|
||||
"domain:tvrain.ru",
|
||||
"domain:echo.msk.ru",
|
||||
"domain:the-village.ru",
|
||||
"domain:snob.ru",
|
||||
"domain:novayagazeta.ru",
|
||||
"domain:moscowtimes.ru",
|
||||
"domain:allnorilsk.ru"
|
||||
],
|
||||
"outboundTag": "DIRECT"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:ru"],
|
||||
"outboundTag": "BLOCK"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"domain": ["geosite:category-ru"],
|
||||
"outboundTag": "BLOCK"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "BLOCK"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"protocol": ["bittorrent"],
|
||||
"outboundTag": "BLOCK"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"network": "tcp,udp",
|
||||
"outboundTag": "DIRECT"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
---
|
||||
- name: Проверить наличие Infisical CLI-контекста для записи секретов
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- lookup('env', 'INFISICAL_TOKEN') | length > 0
|
||||
- lookup('env', 'INFISICAL_DOMAIN') | length > 0
|
||||
- lookup('env', 'INFISICAL_PROJECT_ID') | length > 0
|
||||
fail_msg: "Для роли remnawave нужны INFISICAL_TOKEN / INFISICAL_DOMAIN / INFISICAL_PROJECT_ID (деплой через deploy-machine.sh)."
|
||||
|
||||
- name: Проверить пароль администратора панели
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- remnawave_admin_username | length > 0
|
||||
- remnawave_admin_password | length >= 8
|
||||
fail_msg: "Нужны ADMIN_USER / ADMIN_PASSWORD из /USER/ADMIN (пароль ≥ 8)."
|
||||
|
||||
- name: Запомнить, какие секреты панели нужно сгенерировать
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_need_app_secret: "{{ remnawave_app_secret | length == 0 }}"
|
||||
remnawave_need_postgres_password: "{{ remnawave_postgres_password | length == 0 }}"
|
||||
remnawave_need_metrics_pass: "{{ remnawave_metrics_pass | length == 0 }}"
|
||||
remnawave_need_webhook_secret: "{{ remnawave_webhook_secret | length == 0 }}"
|
||||
|
||||
- name: Сгенерировать отсутствующие секреты панели
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_app_secret: "{{ remnawave_app_secret if not remnawave_need_app_secret else lookup('password', '/dev/null length=64 chars=hexdigits') }}"
|
||||
remnawave_postgres_password: "{{ remnawave_postgres_password if not remnawave_need_postgres_password else lookup('password', '/dev/null length=48 chars=hexdigits') }}"
|
||||
remnawave_metrics_pass: "{{ remnawave_metrics_pass if not remnawave_need_metrics_pass else lookup('password', '/dev/null length=64 chars=hexdigits') }}"
|
||||
remnawave_webhook_secret: "{{ remnawave_webhook_secret if not remnawave_need_webhook_secret else lookup('password', '/dev/null length=64 chars=ascii_letters,digits') }}"
|
||||
no_log: true
|
||||
|
||||
- name: Создать каталоги Remnawave
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ remnawave_dir }}"
|
||||
- "{{ remnawave_subscription_dir }}"
|
||||
|
||||
- name: Поставить curl, jq и openssl
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- curl
|
||||
- jq
|
||||
- openssl
|
||||
state: present
|
||||
|
||||
- name: Записать .env панели
|
||||
ansible.builtin.template:
|
||||
src: env.j2
|
||||
dest: "{{ remnawave_dir }}/.env"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
|
||||
- name: Сохранить сгенерированные секреты панели в Infisical
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
infisical secrets set \
|
||||
--domain="${INFISICAL_DOMAIN}" \
|
||||
--token="${INFISICAL_TOKEN}" \
|
||||
--env=prod \
|
||||
--projectId="${INFISICAL_PROJECT_ID}" \
|
||||
--path="/services/remnawave" \
|
||||
"REMNAWAVE_APP_SECRET=${RW_APP_SECRET}" \
|
||||
"REMNAWAVE_POSTGRES_PASSWORD=${RW_PG_PASS}" \
|
||||
"REMNAWAVE_METRICS_PASS=${RW_METRICS_PASS}" \
|
||||
"REMNAWAVE_WEBHOOK_SECRET_HEADER=${RW_WEBHOOK}" \
|
||||
--silent
|
||||
args:
|
||||
executable: /bin/bash
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
environment:
|
||||
RW_APP_SECRET: "{{ remnawave_app_secret }}"
|
||||
RW_PG_PASS: "{{ remnawave_postgres_password }}"
|
||||
RW_METRICS_PASS: "{{ remnawave_metrics_pass }}"
|
||||
RW_WEBHOOK: "{{ remnawave_webhook_secret }}"
|
||||
when: >-
|
||||
remnawave_need_app_secret or remnawave_need_postgres_password
|
||||
or remnawave_need_metrics_pass or remnawave_need_webhook_secret
|
||||
changed_when: true
|
||||
no_log: true
|
||||
|
||||
- name: Записать compose панели
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ remnawave_dir }}/compose.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Положить шаблон config profile DE-Yali
|
||||
ansible.builtin.copy:
|
||||
src: profile-de-yali.json
|
||||
dest: "{{ remnawave_dir }}/profile-de-yali.json"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Запустить панель Remnawave
|
||||
ansible.builtin.command: docker compose -f {{ remnawave_dir }}/compose.yaml up -d --remove-orphans
|
||||
register: remnawave_compose_up
|
||||
changed_when: >-
|
||||
'Started' in remnawave_compose_up.stderr or
|
||||
'Created' in remnawave_compose_up.stderr or
|
||||
'Recreated' in remnawave_compose_up.stderr or
|
||||
'Pulled' in remnawave_compose_up.stderr
|
||||
|
||||
- name: Дождаться health панели
|
||||
ansible.builtin.uri:
|
||||
url: "http://127.0.0.1:{{ remnawave_metrics_port }}/health"
|
||||
status_code: 200
|
||||
register: remnawave_health
|
||||
retries: 40
|
||||
delay: 3
|
||||
until: remnawave_health.status == 200
|
||||
|
||||
- name: Дождаться HTTPS панели через Traefik
|
||||
ansible.builtin.command: >
|
||||
curl -fsSk --resolve {{ remnawave_panel_domain }}:443:127.0.0.1
|
||||
https://{{ remnawave_panel_domain }}/api/auth/status
|
||||
register: remnawave_auth_status
|
||||
changed_when: false
|
||||
retries: 30
|
||||
delay: 5
|
||||
until: remnawave_auth_status.rc == 0
|
||||
|
||||
- name: Инициализировать админа, API-токен, профиль DE-Yali, ноду и хост
|
||||
ansible.builtin.shell: "{{ lookup('template', 'bootstrap-panel.sh.j2') }}"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
environment:
|
||||
RW_ADMIN_USER: "{{ remnawave_admin_username }}"
|
||||
RW_ADMIN_PASS: "{{ remnawave_admin_password }}"
|
||||
RW_API_TOKEN: "{{ remnawave_api_token }}"
|
||||
RW_NODE_SECRET: "{{ lookup('env', 'REMNANODE_SECRET_KEY', default='') }}"
|
||||
RW_TOKEN_NAME: "{{ remnawave_api_token_name }}"
|
||||
RW_PROFILE_NAME: "{{ remnawave_profile_name }}"
|
||||
RW_INBOUND_TAG: "{{ remnawave_inbound_tag }}"
|
||||
RW_NODE_NAME: "{{ remnawave_node_name }}"
|
||||
RW_NODE_ADDR: "{{ remnawave_node_address }}"
|
||||
RW_NODE_PORT: "{{ remnawave_node_port }}"
|
||||
RW_NODE_CC: "{{ remnawave_node_country }}"
|
||||
RW_SELFSTEAL: "{{ remnawave_selfsteal_domain }}"
|
||||
RW_XHTTP_PATH: "{{ remnawave_xhttp_path }}"
|
||||
RW_HOST_REMARK: "{{ remnawave_host_remark }}"
|
||||
RW_PROFILE_FILE: "{{ remnawave_dir }}/profile-de-yali.json"
|
||||
RW_PANEL_DOMAIN: "{{ remnawave_panel_domain }}"
|
||||
register: remnawave_bootstrap_raw
|
||||
changed_when: (remnawave_bootstrap_raw.stdout | from_json).changed | default(false)
|
||||
no_log: true
|
||||
|
||||
- name: Разобрать результат bootstrap
|
||||
ansible.builtin.set_fact:
|
||||
remnawave_bootstrap: "{{ remnawave_bootstrap_raw.stdout | from_json }}"
|
||||
remnawave_api_token: "{{ (remnawave_bootstrap_raw.stdout | from_json).api_token }}"
|
||||
no_log: true
|
||||
|
||||
- name: Проверить, что SECRET_KEY ноды получен
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- (remnawave_bootstrap.node_secret | default('') | length > 0) or (lookup('env', 'REMNANODE_SECRET_KEY', default='') | length > 0)
|
||||
fail_msg: "Панель не вернула SECRET_KEY ноды Ger-nod-02. Проверьте ответ POST /api/nodes/ (версия Remnawave) и повторите прогон."
|
||||
|
||||
- name: Сохранить API-токен и SECRET_KEY ноды в Infisical
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
args=("REMNAWAVE_API_TOKEN=${RW_API_TOKEN}")
|
||||
if [ -n "${RW_NODE_SECRET}" ]; then
|
||||
args+=("REMNANODE_SECRET_KEY=${RW_NODE_SECRET}")
|
||||
fi
|
||||
infisical secrets set \
|
||||
--domain="${INFISICAL_DOMAIN}" \
|
||||
--token="${INFISICAL_TOKEN}" \
|
||||
--env=prod \
|
||||
--projectId="${INFISICAL_PROJECT_ID}" \
|
||||
--path="/services/remnawave" \
|
||||
"${args[@]}" \
|
||||
--silent
|
||||
args:
|
||||
executable: /bin/bash
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
environment:
|
||||
RW_API_TOKEN: "{{ remnawave_api_token }}"
|
||||
RW_NODE_SECRET: "{{ remnawave_bootstrap.node_secret | default('') }}"
|
||||
when: >-
|
||||
remnawave_bootstrap.token_updated | default(false)
|
||||
or (remnawave_bootstrap.node_secret | default('') | length > 0 and remnawave_bootstrap.node_created | default(false))
|
||||
changed_when: true
|
||||
no_log: true
|
||||
|
||||
- name: Записать .env subscription-page
|
||||
ansible.builtin.template:
|
||||
src: subscription.env.j2
|
||||
dest: "{{ remnawave_subscription_dir }}/.env"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
|
||||
- name: Записать compose subscription-page
|
||||
ansible.builtin.template:
|
||||
src: subscription-compose.yaml.j2
|
||||
dest: "{{ remnawave_subscription_dir }}/compose.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Запустить subscription-page
|
||||
ansible.builtin.command: docker compose -f {{ remnawave_subscription_dir }}/compose.yaml up -d --remove-orphans
|
||||
register: remnawave_sub_up
|
||||
changed_when: >-
|
||||
'Started' in remnawave_sub_up.stderr or
|
||||
'Created' in remnawave_sub_up.stderr or
|
||||
'Recreated' in remnawave_sub_up.stderr or
|
||||
'Pulled' in remnawave_sub_up.stderr
|
||||
|
||||
- name: Дождаться subscription-page
|
||||
ansible.builtin.uri:
|
||||
url: "http://127.0.0.1:{{ remnawave_subscription_port }}/"
|
||||
status_code: [200, 404]
|
||||
register: remnawave_sub_health
|
||||
retries: 20
|
||||
delay: 2
|
||||
until: remnawave_sub_health.status in [200, 404]
|
||||
|
||||
- name: Итог Remnawave panel
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "Панель: https://{{ remnawave_panel_domain }}"
|
||||
- "Подписка: https://{{ remnawave_sub_domain }}"
|
||||
- "Админ создан в этом прогоне: {{ remnawave_bootstrap.admin_created | default(false) }}"
|
||||
- "API-токен обновлён в Infisical: {{ remnawave_bootstrap.token_updated | default(false) }}"
|
||||
- "Профиль {{ remnawave_profile_name }}: {{ remnawave_bootstrap.profile_uuid | default('n/a') }}"
|
||||
- "Нода {{ remnawave_node_name }}: {{ remnawave_bootstrap.node_uuid | default('n/a') }}"
|
||||
- "Host {{ remnawave_selfsteal_domain }}: {{ remnawave_bootstrap.host_uuid | default('n/a') }}"
|
||||
@@ -0,0 +1,279 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
API_BASE="https://${RW_PANEL_DOMAIN}/api"
|
||||
CURL=(curl -fsSk --resolve "${RW_PANEL_DOMAIN}:443:127.0.0.1")
|
||||
AUTH_HDR=()
|
||||
|
||||
admin_created=0
|
||||
token_updated=0
|
||||
profile_created=0
|
||||
node_created=0
|
||||
host_created=0
|
||||
node_secret=""
|
||||
active_token="${RW_API_TOKEN:-}"
|
||||
|
||||
api() {
|
||||
local method="$1"; shift
|
||||
local path="$1"; shift
|
||||
if [ "${#AUTH_HDR[@]}" -gt 0 ]; then
|
||||
"${CURL[@]}" -X "$method" "${AUTH_HDR[@]}" -H "Content-Type: application/json" "${API_BASE}${path}" "$@"
|
||||
else
|
||||
"${CURL[@]}" -X "$method" -H "Content-Type: application/json" "${API_BASE}${path}" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
json_first() {
|
||||
jq -r "$1" 2>/dev/null || true
|
||||
}
|
||||
|
||||
status_json=$("${CURL[@]}" "${API_BASE}/auth/status")
|
||||
is_login=$(printf '%s' "${status_json}" | jq -r '.response.isLoginAllowed // .isLoginAllowed // false')
|
||||
is_register=$(printf '%s' "${status_json}" | jq -r '.response.isRegisterAllowed // .isRegisterAllowed // false')
|
||||
|
||||
if [ "${is_register}" = "true" ]; then
|
||||
reg_payload=$(jq -n --arg u "$RW_ADMIN_USER" --arg p "$RW_ADMIN_PASS" '{username: $u, password: $p}')
|
||||
api POST /auth/register -d "${reg_payload}" >/dev/null
|
||||
admin_created=1
|
||||
is_login=true
|
||||
fi
|
||||
|
||||
login_ok=0
|
||||
if [ -n "${active_token}" ]; then
|
||||
code=$("${CURL[@]}" -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: Bearer ${active_token}" "${API_BASE}/nodes/" || true)
|
||||
if [ "${code}" = "200" ]; then
|
||||
login_ok=1
|
||||
AUTH_HDR=(-H "Authorization: Bearer ${active_token}")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${login_ok}" -eq 0 ]; then
|
||||
login_payload=$(jq -n --arg u "$RW_ADMIN_USER" --arg p "$RW_ADMIN_PASS" '{username: $u, password: $p}')
|
||||
login_resp=$(api POST /auth/login -d "${login_payload}")
|
||||
access=$(printf '%s' "${login_resp}" | jq -r '.response.accessToken // .accessToken // empty')
|
||||
if [ -z "${access}" ]; then
|
||||
echo "Не удалось войти в панель Remnawave" >&2
|
||||
printf '%s\n' "${login_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
AUTH_HDR=(-H "Authorization: Bearer ${access}")
|
||||
|
||||
tokens_json=$(api GET /tokens/ || echo '{"response":[]}')
|
||||
old_uuid=$(printf '%s' "${tokens_json}" | jq -r --arg n "$RW_TOKEN_NAME" '
|
||||
(.response // .)
|
||||
| if type=="array" then . elif .tokens then .tokens else [] end
|
||||
| map(select(.tokenName == $n or .name == $n))
|
||||
| .[0].uuid // empty')
|
||||
if [ -n "${old_uuid}" ]; then
|
||||
api DELETE "/tokens/${old_uuid}" >/dev/null || true
|
||||
fi
|
||||
|
||||
token_payload=$(jq -n --arg n "$RW_TOKEN_NAME" '{tokenName: $n}')
|
||||
token_resp=$(api POST /tokens/ -d "${token_payload}")
|
||||
active_token=$(printf '%s' "${token_resp}" | jq -r '
|
||||
.response.token // .response.apiToken // .token // .apiToken // empty')
|
||||
if [ -z "${active_token}" ]; then
|
||||
echo "Не удалось создать API-токен" >&2
|
||||
printf '%s\n' "${token_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
AUTH_HDR=(-H "Authorization: Bearer ${active_token}")
|
||||
token_updated=1
|
||||
fi
|
||||
|
||||
profiles_json=$(api GET /config-profiles/)
|
||||
profile_uuid=$(printf '%s' "${profiles_json}" | jq -r --arg n "$RW_PROFILE_NAME" '
|
||||
(.response.configProfiles // .response // [])
|
||||
| map(select(.name == $n)) | .[0].uuid // empty')
|
||||
pub=""
|
||||
|
||||
if [ -z "${profile_uuid}" ]; then
|
||||
key_resp=$(api GET /system/tools/x25519/generate 2>/dev/null || api GET /keygen/ 2>/dev/null || echo '{}')
|
||||
priv=$(printf '%s' "${key_resp}" | jq -r '
|
||||
.response.privateKey // .response.privKey // .privateKey // .privKey // empty')
|
||||
pub=$(printf '%s' "${key_resp}" | jq -r '
|
||||
.response.publicKey // .response.pubKey // .publicKey // .pubKey // empty')
|
||||
if [ -z "${priv}" ]; then
|
||||
echo "Не удалось сгенерировать X25519 ключи Reality" >&2
|
||||
printf '%s\n' "${key_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
short_id=$(openssl rand -hex 8)
|
||||
profile_config=$(sed \
|
||||
-e "s|__REALITY_PRIVATE_KEY__|${priv}|g" \
|
||||
-e "s|__REALITY_SHORT_ID__|${short_id}|g" \
|
||||
"$RW_PROFILE_FILE")
|
||||
create_profile=$(jq -n --arg n "$RW_PROFILE_NAME" --argjson c "${profile_config}" '{name: $n, config: $c}')
|
||||
profile_resp=$(api POST /config-profiles/ -d "${create_profile}")
|
||||
profile_uuid=$(printf '%s' "${profile_resp}" | jq -r '.response.uuid // .uuid // empty')
|
||||
if [ -z "${profile_uuid}" ]; then
|
||||
echo "Не удалось создать config profile" >&2
|
||||
printf '%s\n' "${profile_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
profile_created=1
|
||||
fi
|
||||
|
||||
profile_full=$(api GET "/config-profiles/${profile_uuid}")
|
||||
inbound_uuid=$(printf '%s' "${profile_full}" | jq -r --arg t "$RW_INBOUND_TAG" '
|
||||
(.response.inbounds // .inbounds // [])
|
||||
| map(select(.tag == $t)) | .[0].uuid // empty')
|
||||
if [ -z "${inbound_uuid}" ]; then
|
||||
inbounds_json=$(api GET "/config-profiles/${profile_uuid}/inbounds" 2>/dev/null || echo '{}')
|
||||
inbound_uuid=$(printf '%s' "${inbounds_json}" | jq -r --arg t "$RW_INBOUND_TAG" '
|
||||
(.response // .)
|
||||
| if type=="array" then . else (.inbounds // []) end
|
||||
| map(select(.tag == $t)) | .[0].uuid // empty')
|
||||
fi
|
||||
if [ -z "${inbound_uuid}" ]; then
|
||||
echo "Не найден inbound ${RW_INBOUND_TAG} в профиле ${profile_uuid}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
nodes_json=$(api GET /nodes/)
|
||||
node_uuid=$(printf '%s' "${nodes_json}" | jq -r --arg n "$RW_NODE_NAME" '
|
||||
(.response // []) | map(select(.name == $n)) | .[0].uuid // empty')
|
||||
node_secret="${RW_NODE_SECRET:-}"
|
||||
|
||||
if [ -z "${node_uuid}" ]; then
|
||||
node_payload=$(jq -n \
|
||||
--arg name "$RW_NODE_NAME" \
|
||||
--arg addr "$RW_NODE_ADDR" \
|
||||
--argjson port "$RW_NODE_PORT" \
|
||||
--arg cc "$RW_NODE_CC" \
|
||||
--arg pu "$profile_uuid" \
|
||||
--arg iu "$inbound_uuid" \
|
||||
'{
|
||||
name: $name,
|
||||
address: $addr,
|
||||
port: $port,
|
||||
countryCode: $cc,
|
||||
configProfile: {
|
||||
activeConfigProfileUuid: $pu,
|
||||
activeInbounds: [$iu]
|
||||
}
|
||||
}')
|
||||
node_resp=$(api POST /nodes/ -d "${node_payload}" 2>/dev/null || true)
|
||||
node_uuid=$(printf '%s' "${node_resp}" | jq -r '.response.uuid // .uuid // empty')
|
||||
node_secret=$(printf '%s' "${node_resp}" | jq -r '
|
||||
.response.secretKey // .response.SECRET_KEY // .secretKey // .SECRET_KEY // empty')
|
||||
|
||||
if [ -z "${node_uuid}" ]; then
|
||||
node_payload=$(jq -n \
|
||||
--arg name "$RW_NODE_NAME" \
|
||||
--arg addr "$RW_NODE_ADDR" \
|
||||
--argjson port "$RW_NODE_PORT" \
|
||||
--arg cc "$RW_NODE_CC" \
|
||||
'{name: $name, address: $addr, port: $port, countryCode: $cc}')
|
||||
node_resp=$(api POST /nodes/ -d "${node_payload}")
|
||||
node_uuid=$(printf '%s' "${node_resp}" | jq -r '.response.uuid // .uuid // empty')
|
||||
node_secret=$(printf '%s' "${node_resp}" | jq -r '
|
||||
.response.secretKey // .response.SECRET_KEY // .secretKey // .SECRET_KEY // empty')
|
||||
fi
|
||||
|
||||
if [ -z "${node_uuid}" ]; then
|
||||
echo "Не удалось создать ноду" >&2
|
||||
printf '%s\n' "${node_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
node_created=1
|
||||
fi
|
||||
|
||||
node_update=$(jq -n \
|
||||
--arg u "$node_uuid" \
|
||||
--arg pu "$profile_uuid" \
|
||||
--arg iu "$inbound_uuid" \
|
||||
'{
|
||||
uuid: $u,
|
||||
configProfile: {
|
||||
activeConfigProfileUuid: $pu,
|
||||
activeInbounds: [$iu]
|
||||
}
|
||||
}')
|
||||
api PATCH /nodes/ -d "${node_update}" >/dev/null 2>&1 \
|
||||
|| api PUT /nodes/ -d "${node_update}" >/dev/null 2>&1 \
|
||||
|| true
|
||||
|
||||
if [ -z "${node_secret}" ] && [ "${node_created}" -eq 1 ]; then
|
||||
node_full=$(api GET "/nodes/${node_uuid}")
|
||||
node_secret=$(printf '%s' "${node_full}" | jq -r '
|
||||
.response.secretKey // .response.SECRET_KEY // .secretKey // empty')
|
||||
fi
|
||||
|
||||
hosts_json=$(api GET /hosts/)
|
||||
host_uuid=$(printf '%s' "${hosts_json}" | jq -r --arg a "$RW_SELFSTEAL" '
|
||||
(.response // []) | map(select(.address == $a)) | .[0].uuid // empty')
|
||||
|
||||
if [ -z "${host_uuid}" ]; then
|
||||
host_payload=$(jq -n \
|
||||
--arg remark "$RW_HOST_REMARK" \
|
||||
--arg addr "$RW_SELFSTEAL" \
|
||||
--arg path "$RW_XHTTP_PATH" \
|
||||
--arg sni "$RW_SELFSTEAL" \
|
||||
--arg host "$RW_SELFSTEAL" \
|
||||
--arg pu "$profile_uuid" \
|
||||
--arg iu "$inbound_uuid" \
|
||||
--arg nu "$node_uuid" \
|
||||
'{
|
||||
remark: $remark,
|
||||
address: $addr,
|
||||
port: 443,
|
||||
path: $path,
|
||||
sni: $sni,
|
||||
host: $host,
|
||||
fingerprint: "chrome",
|
||||
isDisabled: false,
|
||||
securityLayer: "DEFAULT",
|
||||
alpn: "h2",
|
||||
xHttpExtraParams: {
|
||||
xmux: {
|
||||
maxConcurrency: "16-32",
|
||||
hMaxRequestTimes: "600-900",
|
||||
hMaxReusableSecs: "1800-3000"
|
||||
},
|
||||
noSSEHeader: true,
|
||||
xPaddingBytes: "100-1000"
|
||||
},
|
||||
inbound: {
|
||||
configProfileUuid: $pu,
|
||||
configProfileInboundUuid: $iu
|
||||
},
|
||||
nodes: [$nu]
|
||||
}')
|
||||
host_resp=$(api POST /hosts/ -d "${host_payload}")
|
||||
host_uuid=$(printf '%s' "${host_resp}" | jq -r '.response.uuid // .uuid // empty')
|
||||
if [ -z "${host_uuid}" ]; then
|
||||
echo "Не удалось создать host" >&2
|
||||
printf '%s\n' "${host_resp}" >&2
|
||||
exit 1
|
||||
fi
|
||||
host_created=1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg api_token "${active_token}" \
|
||||
--arg node_secret "${node_secret}" \
|
||||
--arg profile_uuid "${profile_uuid}" \
|
||||
--arg node_uuid "${node_uuid}" \
|
||||
--arg host_uuid "${host_uuid}" \
|
||||
--arg reality_pub "${pub}" \
|
||||
--argjson admin_created "${admin_created}" \
|
||||
--argjson token_updated "${token_updated}" \
|
||||
--argjson profile_created "${profile_created}" \
|
||||
--argjson node_created "${node_created}" \
|
||||
--argjson host_created "${host_created}" \
|
||||
'{
|
||||
api_token: $api_token,
|
||||
node_secret: $node_secret,
|
||||
profile_uuid: $profile_uuid,
|
||||
node_uuid: $node_uuid,
|
||||
host_uuid: $host_uuid,
|
||||
reality_public_key: $reality_pub,
|
||||
admin_created: ($admin_created == 1),
|
||||
token_updated: ($token_updated == 1),
|
||||
profile_created: ($profile_created == 1),
|
||||
node_created: ($node_created == 1),
|
||||
host_created: ($host_created == 1),
|
||||
changed: (($admin_created + $token_updated + $profile_created + $node_created + $host_created) > 0)
|
||||
}'
|
||||
@@ -0,0 +1,100 @@
|
||||
x-common: &common
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1048576
|
||||
hard: 1048576
|
||||
restart: always
|
||||
networks:
|
||||
- remnawave-network
|
||||
|
||||
x-logging: &logging
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: 5
|
||||
|
||||
x-env: &env
|
||||
env_file: .env
|
||||
|
||||
services:
|
||||
remnawave:
|
||||
image: {{ remnawave_backend_image }}
|
||||
container_name: remnawave
|
||||
hostname: remnawave
|
||||
<<: [*common, *logging, *env]
|
||||
volumes:
|
||||
- valkey-socket:/var/run/valkey
|
||||
ports:
|
||||
- "127.0.0.1:{{ remnawave_app_port }}:{{ remnawave_app_port }}"
|
||||
- "127.0.0.1:{{ remnawave_metrics_port }}:{{ remnawave_metrics_port }}"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:{{ remnawave_metrics_port }}/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
depends_on:
|
||||
remnawave-db:
|
||||
condition: service_healthy
|
||||
remnawave-redis:
|
||||
condition: service_healthy
|
||||
|
||||
remnawave-db:
|
||||
image: {{ remnawave_postgres_image }}
|
||||
container_name: remnawave-db
|
||||
hostname: remnawave-db
|
||||
shm_size: 512mb
|
||||
<<: [*common, *logging, *env]
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- TZ=UTC
|
||||
ports:
|
||||
- "127.0.0.1:6767:5432"
|
||||
volumes:
|
||||
- remnawave-db-data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 3s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
remnawave-redis:
|
||||
image: {{ remnawave_redis_image }}
|
||||
container_name: remnawave-redis
|
||||
hostname: remnawave-redis
|
||||
<<: [*common, *logging]
|
||||
volumes:
|
||||
- valkey-socket:/var/run/valkey
|
||||
command: >
|
||||
valkey-server
|
||||
--save ""
|
||||
--appendonly no
|
||||
--maxmemory-policy noeviction
|
||||
--loglevel warning
|
||||
--unixsocket /var/run/valkey/valkey.sock
|
||||
--unixsocketperm 777
|
||||
--port 0
|
||||
healthcheck:
|
||||
test: ["CMD", "valkey-cli", "-s", "/var/run/valkey/valkey.sock", "ping"]
|
||||
interval: 3s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
|
||||
networks:
|
||||
remnawave-network:
|
||||
name: remnawave-network
|
||||
driver: bridge
|
||||
external: false
|
||||
|
||||
volumes:
|
||||
remnawave-db-data:
|
||||
name: remnawave-db-data
|
||||
driver: local
|
||||
external: false
|
||||
valkey-socket:
|
||||
name: valkey-socket
|
||||
driver: local
|
||||
external: false
|
||||
@@ -0,0 +1,59 @@
|
||||
### APP ###
|
||||
APP_PORT={{ remnawave_app_port }}
|
||||
METRICS_PORT={{ remnawave_metrics_port }}
|
||||
|
||||
### API ###
|
||||
API_INSTANCES=1
|
||||
|
||||
### DATABASE ###
|
||||
DATABASE_URL="postgresql://postgres:{{ remnawave_postgres_password }}@remnawave-db:5432/postgres"
|
||||
|
||||
### REDIS ###
|
||||
REDIS_SOCKET=/var/run/valkey/valkey.sock
|
||||
|
||||
### Secrets ###
|
||||
APP_SECRET={{ remnawave_app_secret }}
|
||||
|
||||
### TELEGRAM NOTIFICATIONS ###
|
||||
IS_TELEGRAM_NOTIFICATIONS_ENABLED=false
|
||||
TELEGRAM_BOT_TOKEN=change_me
|
||||
TELEGRAM_NOTIFY_USERS=change_me
|
||||
TELEGRAM_NOTIFY_NODES=change_me
|
||||
TELEGRAM_NOTIFY_CRM=change_me
|
||||
TELEGRAM_NOTIFY_SERVICE=change_me
|
||||
TELEGRAM_NOTIFY_TBLOCKER=change_me
|
||||
|
||||
### PANEL DOMAIN ###
|
||||
PANEL_DOMAIN={{ remnawave_panel_domain }}
|
||||
|
||||
### FRONT_END ###
|
||||
FRONT_END_DOMAIN={{ remnawave_panel_domain }}
|
||||
|
||||
### SUBSCRIPTION PUBLIC DOMAIN ###
|
||||
SUB_PUBLIC_DOMAIN={{ remnawave_sub_domain }}
|
||||
|
||||
### PROMETHEUS ###
|
||||
METRICS_USER=admin
|
||||
METRICS_PASS={{ remnawave_metrics_pass }}
|
||||
|
||||
### Webhook ###
|
||||
WEBHOOK_ENABLED=false
|
||||
WEBHOOK_URL=https://your-webhook-url.com/endpoint
|
||||
WEBHOOK_SECRET_HEADER={{ remnawave_webhook_secret }}
|
||||
|
||||
BANDWIDTH_USAGE_NOTIFICATIONS_ENABLED=false
|
||||
BANDWIDTH_USAGE_NOTIFICATIONS_THRESHOLD=[60, 80]
|
||||
NOT_CONNECTED_USERS_NOTIFICATIONS_ENABLED=false
|
||||
NOT_CONNECTED_USERS_NOTIFICATIONS_AFTER_HOURS=[6, 24, 48]
|
||||
EXPIRATION_NOTIFICATIONS_ENABLED=false
|
||||
EXPIRATION_NOTIFICATIONS=[-72, -48, -24, 24]
|
||||
EXPORT_TO_STREAM_ENABLED=false
|
||||
EXPORT_TO_STREAM_MAXLEN=3000
|
||||
SHORT_UUID_METHOD=nanoid
|
||||
SHORT_UUID_LENGTH=16
|
||||
SERVICE_SNI_VERIFICATION=true
|
||||
|
||||
### Database container ###
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD={{ remnawave_postgres_password }}
|
||||
POSTGRES_DB=postgres
|
||||
@@ -0,0 +1,23 @@
|
||||
services:
|
||||
remnawave-subscription-page:
|
||||
image: {{ remnawave_subscription_image }}
|
||||
container_name: remnawave-subscription-page
|
||||
hostname: remnawave-subscription-page
|
||||
restart: always
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "127.0.0.1:{{ remnawave_subscription_port }}:{{ remnawave_subscription_port }}"
|
||||
networks:
|
||||
- remnawave-network
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 30m
|
||||
max-file: 5
|
||||
|
||||
networks:
|
||||
remnawave-network:
|
||||
name: remnawave-network
|
||||
driver: bridge
|
||||
external: true
|
||||
@@ -0,0 +1,5 @@
|
||||
APP_PORT={{ remnawave_subscription_port }}
|
||||
REMNAWAVE_PANEL_URL=http://remnawave:{{ remnawave_app_port }}
|
||||
REMNAWAVE_API_TOKEN={{ remnawave_api_token }}
|
||||
CUSTOM_SUB_PREFIX=
|
||||
TRUST_PROXY=1
|
||||
@@ -0,0 +1,29 @@
|
||||
# Новая панель Remnawave на core-net. Старый remna.gunihome.ru не трогаем.
|
||||
http:
|
||||
routers:
|
||||
remnawave-panel:
|
||||
rule: "Host(`rw.gunihome.ru`)"
|
||||
entryPoints:
|
||||
- websecure
|
||||
service: remnawave-panel
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
|
||||
remnawave-sub:
|
||||
rule: "Host(`sub.gunihome.ru`)"
|
||||
entryPoints:
|
||||
- websecure
|
||||
service: remnawave-sub
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
|
||||
services:
|
||||
remnawave-panel:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://127.0.0.1:3000"
|
||||
|
||||
remnawave-sub:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://127.0.0.1:3010"
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
remnanode_dir: /opt/remnanode
|
||||
remnanode_image: "remnawave/node:latest"
|
||||
remnanode_nginx_image: "nginx:1.28"
|
||||
remnanode_node_port: 2222
|
||||
|
||||
remnanode_selfsteal_domain: "yali.gunis.top"
|
||||
remnanode_xhttp_path: "/xhttp-yali"
|
||||
remnanode_secret_key: "{{ lookup('env', 'REMNANODE_SECRET_KEY', default='') }}"
|
||||
|
||||
remnanode_panel_egress_ip: "213.128.28.107"
|
||||
remnanode_cloudflare_api: "{{ lookup('env', 'CLOUDFLARE_API', default='') }}"
|
||||
remnanode_cloudflare_zone: "gunis.top"
|
||||
remnanode_letsencrypt_email: "{{ lookup('env', 'MAIL_ADMIN_USER', default=letsencrypt_email) }}"
|
||||
|
||||
remnanode_www_dir: /var/www/html
|
||||
remnanode_cert_dir: "/etc/letsencrypt/live/{{ remnanode_selfsteal_domain }}"
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Yali Studio</title>
|
||||
<style>
|
||||
:root { color-scheme: light; --bg:#f4f7fb; --ink:#152033; --muted:#5b6b7c; --accent:#2f6fed; }
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0; min-height: 100vh; font-family: "Segoe UI", system-ui, sans-serif;
|
||||
background: radial-gradient(circle at top left, #dbe7ff, var(--bg) 45%);
|
||||
color: var(--ink); display: grid; place-items: center; padding: 2rem;
|
||||
}
|
||||
main {
|
||||
width: min(720px, 100%); background: rgba(255,255,255,.9);
|
||||
border: 1px solid #d7e0ec; border-radius: 18px; padding: 2.5rem;
|
||||
box-shadow: 0 18px 50px rgba(21,32,51,.08);
|
||||
}
|
||||
h1 { margin: 0 0 .5rem; font-size: 2rem; letter-spacing: -.02em; }
|
||||
p { margin: 0; color: var(--muted); line-height: 1.6; }
|
||||
.badge {
|
||||
display: inline-block; margin-bottom: 1rem; padding: .35rem .7rem;
|
||||
border-radius: 999px; background: #e8f0ff; color: var(--accent); font-size: .85rem; font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="badge">Creative workspace</div>
|
||||
<h1>Yali Studio</h1>
|
||||
<p>Quiet tools for sketches, drafts and small launches. Nothing to see here yet — check back later.</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
- name: Проверить SECRET_KEY ноды и Cloudflare API
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- remnanode_secret_key | length > 0
|
||||
- remnanode_cloudflare_api | length > 0
|
||||
- remnanode_selfsteal_domain | length > 3
|
||||
fail_msg: "Нужны REMNANODE_SECRET_KEY (/services/remnawave) и CLOUDFLARE_API (/services/cloudflare). Сначала прогоните core-net/remnawave."
|
||||
|
||||
- name: Поставить пакеты ноды
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- curl
|
||||
- jq
|
||||
- ufw
|
||||
- certbot
|
||||
- python3-certbot-dns-cloudflare
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Создать каталоги ноды
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "{{ item.mode }}"
|
||||
loop:
|
||||
- { path: "{{ remnanode_dir }}", mode: "0755" }
|
||||
- { path: "{{ remnanode_www_dir }}", mode: "0755" }
|
||||
- { path: /etc/letsencrypt, mode: "0755" }
|
||||
- { path: /root/.secrets, mode: "0700" }
|
||||
|
||||
- name: Положить маскировочный сайт SelfSteal
|
||||
ansible.builtin.copy:
|
||||
src: site/
|
||||
dest: "{{ remnanode_www_dir }}/"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Записать Cloudflare credentials для certbot
|
||||
ansible.builtin.copy:
|
||||
dest: /root/.secrets/cloudflare.ini
|
||||
content: |
|
||||
dns_cloudflare_api_token = {{ remnanode_cloudflare_api }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
|
||||
- name: Узнать Zone ID gunis.top
|
||||
ansible.builtin.uri:
|
||||
url: "https://api.cloudflare.com/client/v4/zones?name={{ remnanode_cloudflare_zone }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ remnanode_cloudflare_api }}"
|
||||
Content-Type: application/json
|
||||
return_content: true
|
||||
status_code: 200
|
||||
register: cf_zones
|
||||
no_log: true
|
||||
|
||||
- name: Извлечь Zone ID
|
||||
ansible.builtin.set_fact:
|
||||
remnanode_cf_zone_id: "{{ (cf_zones.json.result | first).id }}"
|
||||
|
||||
- name: Найти существующую A-запись SelfSteal
|
||||
ansible.builtin.uri:
|
||||
url: "https://api.cloudflare.com/client/v4/zones/{{ remnanode_cf_zone_id }}/dns_records?type=A&name={{ remnanode_selfsteal_domain }}"
|
||||
headers:
|
||||
Authorization: "Bearer {{ remnanode_cloudflare_api }}"
|
||||
Content-Type: application/json
|
||||
return_content: true
|
||||
status_code: 200
|
||||
register: cf_dns_lookup
|
||||
no_log: true
|
||||
|
||||
- name: Создать A-запись SelfSteal
|
||||
ansible.builtin.uri:
|
||||
url: "https://api.cloudflare.com/client/v4/zones/{{ remnanode_cf_zone_id }}/dns_records"
|
||||
method: POST
|
||||
headers:
|
||||
Authorization: "Bearer {{ remnanode_cloudflare_api }}"
|
||||
Content-Type: application/json
|
||||
body_format: json
|
||||
body:
|
||||
type: A
|
||||
name: "{{ remnanode_selfsteal_domain }}"
|
||||
content: "{{ ansible_host }}"
|
||||
ttl: 120
|
||||
proxied: false
|
||||
status_code: [200, 201]
|
||||
when: (cf_dns_lookup.json.result | length) == 0
|
||||
no_log: true
|
||||
|
||||
- name: Обновить A-запись SelfSteal
|
||||
ansible.builtin.uri:
|
||||
url: "https://api.cloudflare.com/client/v4/zones/{{ remnanode_cf_zone_id }}/dns_records/{{ (cf_dns_lookup.json.result | first).id }}"
|
||||
method: PUT
|
||||
headers:
|
||||
Authorization: "Bearer {{ remnanode_cloudflare_api }}"
|
||||
Content-Type: application/json
|
||||
body_format: json
|
||||
body:
|
||||
type: A
|
||||
name: "{{ remnanode_selfsteal_domain }}"
|
||||
content: "{{ ansible_host }}"
|
||||
ttl: 120
|
||||
proxied: false
|
||||
status_code: 200
|
||||
when: >-
|
||||
(cf_dns_lookup.json.result | length) > 0 and
|
||||
(
|
||||
(cf_dns_lookup.json.result | first).content != ansible_host or
|
||||
(cf_dns_lookup.json.result | first).proxied
|
||||
)
|
||||
no_log: true
|
||||
|
||||
- name: Выпустить/обновить сертификат через Cloudflare DNS-01
|
||||
ansible.builtin.command: >
|
||||
certbot certonly
|
||||
--dns-cloudflare
|
||||
--dns-cloudflare-credentials /root/.secrets/cloudflare.ini
|
||||
--dns-cloudflare-propagation-seconds 30
|
||||
--non-interactive
|
||||
--agree-tos
|
||||
--email {{ remnanode_letsencrypt_email }}
|
||||
-d {{ remnanode_selfsteal_domain }}
|
||||
--keep-until-expiring
|
||||
register: remnanode_certbot
|
||||
changed_when: "'Certificate not yet due for renewal' not in remnanode_certbot.stdout"
|
||||
|
||||
- name: Записать nginx SelfSteal
|
||||
ansible.builtin.template:
|
||||
src: nginx.conf.j2
|
||||
dest: "{{ remnanode_dir }}/nginx.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Записать compose ноды
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ remnanode_dir }}/compose.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
|
||||
- name: Разрешить SSH
|
||||
ansible.builtin.command: ufw allow OpenSSH
|
||||
register: ufw_ssh
|
||||
changed_when: "'added' in (ufw_ssh.stdout | lower)"
|
||||
|
||||
- name: Разрешить HTTPS для клиентов
|
||||
ansible.builtin.command: ufw allow 443/tcp
|
||||
register: ufw_https
|
||||
changed_when: "'added' in (ufw_https.stdout | lower)"
|
||||
|
||||
- name: Разрешить NODE_PORT только с egress панели
|
||||
ansible.builtin.command: >
|
||||
ufw allow from {{ remnanode_panel_egress_ip }} to any port {{ remnanode_node_port }} proto tcp
|
||||
register: ufw_node
|
||||
changed_when: "'added' in (ufw_node.stdout | lower)"
|
||||
|
||||
- name: Включить firewall
|
||||
ansible.builtin.command: ufw --force enable
|
||||
changed_when: false
|
||||
|
||||
- name: Запустить remnanode + nginx
|
||||
ansible.builtin.command: docker compose -f {{ remnanode_dir }}/compose.yaml up -d --remove-orphans
|
||||
register: remnanode_up
|
||||
changed_when: >-
|
||||
'Started' in remnanode_up.stderr or
|
||||
'Created' in remnanode_up.stderr or
|
||||
'Recreated' in remnanode_up.stderr or
|
||||
'Pulled' in remnanode_up.stderr
|
||||
|
||||
- name: Проверить, что Xray слушает 443
|
||||
ansible.builtin.shell: ss -tulpn | grep -E ':443\\b' || true
|
||||
register: remnanode_ss
|
||||
changed_when: false
|
||||
retries: 10
|
||||
delay: 3
|
||||
until: "':443' in remnanode_ss.stdout"
|
||||
|
||||
- name: Итог ноды
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "SelfSteal: https://{{ remnanode_selfsteal_domain }}"
|
||||
- "NODE_PORT {{ remnanode_node_port }} только с {{ remnanode_panel_egress_ip }}"
|
||||
- "Compose: {{ remnanode_dir }}/compose.yaml"
|
||||
@@ -0,0 +1,44 @@
|
||||
services:
|
||||
remnawave-nginx:
|
||||
image: {{ remnanode_nginx_image }}
|
||||
container_name: remnawave-nginx
|
||||
hostname: remnawave-nginx
|
||||
restart: always
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- {{ remnanode_cert_dir }}/fullchain.pem:/etc/nginx/ssl/{{ remnanode_selfsteal_domain }}/fullchain.pem:ro
|
||||
- {{ remnanode_cert_dir }}/privkey.pem:/etc/nginx/ssl/{{ remnanode_selfsteal_domain }}/privkey.pem:ro
|
||||
- /dev/shm:/dev/shm:rw
|
||||
- {{ remnanode_www_dir }}:/var/www/html:ro
|
||||
command: sh -c 'rm -f /dev/shm/nginx.sock && nginx -g "daemon off;"'
|
||||
depends_on:
|
||||
- remnanode
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 30m
|
||||
max-file: 5
|
||||
|
||||
remnanode:
|
||||
image: {{ remnanode_image }}
|
||||
container_name: remnanode
|
||||
hostname: remnanode
|
||||
restart: always
|
||||
network_mode: host
|
||||
environment:
|
||||
- NODE_PORT={{ remnanode_node_port }}
|
||||
- SECRET_KEY={{ remnanode_secret_key }}
|
||||
volumes:
|
||||
- /dev/shm:/dev/shm:rw
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 30m
|
||||
max-file: 5
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 1048576
|
||||
hard: 1048576
|
||||
@@ -0,0 +1,51 @@
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
"" close;
|
||||
}
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ecdh_curve X25519:prime256v1:secp384r1;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:MozSSL:10m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
server {
|
||||
server_name {{ remnanode_selfsteal_domain }};
|
||||
listen unix:/dev/shm/nginx.sock ssl proxy_protocol;
|
||||
http2 on;
|
||||
|
||||
ssl_certificate "/etc/nginx/ssl/{{ remnanode_selfsteal_domain }}/fullchain.pem";
|
||||
ssl_certificate_key "/etc/nginx/ssl/{{ remnanode_selfsteal_domain }}/privkey.pem";
|
||||
ssl_trusted_certificate "/etc/nginx/ssl/{{ remnanode_selfsteal_domain }}/fullchain.pem";
|
||||
|
||||
root /var/www/html;
|
||||
index index.html;
|
||||
|
||||
add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet, noimageindex" always;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location = {{ remnanode_xhttp_path }} {
|
||||
default_type text/plain;
|
||||
add_header Cache-Control "no-store" always;
|
||||
return 200 "ok";
|
||||
}
|
||||
|
||||
location = {{ remnanode_xhttp_path }}/ {
|
||||
default_type text/plain;
|
||||
add_header Cache-Control "no-store" always;
|
||||
return 200 "ok";
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen unix:/dev/shm/nginx.sock ssl proxy_protocol default_server;
|
||||
server_name _;
|
||||
add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet, noimageindex" always;
|
||||
ssl_reject_handshake on;
|
||||
return 444;
|
||||
}
|
||||
Reference in new issue
Block a user