This projects aims to prevent access to your internal network from ip scanners and port scanners.
Prerequisites to work:
- A Routerboard device (or RouterOS installed on any device) acting as a firewall for your internal network
- An available linux PC (or server)
- /ip firewall filter : add your allow rules first and after that drop any connection from outside example:
- Before any other rule in filter add : chain=forward action=drop src-address-list=attackers dst-address-list=internal
- Before rule 100 add : chain=forward action=log connection-state=new protocol=tcp dst-address-list=internal dst-port=20-35,445,1433,1521,1524,1526,1812,2082,2483,2484,3306,3872 log-prefix="Service Scanner x:" (You can add any ports you want for attacker detection.)
- Add a new remote logging target at ROS device : /system logging action add name="remotelog" remote=192.168.1.100 remote-port=5555 bsd-syslog=yes target=remote syslog-facility=23 syslog-severity=6
- Add a new logging /system logging add action=remotelog topics=firewall
- Checkout source code to your linux machine
- Compile with : g++ main.cpp attackleases.cpp configfilereader.cpp connection.cpp -o gkmtfirewall -lpthread -lssh
- Move the executable to /usr/sbin/.
- Edit contents of gkmtfirewall.conf to adapt your needs
- Move gkmtfirewall.conf to /etc/gkmtfirewall.conf
- Move gkmtfirewall.init to /etc/init.d/gkmtfirewall
- Change permissions of /etc/init.d/gkmtfirewall to 755
- Type /etc/init.d/gkmtfirewall start to start the program
- Take a look at syslog to determine possible problems
1)chain=forward action=accept connection-state=related2)chain=input action=accept connection-state=established3)chain=input action=accept connection-state=related4)chain=forward action=accept connection-state=new src-address-list=internal5)chain=forward action=accept protocol=tcp dst-address=192.168.1.10 dst-port=806)chain=forward action=accept protocol=tcp dst-address=192.168.1.11 dst-port=257)chain=forward action=accept protocol=tcp dst-address=192.168.1.11 dst-port=1108)chain=forward action=accept protocol=tcp dst-address=192.168.1.11 dst-port=143 . . . 100)chain=forward action=drop dst-address-list=internal
0 komentar:
Post a Comment