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

[Feature Request] Add ability to allow by ip only #2

Open
Exidex opened this issue Mar 20, 2020 · 5 comments
Open

[Feature Request] Add ability to allow by ip only #2

Exidex opened this issue Mar 20, 2020 · 5 comments

Comments

@Exidex
Copy link

Exidex commented Mar 20, 2020

As per title this module lacks the ability to add firewall rules that allow by ip. Bash examples can be found here https://help.ubuntu.com/community/UFW in section Allow by Specific IP

Thanks for creating the module

@domkrm
Copy link
Owner

domkrm commented Mar 20, 2020

It's already implemented:

ufw::allow { 'ssh-from-trusted':
  port => '22',
  from => '10.0.0.1'
}

@Exidex
Copy link
Author

Exidex commented Mar 20, 2020

How do I do it for all ports? I mean there is no way to not specify port in your expression

@domkrm
Copy link
Owner

domkrm commented Mar 20, 2020

Ok, I understand.

Could you please try the following, but I don't know if this works:

ufw::allow { 'ssh-from-trusted':
  port => 'any',
  from => '10.0.0.1'
}

Otherwise I will add this ability to the module on monday.

@Exidex
Copy link
Author

Exidex commented Mar 20, 2020

[user@user-pc ~]$ sudo ufw allow from 10.0.0.1 to any port any
ERROR: Could not find protocol
[user@user-pc ~]$ sudo ufw allow from 10.0.0.1 to tcp port any
ERROR: Bad destination address

@cjonesau
Copy link

Ok, I understand.

Could you please try the following, but I don't know if this works:

ufw::allow { 'ssh-from-trusted':
  port => 'any',
  from => '10.0.0.1'
}

Otherwise I will add this ability to the module on monday.

When setting port => 'any'
You get an ERROR: Could not find protocol

Your module executes the rule as "sudo ufw allow from 10.0.0.1 to any port any", when it should be "sudo ufw allow from 10.0.0.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants