/Mikrotik-IP-Firewall-drop

Mikrotik IP Firewall Rules DAILY UPDATED!

Primary LanguagePHPMIT LicenseMIT

Mikrotik IP Firewall Updater

Mikrotik IP Firewall Updater can be considered a fork of my previous ipfirewall-updater

BLACKLISTS

Blacklists are updated daily, I will always try to improve them, optimize and add more sources, do not hesitate to open a pull request. If any of the blacklists is not mantained anymore it eventually will be removed.

vpn-proxy-tor.rsc includes the following blacklists:

blacklist.rsc includes the following ones for an optimal Firewall security:

I decided to make also a list DNS-Proxy.rsc in case you want to force users in your network to use your DNS Server such as AdguardHome, Pi-Hole, Windows Server etc. Just block those IPs on the ports 53, 443 and 853. This includes the following lists:

HOW TO INSTALL ON MIKROTIK

To use those lists on your Mikrotik device follow these steps:

  1. Open New Terminal and paste this script
/ip firewall filter
add action=drop chain=input comment="Drop new connections from blacklisted IP's to this router" connection-state=new in-interface=ether1 src-address-list=blacklist

or

/ip firewall filter
add action=drop chain=forward comment="Drop new connections from blacklisted IP's to this router" dst-address-list=blacklist
  1. Run in terminal the following commands and modify them accordingly with your preferred blacklist
# Download Script
/system script add name="BlacklistUpdater" source={/tool fetch url="https://raw.githubusercontent.com/NazgulCoder/Mikrotik-IP-Firewall/main/blacklist.txt" mode=https;
:delay 60
/import file-name=blacklist.txt;
}
 
# Script Scheduler
/system scheduler add comment="BlacklistUpdater" interval=1d \
name="BlacklistUpdater" on-event=DownloadBlacklist \
start-date=jan/01/1970 start-time=01:00:00

SELFHOSTED

To deploy this project you just need Apache or NGINX and PHP (I'm using 7.3, however 8.X version should be working as well)

Make sure you change your php.ini like this

allow_url_fopen=1

Make sure you have cURL enabled

You can change the lists as you prefer by adding/removing items from the array

(optional) You can configure the last part of the script to automatically push a Github commit to have your own lists always updated

FEATURES

  • Exports more than 20k entries in less than 5 sec (any free webhost works fine)
  • Simple usage, just open the .php page and the txt file will be exported, and eventually pushed to Github
  • All entries are sanitized for Mikrotik Syntax and duplicates are removed
  • You can automate it easily with cronjob, I use free webhost with cron-job.org

Why I made this?

Personal need since there is no project like this on the internet, at least not free. Don't get me wrong, I know there are people who make lists like I'm doing, but they do not release their tools to do so and to automatically commit updates to Github. With my project you can decide which lists add and remove, so you have 100% flexibility for your needs!

Why PHP?

  • Because you don't need a VPS - Dedicated Server to run it
  • Because a Free Webhost is enough
  • Because PHP is fun, easy and runs everywhere
  • Because PHP rocks

Donations

  • image bc1qvcr8nv6la58jp5y29s28dkrnr8v3ukn9tgztea
  • image 0xca834fbF25B32fB887aeb88FD28567c26e268200
  • image LKbqJPJeUHcWVPYkLGb14QsUm1ZvBvfzsM

LICENSE

MIT License

MIT License

Copyright (c) [2023] [NazgulCoder]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.