Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michel-leonard/fw-simple-go
This project monitors specified files for changes and processes IP addresses as a firewall according to configuration rules.
https://github.com/michel-leonard/fw-simple-go
debian firewall golang inotify ipset iptables linux
Last synced: about 16 hours ago
JSON representation
This project monitors specified files for changes and processes IP addresses as a firewall according to configuration rules.
- Host: GitHub
- URL: https://github.com/michel-leonard/fw-simple-go
- Owner: michel-leonard
- License: other
- Created: 2024-07-18T10:39:58.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T10:50:04.000Z (4 months ago)
- Last Synced: 2024-10-13T17:41:50.078Z (about 1 month ago)
- Topics: debian, firewall, golang, inotify, ipset, iptables, linux
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Firewall
[ChatGPT](https://chatgpt.com) helped me.
## OverviewThis project monitors specified files for changes and processes IP addresses according to configuration rules. The software configures **ipset** and **iptables** if the configuration does not already exist. When a regular expression in the configuration file matches a new line in the log file, it captures the IP address and updates the ipset accordingly to :
- **accept** an IP
- **reject** an IP using, depending on the configuration, a bitmask and a timeoutThe default configuration works with IPv4 on a Debian server, iptables, ipset, and **inotify** must be installed beforehand.
## Configuration
Configuration is provided in a JSON file with the following structure:
````json
{
"firewall-name": "fw-simple",
"path-iptables-ipset": "/sbin:/usr/sbin",
"reject-timeout": 7200,
"reject-bitmask-length": 24,
"files": {
"/var/log/log-file-1": {
"accept": [ "regex accepting (__IP__) in file 1" ],
"reject": [ "regex rejecting (__IP__) in file 1"]
},
"/var/log/log-file-2": {
"accept": [ "regex accepting (__IP__) in file 2" ],
"reject": [ "regex rejecting (__IP__) in file 2"]
}
}
}