mushorg / conpot

ICS/SCADA honeypot
GNU General Public License v2.0
1.24k stars 414 forks source link

Creating a standardized template directory specification #174

Closed creolis closed 10 years ago

creolis commented 10 years ago

This addresses our configuration mess, all together with #152 and #109.

I propose the following file system structure for templates (example listing: see below).

We place a folder into the root templates directory - the name of the folder is the name of the template: This is our template root.

The template root contains a generic template.xml which holds "common" configurations used by all protocols, e.g. databus settings. Each protocol we enable gets its own directory there too - which is our "protocol root".

The protocol root contains a dedicated template.xml with protocol specific settings, as well as directories and files that comes along with them (html files, binaries, certificates, you name it..).

I agree that this will not fully satisfy Lukas as he tries to get away from XML where I split templates into many of them ;-) But the advantages of this approach would be:

  1. Protocol configurations are self-contained and can be exchanged between different templates
  2. A template can be provided as zip / tar.gz file and easily be extracted into the template root.
  3. A single hint to the desired template on startup will be enough for the user, e.g. "conpot simatic-plc-1516" - no more mib and www paths, etc.
  4. If no template is specified, we can look what folders are residing in the template root and let the user choose a template from this list.

Users would love the "easier" way of interacting with conpot, we will take advantage from a more structured approach since you always know what configuration is located where.

Basic configuration like logging, hpfeeds etc. stays in default conpot.cfg since this will not change when another template is used.

Here is a quick overview of the directory structure example:

Any comments except from "Do it already!!!!" ? :-)

johnnykv commented 10 years ago

i like it, especially that it becomes easy to package up a template and ship it...

glaslos commented 10 years ago

This sounds very good Daniel. I think this is one of the features we as developers like to forget about as we already understand how to use Conpot. :thumbsup:

glaslos commented 10 years ago

Do you need any additional help with this?

creolis commented 10 years ago

No, I'm good, thanks :) Gotta think this through again to be sure I didn't forget something, but I want to get this done before Brucon :)

creolis commented 10 years ago

@johnnykv: Almost everything seems to be okay now, if you have some spare time, would you do some basic testing on branch new_template_structure?

Unittests work well, but there seems to be some custom XML sanity checking in place that still tries to take care of the central template file (which is gone :).

Latest build report: https://travis-ci.org/glastopf/conpot/builds/36822407

johnnykv commented 10 years ago

Yeah, i will take a look at one of the comming days, np.

creolis commented 10 years ago

Solved with #180