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

Add support for my use cases #170

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

kBite
Copy link
Contributor

@kBite kBite commented Jan 29, 2024

  1. some "idempotent" (non user-visible) changes

    • make parameters and headers more readable
      • it's opinionated, but pretty much inline with what other modules do
    • refactor defined type rule moving boilerplate to new function
    • simplify rule with some new data types
  2. add support for my use cases

    • add parameters outerface, daddr_type, saddr_type, and ctstate

Of course, everything comes with tests and documentation. I didn't add tests for the function though, because I'd consider it tested indirectly as part of tests done on rule.

EDIT: Tests are failing due to outdated REFERENCE.md. Can't find redcarpet right now. Tried ...

$ bundle exec gem install redcarpet
Fetching redcarpet-3.6.0.gem
Building native extensions. This could take a while...
Successfully installed redcarpet-3.6.0
1 gem installed

$ gem install --user redcarpet
Building native extensions. This could take a while...
Successfully installed redcarpet-3.6.0
Parsing documentation for redcarpet-3.6.0
Done installing documentation for redcarpet after 0 seconds
1 gem installed

$ gem install redcarpet
Building native extensions. This could take a while...
Successfully installed redcarpet-3.6.0
Parsing documentation for redcarpet-3.6.0
Done installing documentation for redcarpet after 0 seconds
1 gem installed

... but still:

$ bundle exec rake strings:generate
[error]: Missing 'redcarpet' gem for Markdown formatting. Install it with `gem install redcarpet`

Will dig deeper tomorrow.

@kBite kBite force-pushed the add-support-for-my-use-cases branch 2 times, most recently from 0c9b852 to c1a8056 Compare January 29, 2024 19:36
@smortex
Copy link
Member

smortex commented Jan 30, 2024

REFERENCE.md is outdated

Please update REFERENCE.md with

$ bundle exec rake strings:generate:reference

Add it to the PR and CI should continue.

align parameters of defined type 'rule'

align parameters in manifests/chain.pp

update header for better readability
If 'Ferm::Actions' is equal to some defined strings or any non-empty
string it's almost useless. For this reason the defined type 'rule' has
to reiterate testing against the same Enum to get useful information
from it.

'Ferm::Actions' is used in 'rule' and 'ipset'. The later does not seem
to require jumping.

update spec/type_aliases/actions_spec.rb
@kBite kBite force-pushed the add-support-for-my-use-cases branch from 1915369 to fe778fb Compare January 30, 2024 11:05
- Originally 'daddr' and 'saddr' were of data type 'Variant[Array, String[1]]'
- In case of Array code matched against 'Array[Stdlib::IP::Address]'

Keeping 'String[1]' for compatibility
replace single long line with heredoc
iptables syntax:
  ```
  -A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  ```

ferm syntax:
  ```
  table filter FORWARD outerface docker0 mod conntrack ctstate (ESTABLISHED RELATED) ACCEPT;
  ```
@kBite kBite force-pushed the add-support-for-my-use-cases branch from fe778fb to 8acfc06 Compare January 30, 2024 13:59
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

Successfully merging this pull request may close these issues.

None yet

3 participants