Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally add HTTPS inbound allow firewall rule #1530

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}]"
strarsis marked this conversation as resolved.
Show resolved Hide resolved
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
Loading