Repair config files if they are zero bytes#384
Open
UFOSmuggler wants to merge 1 commit intoMISP:masterfrom
Open
Repair config files if they are zero bytes#384UFOSmuggler wants to merge 1 commit intoMISP:masterfrom
UFOSmuggler wants to merge 1 commit intoMISP:masterfrom
Conversation
Contributor
Author
|
Turns out Security.salt does not do anything anymore, see MISP/support gitter convo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I did a dumb and truncated the config.php file on one of my test misps, and assumed that just bouncing the container would cause it to rebuild. However, instead all I got was a log of lots of errors.
Turns out we do tests of
[ -f /blah/config.php ]just to see if the file exists.We could instead test as
[ -s /blah/config.php ]which will test it exists and is not zero bytes.If the file does not exist or is zero bytes, we do the first run routine again to recreate them.
This PR contains that change for all /var/www/MISP/app/Config/ files.
Before change:
After change:
I also tested to see if the file was the same between rebuilds. It turns out if you do not statically set Security.salt (for which there is no envar to set), MISP makes you a new one, which is not ideal.
Still, everything in my test instance worked including auth, so I am unsure what Security.salt does at this point. I spent a few minutes looking through the code and I am not convinced it does anything.
For this reason I feel two ways about this PR, BUT you end up with more of your config than you did before you accidentally truncated it.
You could also obviously achieve the exact same effect this PR introduces by just deleting the truncated file.