Skip to content

Allow changing the ports of the fail2banned services - #48

Open
brunorro wants to merge 16 commits into
voxpupuli:masterfrom
brunorro:master
Open

Allow changing the ports of the fail2banned services#48
brunorro wants to merge 16 commits into
voxpupuli:masterfrom
brunorro:master

Conversation

@brunorro

@brunorro brunorro commented Apr 3, 2018

Copy link
Copy Markdown

Pull Request (PR) description

This request allows changing the default port for any service watched by fail2ban. Check Readme.md for the usage of the "ports" parameter.

Most changes made in this request are just ternary operators on templates and the addition of the "ports" parameter hash to init.pp

This Pull Request (PR) fixes the following issues

Adds feature: Allow modification of default ports for each service

Comment thread manifests/init.pp Outdated
$bantime = 432000,
$email = "fail2ban@${::domain}",
$jails = ['ssh', 'ssh-ddos'],
$jail_ports = {},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a datatype to the new parmeter.

Comment thread manifests/init.pp Outdated

validate_hash($config_file_hash)
validate_hash($config_file_options_hash)
validate_hash($jail_ports)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the validate_* method isn't needed when a datatype is used.

[sshd]
enabled = <%= scope['::fail2ban::jails'].include? "sshd" %>
port = ssh
port = <%= scope['::fail2ban::jail_ports'].key?('sshd') ? scope['::fail2ban::jail_ports']['sshd'] : 'ssh' %>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope method is deprecated, can you instead use this style or convert the template to epp?

Instead of using so many ternary statements we should use a defaults hash, merge that once with $jail_ports and afterwards directly access the hash in the templates

@bastelfreak bastelfreak added the needs-work not ready to merge just yet label May 17, 2018
@bastelfreak

Copy link
Copy Markdown
Member

HI @brunorro, thanks for the PR.Pleas:

  • Take a look at the inline comments
  • rebase
  • take a look at the used email address in the commits, it isn't associated with your github account

@vox-pupuli-tasks

Copy link
Copy Markdown

Dear @brunorro, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

@vox-pupuli-tasks

Copy link
Copy Markdown

Dear @brunorro, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflicts needs-work not ready to merge just yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants