docker-misp icon indicating copy to clipboard operation
docker-misp copied to clipboard

Make every MISP setting customizable by environment variables.

Open garrit-schroeder opened this issue 4 years ago • 5 comments

the ngix entrypoint iterates over every suitable misp settings variable and parses the relevant arguments.

This pull quest allows the user to set every MISP config by environment variables. Every environment variable set must start with "M_S_" following by the misp setting. The value of the environment variable is the value set in MISP.

garrit-schroeder avatar Jan 28 '21 18:01 garrit-schroeder

What problem does this solve? What happens if an admin (not the person maintaining the server/roll out) makes a change in the UI? I assume this will over-write any changes?

I think I'd prefer this to be contained in INITIALIZE Env Flag block so it could be used to setup initially, but not force the configs after. The only things we force are things specific to deployment level. Configurations may be done by an application admin, not the deployment person.

coolacid avatar Feb 05 '21 01:02 coolacid

Changes will be overwritten. (If an administrator sets them in the first place. You always have the option to ignore this.) But wrapping this into the init block as well is fine with me.

garrit-schroeder avatar Feb 22 '21 12:02 garrit-schroeder

Well there are settings that can be changed by cake starting with MISP already. For example MISP.live=true. That's why I opted with M(isp)S(etting) And then the actual setting name and value.

garrit-schroeder avatar Feb 26 '21 22:02 garrit-schroeder

Well there are settings that can be changed by cake starting with MISP already. For example MISP.live=true. That's why I opted with M(isp)S(etting) And then the actual setting name and value.

In my opinion it is then better to write MISP__

The point is there exists a lot of settings some for modules, some for authentication, some for Redis, mail, etc....

If you have a .env file directly from name it should be clear which application, which location, what exact setting you mentioned here. I like the method of grafana docker environments https://grafana.com/docs/grafana/latest/administration/configuration/#configure-with-environment-variables

If you allow I will make some suggestions this weekend.

kind regards

8ear avatar Feb 27 '21 08:02 8ear

Hi, my proposal is to have the following: #97 Therefore your code should be modified like:

# iterate over every environment variable starting with "M_S_" and parsing it to key value pair to execute cake setting
    for var in $(env | grep MISP_MISP_); do
      setting_name="$(echo "$var" | sed "s/^MISP_MISP_//g" | sed "s/=.*$//g")"
      setting_value="$(echo "$var" | sed "s/^MISP_MISP_.*=//g")"
      $MISP_MISP_CAKE_FILE Admin setSetting "${setting_name}" "${setting_value}"
    done

But the environment variables should be added in uppercase so is it possible to modify your code that it convert it to the correct end format?

8ear avatar Feb 28 '21 18:02 8ear