Page 1 of 1

Quickly clone firewall rules via API written in C.

Posted: Sun Jan 21, 2018 8:24 pm
by horhay
I have a need in my work to copy firewall rules from a master router to several dozen other routers. So I wrote this program.

It copies all firewall FILTER, MANGLE and ADDRESS-LIST entries from the hard coded "MASTER" router to the router specified on the command line.

I started with the C API from the wiki by webasdf. I fixed the memory management and added several other routines.

This might be a good example for someone looking to get into programming the API in C.

h0rhay

Re: Quickly clone firewall rules via API written in C.

Posted: Tue Jan 23, 2018 3:59 am
by dcowsill
Awesome work. That is some well-documented code.

Re: Quickly clone firewall rules via API written in C.

Posted: Fri Jan 26, 2018 6:30 pm
by horhay
I'm looking for a new project if anyone needs anything written using the API.

Re: Quickly clone firewall rules via API written in C.

Posted: Fri Jan 26, 2018 10:43 pm
by boen_robot
Have you considered simply making a generic, cross platform, full featured (ideally focused to ease of use for the developer) API client with bindings for various other languages (e.g. for a PHP extension, a Node module, an unmanaged .NET assembly, etc.)?

Current implementations aren't... that... so a new one that is would be awesome.

Re: Quickly clone firewall rules via API written in C.

Posted: Sat Jan 27, 2018 4:22 am
by horhay
Sorry. I'm just an old C programmer. Great idea but beyond my abilities. I'm hoping someone needs a program to login to a router and do something. Produce a report or change settings or check something and give a different return value so it can be used in bash scripts. Poll some parameter and dump it to a mysql database.