Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring salt via environment variable #16417

Closed
james-callahan opened this issue Sep 10, 2020 · 8 comments
Closed

Allow configuring salt via environment variable #16417

james-callahan opened this issue Sep 10, 2020 · 8 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@james-callahan
Copy link

As far as I can tell, an installation of matomo should have the same salt forever (and across multiple running instances). Please correct me if wrong.

If so, it seems odd that the salt is not configurable via environment variable (#13676). Could this feature be added? e.g. MATOMO_SALT.

@tsteur
Copy link
Member

tsteur commented Sep 10, 2020

Hi @james-callahan this should be possible using https://plugins.matomo.org/EnvironmentVariables Let me know if that doesn't work.

@tsteur tsteur closed this as completed Sep 10, 2020
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Sep 10, 2020
@james-callahan
Copy link
Author

Let me know if that doesn't work.

It didn't work: when using MATOMO_GENERAL_SALT it generated a new salt.

@tsteur
Copy link
Member

tsteur commented Sep 10, 2020

@james-callahan I suppose the server is restarted and everything? How did you check the value was not used? Cause the config file itself might still show the old value but the value is actually applied

@james-callahan
Copy link
Author

@james-callahan I suppose the server is restarted and everything? How did you check the value was not used? Cause the config file itself might still show the old value but the value is actually applied

Yes I'm running inside of docker: I killed the container and recreated it (allowing matomo to generate a new config.php.ini)
Once it started I cat'd the file and saw the salt was not equal to the one in my env var.

@james-callahan
Copy link
Author

@tsteur how can I check what matomo is using as the current salt?

@tsteur
Copy link
Member

tsteur commented Sep 10, 2020

That's a great question @james-callahan . Because the salt is anonymised in our diagnostics config screen in our Admin section for security reasons it's actually not that easy. Created for now matomo-org/plugin-EnvironmentVariables#8
image

The only thing I could think of right now would be to trigger an action that would force the update of the config file in which case the salt from the environment variable would be written to disc.

  • You could log in as a super user
  • Go to admin section (cog icon in top right)
  • Go to "General settings"
  • In the section "Trusted Matomo Hostname" temporarily add a new hostname
  • Click save
  • Check if the salt was updated.

I haven't tested this but thinking this procedure should work. Let me know.

image

@james-callahan
Copy link
Author

  • In the section "Trusted Matomo Hostname" temporarily add a new hostname

  • Click save

  • Check if the salt was updated.

Yep that seems to have worked; thanks!
Should there be an easier way to check this?

@tsteur
Copy link
Member

tsteur commented Sep 11, 2020

Yes definitely. there should be an easier way. That's why I created matomo-org/plugin-EnvironmentVariables#8 so it hopefully will help with this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants