OPNsense Forum

English Forums => Development and Code Review => Topic started by: Lord_Pinhead on August 22, 2018, 04:23:55 pm

Title: Adding Rule after plugin installation
Post by: Lord_Pinhead on August 22, 2018, 04:23:55 pm
Hi,

i started with Opnsense and need 2 Services for my LAN. So i thought about creating an plugin for them.
The first one is check_mk with (x)inetd and the second is vlmcsd, and KMS Emulator for my lab installations.

So for both of them i need to add Rules to the specified Interfaces to allow certain traffic and i need in the second case an DNS Setting in DNSMasq.

Are there any code examples i could use? Or should i use the API for it, and if yes, i still need an example for it :-)

--
Lord_Pinhead
Title: Re: Adding Rule after plugin installation
Post by: fabian on August 22, 2018, 06:46:41 pm
the package for vlmcsd is very likely not in the repository but you can build it by hand (if your legal department says that it is ok - looks problematic in my opinion), check_mk probably is, inetd may be preinstalled.

If you want to create a plugin, you can find the instructions here: https://docs.opnsense.org/development/examples/helloworld.html (https://docs.opnsense.org/development/examples/helloworld.html)

The dnsmasq is not using the new components so you will not get access to it via the API but if you build your own plugin, you can design the API as you like.
Title: Re: Adding Rule after plugin installation
Post by: Lord_Pinhead on August 23, 2018, 08:03:38 am
I start with the helloworld example and check_mk. But still i need to open a Port on an Interface after the plugin was installed.
Adding the inetd entry is a new Action, that should not be a Problem.

vlmcsd is not a Problem for me, the Firewall is running in my own Office Environment and is for deploying a MS Lab Setup. MS even has a list of VL Keys in the MSDN for that reason.


Title: Re: Adding Rule after plugin installation
Post by: fabian on August 23, 2018, 05:12:07 pm
This will not work after the installation but after a firewall reload: https://github.com/opnsense/plugins/blob/master/net/frr/src/etc/inc/plugins.inc.d/frr.inc#L39

You may trigger a reload after the installation.