Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Ufw rules

- name: Install UFW.
  apt:
    name: ufw
    state: present
    
- name: Setup default firewall rules.
  command: "ufw {{ item }}"
  with_items: 
    - default deny incoming on eth0
    - default allow outgoing on eth0
    - default allow incoming on eth1
    - default allow outgoin on eth1
    - default allow FORWARD
    - allow ssh

- name: Set up custom firewall rules.
  command: "ufw {{ item }}"
  with_items: firewall_rules

- name: Start UFW.
  command: ufw --force enable # Force flag used to skip `are you sure` query.
Source by jite.eu #
 
PREVIOUS NEXT
Tagged: #Ufw #rules
ADD COMMENT
Topic
Name
9+6 =