{"id":16606925,"url":"https://github.com/k4yt3x/nftables","last_synced_at":"2025-10-29T16:30:21.219Z","repository":{"id":106313243,"uuid":"305815448","full_name":"k4yt3x/nftables","owner":"k4yt3x","description":"K4YT3X's template nftables script.","archived":false,"fork":false,"pushed_at":"2024-11-07T23:20:59.000Z","size":18,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-02T02:41:28.421Z","etag":null,"topics":["firewall","linux","nft","nftables","security"],"latest_commit_sha":null,"homepage":"https://k4t.io/nft","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k4yt3x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-20T19:40:07.000Z","updated_at":"2024-11-28T10:01:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2157b6a-1211-45d5-9210-ceb52e67c438","html_url":"https://github.com/k4yt3x/nftables","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fnftables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fnftables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fnftables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4yt3x%2Fnftables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k4yt3x","download_url":"https://codeload.github.com/k4yt3x/nftables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238848272,"owners_count":19540854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firewall","linux","nft","nftables","security"],"created_at":"2024-10-12T01:10:45.954Z","updated_at":"2025-10-29T16:30:15.915Z","avatar_url":"https://github.com/k4yt3x.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# K4YT3X's Template nftables Script\n\nThis repository hosts my personal `nftables.conf` script. This file is intended to be used as a template for creating nftables profiles for hosts. The default settings in this script are suitable for endpoint devices (e.g., workstations). This configuration file is also compliant with [RFC4890](https://tools.ietf.org/html/rfc4890). Below is an abstract of what is allowed in the profile by default.\n\n- **IPv4**\n  - Established/related segments accepted\n  - DHCP accepted\n  - ICMP necessary debugging types accepted\n- **IPv6**\n  - Established/related segments accepted\n  - DHCPv6 accepted\n  - ICMPv6 types in [RFC4890](https://tools.ietf.org/html/rfc4890) accepted\n\n**Please review the script file carefully before applying it.** You are responsible for actions done to your system.\n\n## Applying Template Rules\n\nYou may run this script with the `nft` command to load the rules in this profile. You can also install this profile to the system, so the `nftables.service` will automatically load this profile upon service restart or reboot. If you would like to load this configuration once, simply run `nft -f nftables.conf` or `./nftables.conf`. If you would like to make the changes persist after a reboot, you will have to overwrite contents of the `nftables.conf` which the `nftables.service` reads rules from. The location of this file varies depending on your distribution. Below are some examples.\n\n- CentOS/RHEL: `/etc/sysconfig/nftables.conf`\n- Debian: `/etc/nftables.conf`\n\nAfter editing the files, run the appropriate command to restart the nftables service to apply the rules (e.g., `systemctl restart nftables`). Once you finish loading the rules, you can verify the changes using the command `nft list ruleset`.\n\n## Opening Ports\n\nThis script provides a convenient way of opening ports. In order to open ports, you only need to edit the `ACCEPT_TCP_PORTS` variable and the `ACCEPT_UDP_PORTS` variable. You will find these two variables at the beginning of the script.\n\n```properties\n# TCP ports to accept (both IPv4 and IPv6)\n#define ACCEPT_TCP_PORTS = {}\n\n# UDP ports to accept (both IPv4 and IPv6)\n#define ACCEPT_UDP_PORTS = {}\n```\n\nTo open a port, uncomment the corresponding line and add the comma-separated list of ports into the brackets at the end of the line. The example below opens TCP ports 22 and 80 and UDP port 53.\n\n```properties\n# TCP ports to accept (both IPv4 and IPv6)\ndefine ACCEPT_TCP_PORTS = { 22, 80 }\n\n# UDP ports to accept (both IPv4 and IPv6)\ndefine ACCEPT_UDP_PORTS = { 53 }\n```\n\nDo not forget to reload `nftables.service` to apply the changes after finish editing the script file.\n\n## Short URL for Downloading `nftables.conf`\n\nFor convenience, I have pointed the URL `https://kt.ax/nft` to the `nftables.conf` file. You may therefore download the `nftables.conf` file with the following command. However, be sure to check the file's integrity after downloading it if you choose to download using this method.\n\n```shell\ncurl -L kt.ax/nft -o nftables.conf\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4yt3x%2Fnftables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk4yt3x%2Fnftables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4yt3x%2Fnftables/lists"}