This commit is contained in:
mrwho 2026-05-15 00:50:14 +03:00
parent 1ffc9fc31e
commit 6c4718c630
6 changed files with 26 additions and 17 deletions

View file

@ -19,4 +19,4 @@ all:
ansible_host: 192.168.99.42 ansible_host: 192.168.99.42
rocky9-template: rocky9-template:
ansible_host: 172.20.21.103 ansible_host: 192.168.99.43

View file

@ -20,8 +20,9 @@
vars: vars:
#ansible_ssh_user: root #ansible_ssh_user: root
#ansible_ssh_password: nmklop90 #ansible_ssh_password: nmklop90
epel_repo: true
reboot_system: false reboot_system: false
hostname: rocky9-template.local.mrwho.ru hostname: "{{ ansible_hostname }}.local.mrwho.ru"
openssh_password_authentication: false openssh_password_authentication: false
openssh_permit_root_login: "no" # Completely disable root SSH openssh_permit_root_login: "no" # Completely disable root SSH
@ -30,8 +31,8 @@
openssh_enable_persourcepenalties: true openssh_enable_persourcepenalties: true
openssh_persource_authfail_penalty: "10s" # Aggressive penalty openssh_persource_authfail_penalty: "10s" # Aggressive penalty
openssh_persource_maxstartups: "5:30:10" # Very restrictive openssh_persource_maxstartups: "5:30:10" # Very restrictive
# Disable all forwarding (prevent lateral movement) # Disable all port forwarding
openssh_disable_forwarding_comprehensive: true openssh_disable_forwarding_comprehensive: false
openssh_x11_forwarding: false openssh_x11_forwarding: false
# Restrict to strongest cryptography only # Restrict to strongest cryptography only
openssh_ciphers: openssh_ciphers:

View file

@ -7,7 +7,7 @@ linux_dnf_automatic_enabled: true
linux_dnf_automatic_apply_updates: "security" linux_dnf_automatic_apply_updates: "security"
# Email notifications (optional requires mail setup) # Email notifications (optional requires mail setup)
linux_dnf_automatic_email_notify: true linux_dnf_automatic_email_notify: false
linux_dnf_automatic_email_to: "root@localhost" linux_dnf_automatic_email_to: "root@localhost"
linux_dnf_automatic_email_from: "dnf-automatic@{{ ansible_fqdn }}" linux_dnf_automatic_email_from: "dnf-automatic@{{ ansible_fqdn }}"

View file

@ -1,5 +1,5 @@
--- ---
- name: "Deploy CyberAar pre-login banner (/etc/issue.net)" - name: "Deploy pre-login banner (/etc/issue.net)"
when: "linux_login_banner_prelogin | bool" when: "linux_login_banner_prelogin | bool"
ansible.builtin.template: ansible.builtin.template:
src: "issue.net.j2" src: "issue.net.j2"
@ -11,7 +11,7 @@
register: "prelogin_banner_result" register: "prelogin_banner_result"
changed_when: "prelogin_banner_result.changed" changed_when: "prelogin_banner_result.changed"
- name: "Deploy CyberAar post-login banner (/etc/motd)" - name: "Deploy post-login banner (/etc/motd)"
when: "linux_login_banner_postlogin | bool" when: "linux_login_banner_postlogin | bool"
ansible.builtin.template: ansible.builtin.template:
src: "motd.j2" src: "motd.j2"
@ -23,7 +23,7 @@
register: "motd_result" register: "motd_result"
changed_when: "motd_result.changed" changed_when: "motd_result.changed"
- name: "Deploy CyberAar console login banner (/etc/issue)" - name: "Deploy console login banner (/etc/issue)"
when: "linux_login_banner_issue | bool" when: "linux_login_banner_issue | bool"
ansible.builtin.template: ansible.builtin.template:
src: "issue.j2" src: "issue.j2"

View file

@ -32,9 +32,11 @@
community.general.dnf_config_manager: community.general.dnf_config_manager:
name: crb name: crb
state: enabled state: enabled
when: crb_repo is defined
- name: Install EPEL repo - name: Install EPEL repo
ansible.builtin.include_tasks: install-epel-repo.yml ansible.builtin.include_tasks: install-epel-repo.yml
when: epel_repo is defined
# - name: Upgrade all packages # - name: Upgrade all packages
# ansible.builtin.dnf: # ansible.builtin.dnf:

View file

@ -18,16 +18,22 @@
# Если в таблице маршрутизации есть маршрут на сеть, с которой пришёл пакет (src ip) # Если в таблице маршрутизации есть маршрут на сеть, с которой пришёл пакет (src ip)
# и он ссылается на данный интерфейс, то такой пакет будет принят. # и он ссылается на данный интерфейс, то такой пакет будет принят.
# остальные будут отброшены. # остальные будут отброшены.
# Когда rp_filter нужно отключать (0) или ослаблять (2):
# - Использование асимметричной маршрутизации (когда пакеты приходят через провайдера А, а уходят через провайдера Б).
# - Настройка сложных схем балансировки трафика (BGP, Multipath).
# - Использование политик маршрутизации (Policy Based Routing via ip rule).
# При строгом режиме 1 ядро проверяет обратный путь по дефолтной таблице main,
# игнорируя кастомные таблицы, что приводит к ложному отбрасыванию пакетов.
- name: net.ipv4.conf.default.rp_filter - name: net.ipv4.conf.default.rp_filter
ansible.posix.sysctl: ansible.posix.sysctl:
name: net.ipv4.conf.default.rp_filter name: net.ipv4.conf.default.rp_filter
value: 1 value: 0
state: present state: present
sysctl_file: /etc/sysctl.d/ip_forward.conf sysctl_file: /etc/sysctl.d/ip_forward.conf
- name: net.ipv4.conf.all.rp_filter - name: net.ipv4.conf.all.rp_filter
ansible.posix.sysctl: ansible.posix.sysctl:
name: net.ipv4.conf.all.rp_filter name: net.ipv4.conf.all.rp_filter
value: 1 value: 0
state: present state: present
sysctl_file: /etc/sysctl.d/ip_forward.conf sysctl_file: /etc/sysctl.d/ip_forward.conf
- name: net.ipv4.conf.lo.rp_filter - name: net.ipv4.conf.lo.rp_filter
@ -43,13 +49,13 @@
state: present state: present
sysctl_file: /etc/sysctl.d/ip_forward.conf sysctl_file: /etc/sysctl.d/ip_forward.conf
# - name: net.ipv4.conf.default.send_redirects - name: net.ipv4.conf.default.send_redirects
# ansible.posix.sysctl: ansible.posix.sysctl:
# name: net.ipv4.conf.default.send_redirects name: net.ipv4.conf.default.send_redirects
# value: 0 value: 0
# state: present state: present
# reload: true reload: true
# sysctl_file: /etc/sysctl.d/ip_forward.conf sysctl_file: /etc/sysctl.d/ip_forward.conf
- name: net.ipv4.conf.all.accept_redirects - name: net.ipv4.conf.all.accept_redirects
ansible.posix.sysctl: ansible.posix.sysctl: