--- # Zweite Verteidigungslinie gegen Brute-Force zusaetzlich zum # Anwendungs-Rate-Limiting (Konzept 6.2). Ueberwacht die Uvicorn-/nginx- # Access-Logs auf gehaeufte 401-Antworten vom Login-Endpunkt. - name: fail2ban installieren ansible.builtin.apt: name: fail2ban state: present update_cache: true - name: Filter fuer Jumphost-Login-Fehlversuche ansible.builtin.copy: dest: /etc/fail2ban/filter.d/jumphost-login.conf owner: root group: root mode: "0644" content: | [Definition] failregex = ^.*"POST /auth/login(/totp)? HTTP/.*" 401 .*client_ip=.*$ ^.*"POST /auth/login(/totp)? HTTP/.*" 401 .*.*$ ignoreregex = - name: Jail fuer Jumphost-Login aktivieren ansible.builtin.copy: dest: /etc/fail2ban/jail.d/jumphost.conf owner: root group: root mode: "0644" content: | # E8 (Umsetzungsauftrag Teil E): jumphost_fail2ban_maxretry ist ein # group_vars-Wert (siehe ansible/inventory/group_vars/all.yml) -- # greift wie das nginx-limit_req und der App-Rate-Limiter pro # Quell-IP und muss zusammen mit diesen als bewusste # Betriebsentscheidung festgelegt werden. [jumphost-login] enabled = true filter = jumphost-login logpath = /var/log/jumphost/access.log maxretry = {{ jumphost_fail2ban_maxretry }} findtime = 300 bantime = 1800 notify: restart fail2ban