This is a Bash script for managing nftables
rules on an Ubuntu-based server. It provides an interactive menu for users to perform various operations, including configuring nftables
, adding or removing rules, saving configurations, and setting up DDoS protection.
- Manage nftables: Add, delete, flush, and display nftables rules.
- Whitelist and Block IPs: Option to whitelist specific IP addresses (typically used for SSH access).
- DDoS Protection: Implements basic DDoS protection by limiting incoming traffic.
- Save and Load Rules: Save the current nftables configuration and load it later.
- Service Management: Start, stop, and restart the nftables service.
- Add and Block Ports: Add or block specific ports.
- Port Forwarding: Set up port forwarding for specific IP addresses or ports.
- Advanced Options: Additional customization options for firewall settings and configuration.
curl -sLO https://raw.githubusercontent.com/Niihil/Ytiruces/main/Ytiruces && sudo bash Ytiruces
When the script runs, it will present an interactive menu with the following options:
- Wizard Nftable: Initializes basic
nftables
tables and chains. - WithList IP: Adds the current IP address to the whitelist (for SSH access or trusted addresses).
- Block IP: Blocks a specific IP address from accessing the server.3. **Display Rules: Displays the current
nftables
ruleset. - Display Rules: Displays the current rules in the nftables configuration.
- Add Rule: Adds a custom rule to
nftables
. - Delete Rule: Deletes a specified rule from
nftables
. - Flush Rules: Clears all
nftables
rules while preserving SSH connections. - Save Rules: Saves the current
nftables
configuration to a file and enables automatic loading on reboot. - DDoS Protection: Implements basic DDoS protection by limiting traffic.
- Open Port: Opens a specific port for inbound or outbound traffic.
- Block Port: Blocks a specified port.
- Load Conf File: Loads a configuration file to apply pre-defined nftables rules.
- Forwarding: Configures port forwarding to redirect traffic from one port to another or to a specific IP.
- Exit: Exits the script.
-
To add a rule:
- Select option 4 (Add Rule).
- Choose the chain (INPUT/OUTPUT/FORWARD).
- Choose the protocol (tcp/udp/icmp).
- Specify source and destination IP addresses.
- Enter the action (ACCEPT/DROP).
-
To whitelist your IP address:
- Select option 2 (Add With List Ip).
- Enter your current IP address.
-
To enable DDoS protection:
- Select option 9 (DDOS Protection).
- Root Privileges: The script requires root privileges to modify the
nftables
configuration and restart thenftables
service. - Debian-Only: The script is designed to run on Ubuntu-based systems (e.g., Ubuntu, Debian). It will exit if another OS is detected.