Skip to content

Commit

Permalink
Add code to conditionally add HTTPS inbound allow firewall rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
strarsis committed Jul 29, 2024
1 parent ab4226b commit 7aafbfe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion group_vars/all/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ferm_input_list:
- type: dport_accept
dport: [http, https]
dport: [http]
filename: nginx_accept
- type: dport_accept
dport: [ssh]
Expand Down
2 changes: 2 additions & 0 deletions roles/ferm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ ferm_default_policy_forward: DROP
ferm_input_list: []
ferm_input_group_list: []
ferm_input_host_list: []

sites_using_ssl: "[{% for name, site in wordpress_sites.items() | list if site.ssl.enabled %}'{{ name }}',{% endfor %}]"
10 changes: 10 additions & 0 deletions roles/ferm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
- /etc/ferm/ferm.d
- /etc/ferm/filter-input.d

- name: allow inbound HTTPS
set_fact:
ferm_input_list: "{{ ferm_input_list + [ ferm_dport_nginx_https] }}"
when: sites_using_ssl | count
vars:
ferm_dport_nginx_https:
type: dport_accept
dport: [https]
filename: nginx_accept_https

- name: ensure firewall is configured
template:
src: "{{ item }}.j2"
Expand Down

0 comments on commit 7aafbfe

Please sign in to comment.