nftables | Ansible role to manage Nftables rules and packages | Firewall library

 by   ipr-cnrs HTML Version: Current License: No License

kandi X-RAY | nftables Summary

kandi X-RAY | nftables Summary

nftables is a HTML library typically used in Security, Firewall, Ansible applications. nftables has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A role to manage Nftables rules and packages. Highly inspired by Mike Gleason firewall role (3 levels of rules definition and template), thanks ! I hope i haven't complexify his philosophy… (I'm pretty sure, i now did complexify it :D) ^^.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              nftables has a low active ecosystem.
              It has 50 star(s) with 11 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 4 have been closed. On average issues are closed in 97 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of nftables is current.

            kandi-Quality Quality

              nftables has 0 bugs and 0 code smells.

            kandi-Security Security

              nftables has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              nftables code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              nftables does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              nftables releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of nftables
            Get all kandi verified functions for this library.

            nftables Key Features

            No Key Features are available at this moment for nftables.

            nftables Examples and Code Snippets

            No Code Snippets are available at this moment for nftables.

            Community Discussions

            QUESTION

            nftables: "ipsec in reqid" raises "Can't process rule error"
            Asked 2022-Mar-01 at 20:11

            I'm trying to add an IPSec-related rule to my router:

            ...

            ANSWER

            Answered 2022-Mar-01 at 20:11

            Just in case someone runs into the same problem: I recompiled the Raspbian kernel, and enabled all XFRM and nftables-realted options, some of which used to be disabled beforehand. The rule is working fine now.

            Source https://stackoverflow.com/questions/71287699

            QUESTION

            How to grep or awk string in non fixed position
            Asked 2022-Feb-04 at 19:39

            I didn't find similar solution, apart from parsing multiple arguments which is a whole script by it self.
            I need to get handle # from nftables for the script, and having problems because it is not always located on the same position. With Iptables it was line number which was always listed on the first field so was very easy to capture insert position. when I do: nft -n -a list chain inet fw4 forward output would be something like this:

            ...

            ANSWER

            Answered 2022-Feb-02 at 14:47

            You could check if the line contains 192.168.0.0 and then get a match if the handle part can be anywhere in the line.

            After the first match remove the leading handle using substr and exit the program.

            For example, if the example data is in file

            Source https://stackoverflow.com/questions/70956527

            QUESTION

            What is the dot (.) in an Nftables rule
            Asked 2021-Dec-16 at 06:41

            In many nftables examples, I sometimes see statement like this:

            ...

            ANSWER

            Answered 2021-Dec-16 at 06:41

            Concatenation

            There's some more details about it in the wiki

            Source https://stackoverflow.com/questions/70374788

            QUESTION

            Add nftables map element using libnftables-json API from python
            Asked 2021-Dec-06 at 01:04

            I am trying to dynamically add a map element using the nftables JSON API from python. In my firewall I have the following map in the router table in the ip family:

            ...

            ANSWER

            Answered 2021-Dec-06 at 01:04

            It turns out that the "elem" property takes the array directly instead of being wrapped in a "set" object. This was hinted at by the error:

            Source https://stackoverflow.com/questions/70239480

            QUESTION

            How to add NAPT/PAT rule?
            Asked 2021-Nov-16 at 08:38

            My goal is to forward packets from an interface to another interface without source port conflicts using the right feature, NAPT.

            I couldn't find how to add a NAPT rule (Network Address Port Translation or also known as PAT) with iptables and nftables.

            More interestingly, searching combinations of PAT NAPT iptables/nftables/netfilter doesn't give anything relevant. Even when they mention PAT/NAPT, they do a simple IP masquerading...

            Edit

            It seems iptables's NAT does implicit port translation... somehow it's obvious for everybody even though it isn't written anywhere. The definition of NAT is however pretty clear and doesn't include a layer 4 alteration. Whatever...

            ...

            ANSWER

            Answered 2021-Nov-16 at 08:29

            By using iptables, masquerade is a choice but may not fullfill your goals. The better method is to extend netfilter and iptables by writing your own iptable operation. I do this some years before, here is my github code, hope that can help you.

            Source https://stackoverflow.com/questions/69964616

            QUESTION

            Rule management in nftables
            Asked 2021-Oct-12 at 07:37

            I get the ports as a variable and I need to delete the rule in nftables. If the port is present in rule then i would grep the handle number and delete the rule. But in nftables service name would be present in rule so how can I delete the rule. Is there any way to find the what port belongs to service or any other way to delete the nftable rule other than handle or any other suggestions ??

            ...

            ANSWER

            Answered 2021-Oct-12 at 07:37

            Ports and service name are listed in /etc/services.

            You can force the listing to use numeric ports by

            Source https://stackoverflow.com/questions/69386303

            QUESTION

            How can I use the Python nftables library in a virtual environment?
            Asked 2021-Sep-13 at 20:59

            Debian has a package called python3-nftables. You can install it with apt. It lets you interact with nftables (the modern iptables replacement).

            Normally, when apt has a Python library, the library can also be found on pypi.org, which means the library can be included in a requirements.txt file, and be installed along with any other Python libraries when the virtual environment is being set up. Unfortunately, as far as I can tell, this package is not available on pypi.org.

            If I install it with apt, and run python3, I can import nftables. Great. The problem is that when you enter a virtual environment and try the same thing - import nftables, it won't be found, because by default, the virtual environment ignores any system libraries installed with apt.

            You can, of course, tell it to include those with --system-site-packages when creating the virtual environment, but there's a reason this isn't enabled by default.

            After installing python3-nftables with apt, I can also copy the package (/usr/lib/python3/dist-packages/nftables) directly into my project folder, and include it in my project's git repo. That works, but seems a bit hackey.

            Is there a proper way to install the nftables library inside of the virtual environment, instead of installing it system-wide, and forcing the virtual environment to see it?

            ...

            ANSWER

            Answered 2021-Sep-13 at 20:59

            QUESTION

            python module not found after executing shell script even though the module is installed
            Asked 2021-Aug-20 at 18:37
            pip3 list
            Package             Version
            ------------------- ------------
            apipkg              1.5
            apparmor            3.0.3
            appdirs             1.4.4
            asn1crypto          1.4.0
            brotlipy            0.7.0
            certifi             2021.5.30
            cffi                1.14.6
            chardet             4.0.0
            cmdln               2.0.0
            configobj           5.0.6
            createrepo-c        0.17.3
            cryptography        3.3.2
            cssselect           1.1.0
            cupshelpers         1.0
            cycler              0.10.0
            decorator           5.0.9
            idna                3.2
            iniconfig           0.0.0
            isc                 2.0
            joblib              1.0.1
            kiwisolver          1.3.1
            LibAppArmor         3.0.3
            lxml                4.6.3
            matplotlib          3.4.3
            mysqlclient         2.0.3
            nftables            0.1
            notify2             0.3.1
            numpy               1.21.1
            opi                 2.1.1
            ordered-set         3.1.1
            packaging           20.9
            pandas              1.3.1
            Pillow              8.3.1
            pip                 20.2.4
            ply                 3.11
            psutil              5.8.0
            py                  1.10.0
            pyasn1              0.4.8
            pycairo             1.20.1
            pycparser           2.20
            pycups              2.0.1
            pycurl              7.43.0.6
            PyGObject           3.40.1
            pyOpenSSL           20.0.1
            pyparsing           2.4.7
            pysmbc              1.0.23
            PySocks             1.7.1
            python-dateutil     2.8.2
            python-linux-procfs 0.6
            pytz                2021.1
            pyudev              0.22.0
            requests            2.25.1
            rpm                 4.16.1.3
            scikit-learn        0.24.2
            scipy               1.7.1
            setuptools          57.4.0
            six                 1.16.0
            sklearn             0.0
            slip                0.6.5
            slip.dbus           0.6.5
            termcolor           1.1.0
            threadpoolctl       2.2.0
            torch               1.9.0+cu111
            torchaudio          0.9.0
            torchvision         0.10.0+cu111
            tqdm                4.62.1
            typing-extensions   3.10.0.0
            urllib3             1.26.6
            
            ...

            ANSWER

            Answered 2021-Aug-20 at 18:37

            It is very likely that pip3 is pointing to a different python instance.

            Imagine you had python, python3, python3.6 and python3.8 all installed on your system. Which one would pip3 install packages for? (who knows?)

            It is almost always safer to do python3.8 -m pip list/install since you can be sure that python3.8 somefile.py will be using the same files you just saw. (even better, do python3.8 -m venv /path/to/some/virtualenv and then make sure that is activated, then you can be sure pip points to the same python)

            Source https://stackoverflow.com/questions/68866686

            QUESTION

            Ingress unable to reach one node after reboot, others are okay
            Asked 2021-Aug-11 at 21:42

            I have a cluster with 4 nodes (3 raspi, 1 NUC) and have setup several different workloads. The cluster itself worked perfectly fine, so I doubt that it is a general problem with the configuration. After a reboot of all nodes the cluster came back up well and all pods are running without issues. Unfortunately, pods that are running on one of my nodes (NUC) are not reachable via ingress anymore. If I access them through kube-proxy, I can see that the pods itself run fine and the http services behave as exptected. I upgraded the NUC node from Ubuntu 20.10 from 21.04, which may be related to the issues, but is not confirmed.

            When the same pods are scheduled to the other nodes everything works as expected. For pods on the NUC node, I see the following in the ingress-controller logs:

            ...

            ANSWER

            Answered 2021-Aug-11 at 21:42

            Updating flannel from 13.1-rc2 to 14.0 seems to have done the trick. Maybe some of the iptables rules were screwed and got revreated, maybe 14.0 is necessary to work with 21.04? Who knows... I'm back up running fine and happy :)

            Source https://stackoverflow.com/questions/68709974

            QUESTION

            nftables rules for docker
            Asked 2021-Jul-12 at 08:36

            System : RHEL 8.4 Docker Version : 20.10

            RHEL 8 has moved from iptables to nftables and Docker inbuild uses iptables to set firewall rules on the machine.

            It seems to have break the communication from docker containers to host services, and also to other hosted docker containers on the same network.

            I have to communicate to registry hosted in container on port 5000.

            And also I am hosting impala services in container and opened exposed following ports

            21000

            21050

            25000

            25010

            25020

            Also when i logged in to container it cannot make contact to internet.

            Does anyone know what rules can be set to make proper communications to docker. Also the service hosted in container must be able to contact all the related host services.

            Things tried until now :

            Made changes in /etc/docker/daemon.json

            ...

            ANSWER

            Answered 2021-Jul-12 at 08:36

            From Docker 20.10, Docker provides support for firewalld, and no need to add any rules manually.

            It resolved my issues related to iptables and efatbles

            Source https://stackoverflow.com/questions/68163038

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install nftables

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ipr-cnrs/nftables.git

          • CLI

            gh repo clone ipr-cnrs/nftables

          • sshUrl

            git@github.com:ipr-cnrs/nftables.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Firewall Libraries

            opensnitch

            by evilsocket

            fail2ban

            by fail2ban

            TheFatRat

            by screetsec

            TheFatRat

            by Screetsec

            ModSecurity

            by SpiderLabs

            Try Top Libraries by ipr-cnrs

            fusioninventory

            by ipr-cnrsHTML

            xymon

            by ipr-cnrsShell

            glpi-agent

            by ipr-cnrsShell