Changelog - v2.3.0 (April 2025)
Key Features
- Advanced Whitelist Support: Added full support for CIDR notations (e.g.,
"10.0.0.0/8") in whitelist. - Emoji and Special Characters Handling: Fixed issues with rules containing emojis or Unicode characters that caused crashes.
- Debug Mode: Added debug mode to facilitate troubleshooting.
- Optimized Logging: More concise and informative log messages in normal mode.
- Critical Fixes: Fixed bugs that caused some alerts to be skipped during processing.
Technical Improvements
- Implemented
is_ip_in_whitelist()function to correctly handle all forms of whitelist entries (exact IPs, prefixes, CIDR). - Added
sanitize_text()function to remove emojis and special characters from messages. - Fixed double JSON parsing in
read_json(). - Replaced
breakwithcontinueto ensure all alerts are processed. - Improved logging system with categorization (
BLOCKED,UPDATED,ERROR). - Added full IPv6 support in whitelist management.
Bug Fixes
- Fixed the issue that prevented recognition of CIDR format subnets in the whitelist.
- Fixed a bug that caused failure to process multiple events in a single cycle.
- Fixed crashes during processing of PAW rules containing emojis.
Upgrade Instructions
-
Backup Existing Configurations
Backup all configuration files:sudo cp /usr/local/bin/mikrocataTZSP\*.py /usr/local/bin/mikrocataTZSP\*.py.bak sudo mkdir -p /var/lib/mikrocata/backup-$(date +%Y%m%d) sudo cp /var/lib/mikrocata/\* /var/lib/mikrocata/backup-$(date +%Y%m%d)/
-
Update Repository Files
cd /path/to/mikrocata2selks git pull -
Install New Files
sudo cp mikrocata.py /usr/local/bin/mikrocataTZSP0.py
Repeat for each instance if you have more than one Mikrotik router.
sudo chmod +x /usr/local/bin/mikrocataTZSP0.py
-
Transfer Previous Configurations
Open the backup file and the new one to manually copy your custom settings:sudo nano /usr/local/bin/mikrocataTZSP0.py.bak sudo nano /usr/local/bin/mikrocataTZSP0.py
Make sure to transfer all of the following settings:
- Mikrotik credentials (
USERNAME,PASSWORD,ROUTER_IP) - Telegram configuration
- Whitelist IPs
- SSL settings
- LISTEN_INTERFACE
- SELKS_CONTAINER_DATA_SURICATA_LOG
- Mikrotik credentials (
-
Restart Services
sudo systemctl restart mikrocataTZSP0.service
Repeat for each instance if you have more than one Mikrotik router.
-
Verify Operation
sudo journalctl -u mikrocataTZSP0.service -f
Important Notes for Upgrading
- Debug Mode: To activate debug mode for troubleshooting, set
DEBUG_MODE = Truein the file settings. - CIDR Whitelist: The new version supports CIDR notations (e.g.,
"10.0.0.0/8") in the whitelist. - IPv6 Compatibility: The whitelist management now works correctly for both IPv4 and IPv6.
What to Do in Case of Problems
If you encounter issues after upgrading:
- Check logs for any errors:
sudo journalctl -u mikrocataTZSP0.service -n 100
- Enable debug mode for more detailed logs:
Set
sudo nano /usr/local/bin/mikrocataTZSP0.py
DEBUG_MODE = Truesudo systemctl restart mikrocataTZSP0.service
- If necessary, restore the previous version:
sudo cp /usr/local/bin/mikrocataTZSP0.py.bak /usr/local/bin/mikrocataTZSP0.py sudo systemctl restart mikrocataTZSP0.service
- Report the issue on GitHub with relevant logs.