chore(security): disable vector on external VPS nodes and restrict exit node LAN access
ansible-deploy / plan (push) Successful in 2s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Successful in 8s
ansible-deploy / deploy (core-net, ) (push) Successful in 9s
ansible-deploy / deploy (core-secrets, ) (push) Successful in 8s
ansible-deploy / deploy (ger-nod-02, ) (push) Successful in 2m18s
ansible-deploy / deploy (rus-central, ) (push) Successful in 2m0s

This commit is contained in:
karpenok committed 2026-11-18 12:05:37 +07:00
1 parent 425d878ec7
commit ca25b1d042
5 files changed
+78 -42

No files matched your search

+2
View File
@@ -10,4 +10,6 @@
- role: vmagent - role: vmagent
tags: [vmagent] tags: [vmagent]
- role: vector - role: vector
vars:
vector_enabled: false
tags: [vector] tags: [vector]
+2
View File
@@ -8,4 +8,6 @@
- role: rus-central/cadvisor - role: rus-central/cadvisor
tags: [cadvisor] tags: [cadvisor]
- role: vector - role: vector
vars:
vector_enabled: false
tags: [vector] tags: [vector]
@@ -32,6 +32,14 @@
changed_when: "'added' in (ufw_netbird_wg.stdout | lower) or 'deleted' in (ufw_netbird_wg.stdout | lower)" changed_when: "'added' in (ufw_netbird_wg.stdout | lower) or 'deleted' in (ufw_netbird_wg.stdout | lower)"
failed_when: false failed_when: false
- name: Ограничить исходящий доступ с exit node в домашнюю LAN (только VictoriaMetrics на core-mon)
ansible.builtin.command: "{{ item }}"
loop:
- ufw allow out proto tcp from any to 192.168.1.108 port 8428
- ufw deny out to 192.168.1.0/24
register: ufw_lan_restrict
changed_when: "'added' in (ufw_lan_restrict.stdout | lower)"
- name: Клиент NetBird на ноде - name: Клиент NetBird на ноде
ansible.builtin.include_role: ansible.builtin.include_role:
name: netbird_client name: netbird_client
+1
View File
@@ -1,4 +1,5 @@
--- ---
vector_enabled: true
vector_config_path: /etc/vector/vector.yaml vector_config_path: /etc/vector/vector.yaml
vector_data_dir: /var/lib/vector vector_data_dir: /var/lib/vector
vector_legacy_dir: /opt/vector vector_legacy_dir: /opt/vector
+65 -42
View File
@@ -15,51 +15,74 @@
state: absent state: absent
when: vector_legacy_compose.stat.exists when: vector_legacy_compose.stat.exists
- name: Подключить APT-репозиторий Vector - name: Отключить и удалить конфиг Vector, если сбор логов выключен
ansible.builtin.shell: curl -1sLf 'https://setup.vector.dev' | bash when: not (vector_enabled | bool)
args: block:
creates: /etc/apt/sources.list.d/vector.list - name: Проверить наличие systemd-сервиса Vector
ansible.builtin.stat:
path: /lib/systemd/system/vector.service
register: vector_unit
- name: Установить нативный пакет Vector - name: Остановить и отключить Vector
ansible.builtin.apt: ansible.builtin.systemd:
name: vector name: vector
state: present state: stopped
update_cache: true enabled: false
when: vector_unit.stat.exists
- name: Выдать пользователю vector доступ к journald и docker - name: Удалить конфигурацию Vector
ansible.builtin.user: ansible.builtin.file:
name: vector path: "{{ vector_config_path }}"
groups: state: absent
- systemd-journal
- docker
append: true
register: vector_user_groups
- name: Подготовить каталог данных Vector - name: Установить и запустить нативный Vector
ansible.builtin.file: when: vector_enabled | bool
path: "{{ vector_data_dir }}" block:
state: directory - name: Подключить APT-репозиторий Vector
owner: vector ansible.builtin.shell: curl -1sLf 'https://setup.vector.dev' | bash
group: vector args:
mode: "0750" creates: /etc/apt/sources.list.d/vector.list
- name: Удалить дефолтный vector.toml из пакета, если есть - name: Установить нативный пакет Vector
ansible.builtin.file: ansible.builtin.apt:
path: /etc/vector/vector.toml name: vector
state: absent state: present
update_cache: true
- name: Установить конфигурацию Vector - name: Выдать пользователю vector доступ к journald и docker
ansible.builtin.template: ansible.builtin.user:
src: vector.yaml.j2 name: vector
dest: "{{ vector_config_path }}" groups:
owner: root - systemd-journal
group: vector - docker
mode: "0640" append: true
validate: "vector validate --no-environment --config-yaml %s" register: vector_user_groups
register: vector_config
- name: Запустить и включить systemd-сервис Vector - name: Подготовить каталог данных Vector
ansible.builtin.systemd: ansible.builtin.file:
name: vector path: "{{ vector_data_dir }}"
enabled: true state: directory
state: "{{ 'restarted' if (vector_config is changed or vector_user_groups is changed) else 'started' }}" owner: vector
group: vector
mode: "0750"
- name: Удалить дефолтный vector.toml из пакета, если есть
ansible.builtin.file:
path: /etc/vector/vector.toml
state: absent
- name: Установить конфигурацию Vector
ansible.builtin.template:
src: vector.yaml.j2
dest: "{{ vector_config_path }}"
owner: root
group: vector
mode: "0640"
validate: "vector validate --no-environment --config-yaml %s"
register: vector_config
- name: Запустить и включить systemd-сервис Vector
ansible.builtin.systemd:
name: vector
enabled: true
state: "{{ 'restarted' if (vector_config is changed or vector_user_groups is changed) else 'started' }}"