Added check and cleanup for stale Suricata PID file upon service startup #166
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.
An issue that I have run into is that at times the Suricata service will produce the following message in
suricata.log
:mpm-ac: Just ran out of space in the queue. Please file a bug report on this
. At this point the service will wait for a bit and attempt to restart the Suricata process inside the container. However, as Suricata has run before it leaves behind a (now) stale PID file under/usr/local/var/run/suricata/suricata.pid
which will cause Suricata to instantly exit:This will then repeat a few times until the container is killed for not starting, and the cycle repeats indefinitely. A potential fix I came up with during debugging, is that by removing the stale PID file Suricata will then correctly start.
From my own testing this appears to fix the startup issue with the Suricata service itself. I have run into a separate issue where the service doesn't appear to load any rules, but I have not been able to deduct whether this is due to my fix or a broader issues with our setup. The relevant error produced by the Suricata service is as follows:
The name
devsuricata
is the name of the self-built Suricata service using the standard Suricata service files + my own fix applied tosuricata_.py
.Feedback, improvements or critique are welcome!