{"id":27779899,"url":"https://github.com/alessgorgo/ufwruler","last_synced_at":"2026-04-30T02:33:31.808Z","repository":{"id":290096570,"uuid":"973362020","full_name":"alessgorgo/UfwRuler","owner":"alessgorgo","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-26T20:33:48.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T10:56:16.435Z","etag":null,"topics":["bash","rules","shell","ufw","ufw-firewall","ufw-rules"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alessgorgo.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,"zenodo":null}},"created_at":"2025-04-26T20:26:52.000Z","updated_at":"2025-04-26T20:33:51.000Z","dependencies_parsed_at":"2025-04-26T21:37:17.583Z","dependency_job_id":null,"html_url":"https://github.com/alessgorgo/UfwRuler","commit_stats":null,"previous_names":["alessgorgo/ufwruler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alessgorgo/UfwRuler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessgorgo%2FUfwRuler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessgorgo%2FUfwRuler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessgorgo%2FUfwRuler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessgorgo%2FUfwRuler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessgorgo","download_url":"https://codeload.github.com/alessgorgo/UfwRuler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessgorgo%2FUfwRuler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261931390,"owners_count":23232072,"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":["bash","rules","shell","ufw","ufw-firewall","ufw-rules"],"created_at":"2025-04-30T10:56:05.349Z","updated_at":"2026-04-30T02:33:31.778Z","avatar_url":"https://github.com/alessgorgo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 📖 Documentation\n\n---\n\n## 📋 Project Overview\n\n**UfwRuler** is a lightweight terminal-based utility that helps you manage your server's firewall rules using `ufw` (Uncomplicated Firewall).  \nIt features:\n\n- A simple **terminal UI** using `dialog`.\n    \n- **Templates** for quickly setting up firewall rules for common server types (SMTP, SFTP, etc.).\n    \n- **Default rules** to ensure basic server security.\n    \n- A **Composer** script for easy installation and setup.\n    \n\n---\n\n## 🏗️ Project Structure\n\n```\nUfwRuler/\n├── composer.sh            # First-time setup script (installs packages, sets permissions)\n├── setup.sh               # Main interactive script (firewall manager)\n├── packages/\n│   └── requirements.txt   # List of required system packages (e.g., dialog, ufw)\n└── templates/\n    ├── smtp-rules.sh      # SMTP-specific firewall rules\n    ├── sftp-rules.sh      # SFTP-specific firewall rules\n    └── ...other templates\n```\n\n---\n\n## 🚀 Quickstart Guide\n\n1. **Clone or Download the UfwRuler folder.**\n    \n2. **Move UfwRuler to your server's `/opt/` directory.**  \n    (recommended for clean system management)\n    \n    ```bash\n    sudo mkdir -p /opt/UfwRuler\n    sudo cp -r ./UfwRuler /opt/\n    cd /opt/UfwRuler\n    ```\n    \n3. **Run the Composer to install required packages and set up the environment.**\n    \n    ```bash\n    chmod +x composer.sh\n    ./composer.sh\n    ```\n    \n4. **Follow the prompts to launch UfwRuler!**\n    \n\n---\n\n## ⚙️ Features and Options\n\nWhen you run `setup.sh`, you will be greeted with a **menu**:\n\n|Option|Description|\n|---|---|\n|Set Default UFW Rules|Sets secure defaults (deny incoming, allow outgoing, SSH open)|\n|Apply Service Template|Choose a template (e.g., SMTP, SFTP) to auto-apply firewall rules|\n|Show UFW Status|View the current status and open ports|\n|Enable UFW|Enable the firewall if not already active|\n|Disable UFW|Disable the firewall|\n|Exit|Exit UfwRuler|\n\n---\n\n## 📜 Templates Usage\n\nTemplates are simple `.sh` scripts inside the `templates/` folder.  \nEach template defines firewall rules for specific server roles.\n\n**Example: `smtp-rules.sh`**\n\n```bash\n#!/bin/bash\nsudo ufw allow 25/tcp\nsudo ufw allow 587/tcp\nsudo ufw allow 465/tcp\necho \"SMTP rules applied.\"\n```\n\nYou can easily add your own custom templates!  \nJust create a new `.sh` file inside the `templates/` folder following the same style.\n\n---\n\n## 🔒 Default Firewall Setup\n\nWhen you choose **Set Default UFW Rules**, the following actions are performed:\n\n- Deny all **incoming** traffic.\n    \n- Allow all **outgoing** traffic.\n    \n- Allow incoming **SSH** (port 22).\n    \n\nThis ensures that:\n\n✅ Your server is reachable for management.  \n✅ Unwanted external connections are blocked by default.\n\n---\n\n## 📦 Requirements\n\nUfwRuler needs:\n\n- `ufw`\n    \n- `dialog`\n    \n\nThese are automatically installed when you run `composer.sh`.\n\n---\n\n## 🛠️ Tips\n\n- **Want faster access?** Add an alias:\n    \n    ```bash\n    echo \"alias ufwruler='/opt/UfwRuler/setup.sh'\" \u003e\u003e ~/.bashrc\n    source ~/.bashrc\n    ```\n    \n    Then you can just type:\n    \n    ```bash\n    ufwruler\n    ```\n    \n- **Always reload UFW** after making manual changes:\n    \n    ```bash\n    sudo ufw reload\n    ```\n    \n\n---\n\n## ❓ FAQ\n\n**Q: Can I create my own service templates?**  \n**A:** Yes! Just create a new `.sh` file inside `templates/`, and use `sudo ufw allow` or `sudo ufw deny` commands.\n\n---\n\n**Q: What happens if I enable UFW without any rules?**  \n**A:** UfwRuler always ensures at least SSH (port 22) is open by default, so you don't lock yourself out.\n\n---\n\n**Q: Can I uninstall UfwRuler?**  \n**A:** Just delete the `/opt/UfwRuler/` folder:\n\n```bash\nsudo rm -rf /opt/UfwRuler\n```\n\nIf you added an alias, remove it manually from your `.bashrc`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessgorgo%2Fufwruler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessgorgo%2Fufwruler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessgorgo%2Fufwruler/lists"}