feat(remnawave): шаблон Except-RU на хосте yali
ansible-core-net / deploy (push) Successful in 19s

Старое имя NL_YT_TG_ONLY не совпадало с правилами: это полный туннель, RU идёт напрямую. JSON в базовой подписке включён.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
karpenokandCursor committed 2026-11-11 23:55:11 +07:00
1 parent abca41fd35
commit e5bebab5d2
4 files changed
+205

No files matched your search

@@ -36,6 +36,7 @@ remnawave_xhttp_path: "/xhttp-yali"
remnawave_profile_name: "DE-Yali"
remnawave_inbound_tag: "Steal-Yali"
remnawave_host_remark: "🇩🇪 Yali"
remnawave_xray_template_name: "Except-RU"
remnawave_api_token_name: "infra-automation"
# Документация WAN egress панели (см. remnanode_panel_egress_ips на ger-nod-02).
@@ -0,0 +1,151 @@
{
"remnawave": {
"addVirtualHostAsOutbound": true
},
"routing": {
"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": "direct"
},
{
"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": "proxy"
},
{
"ip": ["geoip:ru"],
"type": "field",
"outboundTag": "direct"
},
{
"type": "field",
"domain": ["geosite:category-ru"],
"outboundTag": "direct"
},
{
"ip": ["geoip:private"],
"type": "field",
"outboundTag": "direct"
},
{
"type": "field",
"protocol": ["bittorrent"],
"outboundTag": "direct"
},
{
"type": "field",
"network": "tcp,udp",
"outboundTag": "proxy"
}
],
"domainMatcher": "hybrid",
"domainStrategy": "IPIfNonMatch"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true,
"auth": "noauth"
},
"sniffing": {
"enabled": true,
"routeOnly": false,
"destOverride": ["http", "tls", "quic"]
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"allowTransparent": false
},
"sniffing": {
"enabled": true,
"routeOnly": false,
"destOverride": ["http", "tls", "quic"]
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom"
},
{
"tag": "block",
"protocol": "blackhole"
}
]
}
@@ -134,6 +134,14 @@
group: root
mode: "0644"
- name: Положить клиентский шаблон Xray Except-RU
ansible.builtin.copy:
src: xray-except-ru.json
dest: "{{ remnawave_dir }}/xray-except-ru.json"
owner: root
group: root
mode: "0644"
- name: Стянуть образы панели Remnawave
ansible.builtin.command: docker compose -f {{ remnawave_dir }}/compose.yaml pull
register: remnawave_compose_pull
@@ -199,6 +207,8 @@
RW_SELFSTEAL: "{{ remnawave_selfsteal_domain }}"
RW_XHTTP_PATH: "{{ remnawave_xhttp_path }}"
RW_HOST_REMARK: "{{ remnawave_host_remark }}"
RW_XRAY_TEMPLATE_NAME: "{{ remnawave_xray_template_name }}"
RW_XRAY_TEMPLATE_FILE: "{{ remnawave_dir }}/xray-except-ru.json"
RW_PROFILE_FILE: "{{ remnawave_dir }}/profile-de-yali.json"
RW_PANEL_DOMAIN: "{{ remnawave_panel_domain }}"
RW_USERS_FILE: "{{ remnawave_dir }}/users.json"
@@ -290,6 +290,48 @@ if [ -z "${host_uuid}" ]; then
fi
users_changed=0
# Клиентский Xray JSON. Имя Except-RU: весь tcp/udp в proxy, RU/private/торренты и
# проверки IP в direct. Блок remnawave панель снимает до выдачи клиенту и
# подставляет этот хост как outbound с тегом proxy.
if [ -n "${RW_XRAY_TEMPLATE_FILE:-}" ] && [ -f "${RW_XRAY_TEMPLATE_FILE}" ]; then
want_tpl=$(jq -c . "${RW_XRAY_TEMPLATE_FILE}")
tpl_list=$(api GET /subscription-templates/)
tpl_uuid=$(printf '%s' "${tpl_list}" | jq -r --arg n "${RW_XRAY_TEMPLATE_NAME}" '
.response.templates[]? | select(.name == $n and .templateType == "XRAY_JSON") | .uuid' | head -1)
if [ -z "${tpl_uuid}" ]; then
tpl_body=$(jq -n --arg n "${RW_XRAY_TEMPLATE_NAME}" --argjson j "${want_tpl}" \
'{name: $n, templateType: "XRAY_JSON", templateJson: $j}')
tpl_resp=$(api POST /subscription-templates/ -d "${tpl_body}")
tpl_uuid=$(printf '%s' "${tpl_resp}" | jq -r '.response.uuid // empty')
if [ -z "${tpl_uuid}" ]; then
echo "Не удалось создать шаблон ${RW_XRAY_TEMPLATE_NAME}" >&2
exit 1
fi
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} создан" >&2
users_changed=1
else
tpl_full=$(api GET "/subscription-templates/${tpl_uuid}")
current_tpl=$(printf '%s' "${tpl_full}" | jq -cS '.response.templateJson // {}')
wanted_tpl=$(jq -cS . "${RW_XRAY_TEMPLATE_FILE}")
if [ "${current_tpl}" != "${wanted_tpl}" ]; then
upd=$(jq -n --arg u "${tpl_uuid}" --argjson j "${want_tpl}" '{uuid: $u, templateJson: $j}')
api PATCH /subscription-templates/ -d "${upd}" >/dev/null
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} обновлён" >&2
users_changed=1
else
echo "Шаблон ${RW_XRAY_TEMPLATE_NAME} уже совпадает" >&2
fi
fi
bound=$(printf '%s' "${hosts_json}" | jq -r --arg u "${host_uuid}" '.response[]? | select(.uuid == $u) | .xrayJsonTemplateUuid // empty')
if [ "${bound}" != "${tpl_uuid}" ]; then
host_bind=$(jq -n --arg u "${host_uuid}" --arg t "${tpl_uuid}" '{uuid: $u, xrayJsonTemplateUuid: $t}')
api PATCH /hosts/ -d "${host_bind}" >/dev/null
echo "Хост ${RW_SELFSTEAL} привязан к шаблону ${RW_XRAY_TEMPLATE_NAME}" >&2
users_changed=1
fi
fi
squad_uuid=$(api GET /internal-squads/ | jq -r --arg n "Default-Squad" '
.response.internalSquads[]? | select(.name == $n) | .uuid' | head -1)
if [ -n "${squad_uuid}" ] && [ -n "${inbound_uuid}" ]; then
@@ -317,6 +359,7 @@ settings=$(api GET /subscription-settings/ || echo '')
if [ -n "${settings}" ]; then
patched=$(printf '%s' "${settings}" | jq '
.response
| .serveJsonAtBaseSubscription = true
| .responseRules.rules = (
[
{