Browse Source

update

master
Dirk Wirts 2 years ago
parent
commit
afbdeda318
  1. 19
      Inventories/test/host_vars/ansible-test01.yml
  2. 19
      Inventories/test/host_vars/ansible-test02.yml
  3. 38
      ansible-config_fw.yml

19
Inventories/test/host_vars/ansible-test01.yml

@ -28,4 +28,21 @@ required_pkgs:
- apache2-utils
- mariadb-client
- git
- sshpass
- sshpass
# Liste von IPs mit Erlaubnis für SSH
ssh_ips:
- "195.192.223.212" # Ratingen
- "87.128.173.178" # Essen
- "94.79.143.149" # Dirk
# Liste von Ports, die erlaubt sind
tcp_ports:
- "22"
- "6789"
- "8080"
- "8443"
- "8843"
- "8880"
udp_ports:
- "3478"

19
Inventories/test/host_vars/ansible-test02.yml

@ -28,4 +28,21 @@ required_pkgs:
- apache2-utils
- mariadb-client
- git
- sshpass
- sshpass
# Liste von IPs mit Erlaubnis für SSH
ssh_ips:
- "195.192.223.212" # Ratingen
- "87.128.173.178" # Essen
- "94.79.143.149" # Dirk
# Liste von Ports, die erlaubt sind
tcp_ports:
- "22"
- "6789"
- "8080"
- "8443"
- "8843"
- "8880"
udp_ports:
- "3478"

38
ansible-config_fw.yml

@ -0,0 +1,38 @@
---
- name: UFW Konfiguration
hosts: all
become: true
tasks:
- name: Setze Standard UFW Regel auf deny
community.general.ufw:
state: enabled
default: deny
- name: Erlaube SSH Zugriff von spezifischen IPs
community.general.ufw:
rule: allow
src: "{{ item }}"
proto: tcp
to_port: "22"
loop: "{{ ssh_ips }}"
- name: Erlaube spezifizierte TCP Ports
community.general.ufw:
rule: allow
to_port: "{{ item }}"
proto: tcp
loop: "{{ tcp_ports }}"
- name: Erlaube spezifizierte UDP Ports
community.general.ufw:
rule: allow
to_port: "{{ item }}"
proto: udp
loop: "{{ udp_ports }}"
- name: Aktiviere UFW
community.general.ufw:
state: enabled
default: deny
direction: incoming
Loading…
Cancel
Save