-
Notifications
You must be signed in to change notification settings - Fork 33
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
Rule API #17
Comments
I think it's a good idea to unify the interface, as long as it makes sense. Using a define is a good idea, and I also guess that multiple ports should be possible. Then one can choose to instantiate it once or multiple times for multiple ports. |
The reason is more historically:
Anyway, what I fear with a unique interface is, that we just have many defines, that exactly does the same (what would be the difference between ssh and http in the end? not much that I see, except the default port(s), which is mostly already the case. And on the other hand we would loose to include possibility if we move it to a define. What is the advantage of a define? And what would we do with double rules? E.g. both opening port 80? Just coming up with some questions, not necessary, that they are important. |
I fully agree that there is not much difference between the ssh and http classes in the end. IMHO, the main question is who would use such classes. Only internally (via Will end users rather use I like very much the This set API is similar to the puppetlabs-firewall rule API:
We could imagine the same kind of API for |
Other modules will definitely use them, since e.g. an apache module just want to have http(s) opened and done. But we can definitely rather advocate to use more the |
I like the idea of seeing classes in the I agree though that perhaps it makes sense indeed to make the interface homogenous across rule classes, where it makes sense. For instance, I don't see the point in allowing the user to customise the ports in |
Giving it another thought, perhaps it does not even make sense to allow customising ports for the rules pre-encapsulated in classes. I personally see classes in On the other hand, if I wanted to run a http daemon on a non-standard port I'd use That's my point of view of course. |
IMHO, there are two different decisions to be made here. First, do we improve the Second, what to do with Note: |
My opinion:
I wouldn't do anything. It's not just adding parameters but adding validation to make sure that the combination can be translated into the syntax of the rules. More complex maintainability and testing for maybe a low gain. Perhaps a
Basically, https://github.com/duritong/puppet-nftables/issues/17#issuecomment-733047927. No ports but perhaps a common parameter to enable counters sounds like a sweet spot :) Anything beyond basic functionality that we can easily encapsulate (like log rules) should be left to the user who can always do complex and custom stuff with Just my 2 cents. |
In addition to For instance for
one can use:
This assumes a |
I think it's a good idea to add logging for certain rules, but I think it should be optionally. |
It's true that with.
there has allways been parameters missing or not quite correct. Having said that I like the Validation is so much better and easier in puppet these days that its easy to do something that is useful. |
Another option perhaps is another module that really does try to support the abstraction of nftables, iptables, .... |
I fully agree that a 100% coverage of all the possible What I have in mind is a reduced API for a subset of all the possible rules since we can always give the complete rule line as a string when needed What is the minimum API that would be needed to cover, for instance, 90% of all the rules used in realistic scenarios? Let's take for instance an API with the following parameters: |
If we agreed on a simple interface like the one proposed by Lionel, kind of covering simple uses of the |
IMHO |
I've written a simple PoC and sent is as a merge request so we can discuss a bit about the interface, etc. It misses parameters of course :) It does not take into account your latest comment, @keachi. I'd be happy to focus only on |
I am absolutely fine with multiple interfaces covering different aspects (inet vs. NAT). We don't need one to rule them all, for that we can pass in the rule string. And if folks are seeing to repeat themselves with certain interfaces, they will come up with (another) abstraction layer, which is fine. Keeping the single interface simple and focused is much more important. |
This is not to report a bug but to trigger a discussion on the rule API.
Looking at
http
versusssh
, we see that the API is not consistent. Withhttp
, one can only allow a single http server running on a fixed port. Withssh
, one can allow multiple ssh servers on any ports (thanks to theports
parameter). It would probably be good to have a common set of parameters (like the one to change the port) for all the service specific rules. Note:ssh
currently usesports
whilemasquerade
usesdport
.Also,
nftables::rules::http
is a class whilenftables::rule
is a defined type. So one cannot instantiatenftables::rules::http
multiple times, as it would be natural to do to declare multiple http servers.So, changing to a defined type and adding parameters, one could declare multiple http servers this way:
When using
nftables
features like comments or counter or logging (i.e.log prefix
), it could make sense to have multiple individual rules instead of a single rule with multiple ports. This would provide more flexibility.Comments?
The text was updated successfully, but these errors were encountered: