Browse Source

Fix iptables entries again

pull/20/head
Kristijan Mitrovic 4 years ago
parent
commit
6f436dde60
5 changed files with 34 additions and 29 deletions
  1. +20
    -18
      bubble-server/src/main/resources/ansible/roles/algo/tasks/algo_firewall.yml
  2. +4
    -0
      bubble-server/src/main/resources/ansible/roles/algo/tasks/main.yml
  3. +4
    -3
      bubble-server/src/main/resources/ansible/roles/finalizer/tasks/main.yml
  4. +0
    -2
      bubble-server/src/main/resources/ansible/roles/mitmproxy/tasks/main.yml
  5. +6
    -6
      bubble-server/src/main/resources/packer/roles/firewall/tasks/rules.yml

bubble-server/src/main/resources/ansible/roles/finalizer/tasks/firewall.yml → bubble-server/src/main/resources/ansible/roles/algo/tasks/algo_firewall.yml View File

@@ -3,39 +3,41 @@
#
# Insert additional firewall rules to allow required services to function
# Insert them all on rule_num 5, and insert them in reverse order here:
- name: Allow HTTPS on port {{ item }}
- name: Allow SSH
iptables:
chain: INPUT
action: used_iptabples_action
rule_num: 5
protocol: tcp
destination_port: {{ item }}
destination_port: 22
ctstate: NEW
syn: match
jump: ACCEPT
comment: Accept new HTTPS ({{ item }}) connections
with_items:
- 1443
- 443
comment: Accept new SSH connections
become: yes

- name: Allow HTTP on port {{ item }}
- name: "Allow HTTP on port {{ item }}"
iptables:
chain: INPUT
action: used_iptabples_action
rule_num: 5
protocol: tcp
destination_port: {{ item }}
destination_port: "{{ item }}"
ctstate: NEW
syn: match
jump: ACCEPT
comment: Accept new HTTP ({{ item }}) connections
comment: "Accept new HTTP ({{ item }}) connections"
with_items:
- 1080
- 80
- 1080
become: yes

- name: Restart iptables
service:
name: netfilter-persistent
state: restarted
- name: "Allow HTTPS on port {{ item }}"
iptables:
chain: INPUT
protocol: tcp
destination_port: "{{ item }}"
ctstate: NEW
syn: match
jump: ACCEPT
comment: "Accept new HTTPS ({{ item }}) connections"
with_items:
- 443
- 1443
become: yes

+ 4
- 0
bubble-server/src/main/resources/ansible/roles/algo/tasks/main.yml View File

@@ -16,3 +16,7 @@
- name: Run algo playbook to install algo
shell: /root/ansible/roles/algo/algo/install_algo.sh
tags: algo_related

# Algo installation clears out iptable rules. Add needed bubble rules back:
- include: algo_firewall.yml
tags: algo_related

+ 4
- 3
bubble-server/src/main/resources/ansible/roles/finalizer/tasks/main.yml View File

@@ -25,9 +25,10 @@
src: "supervisor_bubble.conf.j2"
dest: /etc/supervisor/conf.d/bubble.conf

- include: firewall.yml
vars:
used_iptabples_action: "{{ 'append' if restore_key is defined else 'insert' }}"
- name: Restart iptables
service:
name: netfilter-persistent
state: restarted

# We cannot receive notifications until nginx is running, so start bubble API as the very last step
- name: reload supervisord


+ 0
- 2
bubble-server/src/main/resources/ansible/roles/mitmproxy/tasks/main.yml View File

@@ -34,8 +34,6 @@
- name: Allow MITM private port
iptables:
chain: INPUT
action: insert
rule_num: 5
protocol: tcp
destination_port: 8888
ctstate: NEW


+ 6
- 6
bubble-server/src/main/resources/packer/roles/firewall/tasks/rules.yml View File

@@ -29,30 +29,30 @@
become: yes
when: fw_enable_ssh

- name: Allow HTTP on port {{ item }}
- name: "Allow HTTP on port {{ item }}"
iptables:
chain: INPUT
protocol: tcp
destination_port: {{ item }}
destination_port: "{{ item }}"
ctstate: NEW
syn: match
jump: ACCEPT
comment: Accept new HTTP ({{ item }}) connections
comment: "Accept new HTTP ({{ item }}) connections"
with_items:
- 80
- 1080
become: yes
when: fw_enable_http

- name: Allow HTTPS on port {{ item }}
- name: "Allow HTTPS on port {{ item }}"
iptables:
chain: INPUT
protocol: tcp
destination_port: {{ item }}
destination_port: "{{ item }}"
ctstate: NEW
syn: match
jump: ACCEPT
comment: Accept new HTTPS ({{ item }}) connections
comment: "Accept new HTTPS ({{ item }}) connections"
with_items:
- 443
- 1443


Loading…
Cancel
Save