diff --git a/Inventories/test/host_vars/ansible-test01.yml b/Inventories/test/host_vars/ansible-test01.yml index 63d409b..f00ed78 100644 --- a/Inventories/test/host_vars/ansible-test01.yml +++ b/Inventories/test/host_vars/ansible-test01.yml @@ -28,4 +28,21 @@ required_pkgs: - apache2-utils - mariadb-client - git - - sshpass \ No newline at end of file + - 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" \ No newline at end of file diff --git a/Inventories/test/host_vars/ansible-test02.yml b/Inventories/test/host_vars/ansible-test02.yml index e1a3575..f682492 100644 --- a/Inventories/test/host_vars/ansible-test02.yml +++ b/Inventories/test/host_vars/ansible-test02.yml @@ -28,4 +28,21 @@ required_pkgs: - apache2-utils - mariadb-client - git - - sshpass \ No newline at end of file + - 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" \ No newline at end of file diff --git a/ansible-config_fw.yml b/ansible-config_fw.yml new file mode 100644 index 0000000..ec574d6 --- /dev/null +++ b/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