first commit
This commit is contained in:
60
templates/jail.j2
Normal file
60
templates/jail.j2
Normal file
@@ -0,0 +1,60 @@
|
||||
[DEFAULT]
|
||||
{{ "%-13s = %s"|format('bantime', fail2ban_defaults.bantime | default('7200', true)) }}
|
||||
{{ "%-13s = %s"|format('findtime', fail2ban_defaults.findtime | default('600', true)) }}
|
||||
{{ "%-13s = %s"|format('maxretry', fail2ban_defaults.maxretry | default('3', true)) }}
|
||||
{% if fail2ban_alerts.enabled %}
|
||||
{{ "%-13s = %s"|format('sendername', fail2ban_alerts.from) }}
|
||||
{{ "%-13s = %s"|format('destemail', fail2ban_alerts.email) }}
|
||||
{{ "%-13s = %s"|format('action', '%(action_mwl)s') }}
|
||||
{% endif %}
|
||||
{{ "%-13s = %s %s"|format('ignoreip', '127.0.0.1/8', fail2ban_ignores_ips|join(' ')) }}
|
||||
{% if fail2ban_enable_ignorecommand %}
|
||||
{{ "%-13s = %s"|format('ignorecommand', '/usr/local/sbin/custom.fail2ban-check-ip <ip>') }}
|
||||
{% endif %}
|
||||
{% if 'openssh-server' in ansible_facts.packages %}
|
||||
|
||||
[sshd]
|
||||
{{ "%-10s = %s"|format('enabled', fail2ban_sshd.enabled | default('true', true)) }}
|
||||
{{ "%-10s = %s"|format('ports', fail2ban_sshd.ports | default('22', true)) }}
|
||||
{{ "%-10s = %s"|format('maxretry', fail2ban_sshd.maxretry | default(fail2ban_defaults.maxretry, true)) }}
|
||||
{{ "%-10s = %s"|format('bantime', fail2ban_sshd.bantime | default(fail2ban_defaults.bantime, true)) }}
|
||||
{{ "%-10s = %s"|format('findtime', fail2ban_sshd.findtime | default('1800', true)) }}
|
||||
{% endif %}
|
||||
{% if fail2ban_containers is defined and fail2ban_containers|length %}
|
||||
{% for container in fail2ban_containers %}
|
||||
|
||||
[sshd-lxc-{{ container.name }}]
|
||||
{{ "%-10s = %s"|format('enabled', container.enabled | default('true', true)) }}
|
||||
{{ "%-10s = %s"|format('logpath', container.logpath | mandatory) }}
|
||||
{% if fail2ban_dummy_logs %}
|
||||
{{ fail2ban_dummy_log_path|indent(13, True) }}
|
||||
{% endif %}
|
||||
{{ "%-10s = %s"|format('filter', container.filter | default('sshd', true)) }}
|
||||
{{ "%-10s = %s"|format('port', container.port | default('22', true)) }}
|
||||
{{ "%-10s = %s"|format('backend', container.backend | default('polling', true)) }}
|
||||
{{ "%-10s = %s"|format('chain', container.chain | default('FORWARD', true)) }}
|
||||
{{ "%-10s = %s"|format('banaction', container.banaction | default('iptables-multiport', true)) }}
|
||||
{{ "%-10s = %s"|format('bantime', container.bantime | default('10000', true)) }}
|
||||
{{ "%-10s = %s"|format('maxretry', container.maxretry | default('3', true)) }}
|
||||
{{ "%-10s = %s"|format('findtime', container.findtime | default('1800', true)) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if fail2ban_services is defined and fail2ban_services|length %}
|
||||
{% for service in fail2ban_services %}
|
||||
|
||||
[{{ service.name }}]
|
||||
{% if not service.enabled is defined %}
|
||||
{{ "%-10s = %s"|format("enabled", "True") }}
|
||||
{% endif %}
|
||||
{% for key, value in service.items()|sort() %}
|
||||
{% if key != 'name' %}
|
||||
{% if key == 'logpath' and fail2ban_dummy_logs %}
|
||||
{{ "%-10s = %s"|format(key, value) }}
|
||||
{{ fail2ban_dummy_log_path|indent(13, True) }}
|
||||
{% else %}
|
||||
{{ "%-10s = %s"|format(key, value) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user