mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-04-16 10:13:26 +02:00
25 lines
1.2 KiB
YAML
25 lines
1.2 KiB
YAML
---
|
|
|
|
- name: Handle sftpgo ports in the firewall
|
|
iptables_raw:
|
|
name: "{{ item.name }}"
|
|
state: "{{ (item.src_ip | length > 0 and (item.port is not string or item.port != '0')) | ternary('present','absent') }}"
|
|
rules: "-A INPUT -m state --state NEW -p tcp {{ item.port is string | ternary('--dport ' ~ item.port, '-m multiport --dports ' ~ item.port | join(',')) }} -s {{ item.src_ip | join(',') }} -j ACCEPT"
|
|
with_items:
|
|
- port: "{{ sftpgo_conf.sftpd.bindings.port }}"
|
|
name: sftpgo_sftp_port
|
|
src_ip: "{{ sftpgo_sftpd_src_ip }}"
|
|
- port: "{{ [sftpgo_conf.ftpd.bindings.port,sftpgo_conf.ftpd.passive_port_range.start ~ ':' ~ sftpgo_conf.ftpd.passive_port_range.end] }}"
|
|
name: sftpgo_ftp_port
|
|
src_ip: "{{ sftpgo_ftpd_src_ip }}"
|
|
- port: "{{ sftpgo_conf.webdavd.bindings.port }}"
|
|
name: sftpgo_webdav_port
|
|
src_ip: "{{ sftpgo_webdavd_src_ip }}"
|
|
- port: "{{ sftpgo_conf.httpd.bindings.port }}"
|
|
name: sftpgo_http_port
|
|
src_ip: "{{ sftpgo_httpd_src_ip }}"
|
|
- port: "{{ sftpgo_conf.telemetry.bind_port }}"
|
|
name: sftpgo_metrics_port
|
|
src_ip: "{{ sftpgo_telemetry_src_ip }}"
|
|
tags: firewall,sftpgo
|