Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@garrit-schroeder
Copy link

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.

@coolacid
Copy link
Owner

coolacid commented Feb 5, 2021

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.

@garrit-schroeder
Copy link
Author

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.

Copy link

@8ear 8ear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the env vars should start with M_S?
Should it be not better to start with MISP_?

Kind regards

@garrit-schroeder
Copy link
Author

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.

@8ear
Copy link

8ear commented Feb 27, 2021

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
Copy link

8ear commented Feb 28, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants