Skip to content

Commit

Permalink
Merge pull request #7 from 0x0I/add_iptable_setup
Browse files Browse the repository at this point in the history
add option to allow specified ingress ports via iptables
  • Loading branch information
O1ahmad authored Feb 9, 2023
2 parents d6adf52 + 5b59636 commit 4ddeb6c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Configure and operate a basic cloud-native service: running anything from cypto
| _config_ | configuration files associated with the service to mount | `{}` |
| _configEnv_ | environment variables to set within the service runtime | `{}` |
| _ports_ | listening port information for a service | `{}` |
| _setup_iptables_ | configure IP tables to allow ingress paths | `false` |
| _hostDataDir_ | host directory to store node runtime/operational data | `/var/tmp` |
| _dataDir_ | container directory to store node runtime/operational data | `/tmp` |
| _workDir_ | operational directory to store runtime artifacts | `/var/tmp` |
Expand Down
12 changes: 12 additions & 0 deletions tasks/common/network-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Determine service ingress port list for iptables config
ansible.builtin.set_fact:
ingressList: "{{ ingressList + [item.value.ingressPort | string] }}"
with_dict: "{{ ports }}"

- name: Allow service ingress ports in iptables setup
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_ports: "{{ ingressList }}"
jump: ACCEPT
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

- name: Setup service infrastructure topology
ansible.builtin.include_tasks: "{{ setupMode }}/setup.yml"

- name: Manage networking and IP tables setup
when: setup_iptables|bool
ansible.builtin.include_tasks: "common/network-setup.yml"

0 comments on commit 4ddeb6c

Please sign in to comment.