-
Notifications
You must be signed in to change notification settings - Fork 41
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
Upgrade ELK stack to v8.x #75
Conversation
Upgrades to v7.17 before v8.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finished reading through the changes. Here's what I found on this first pass:
- I believe there is a bug where BeatsVersion is not passed to the agent install script when the script is started as a normal user.
- The way we've been calling
curl
to interact with Elastic/ Kibana is insecure. There is a better way to run the command which will prevent leaking the credentials to normal users. - We need to ensure
python3
is available on the host system inshell-lib
if we want to use a python script on the Docker host. Alternatively, we could find a way to runcheck_kibana.py
in a Docker container. There may be other workarounds we could pursue such as using a tool likeyq
orjq
in bash.
I also left a handful of questions, and a couple suggestions to add documentation/ comments.
I'm receiving the following error when trying to perform the initial upgrade from 7.5.2 to 7.17.9: The exported images archive appears to be empty. I'm getting this error in generate_installer.sh I believe this change is producing the error: After the build, I do not have individual, tagged versions of our elastic containers in the results from Yep that worked. 👍 |
installer/generate_installer.sh
Outdated
$SUDO docker-compose build --pull $NO_CACHE $DOCKER_BUILD_SERVICES | ||
for version in "${elk_versions[@]}"; do | ||
v=$(echo $version|tr -d '\n') | ||
#export ELK_STACK_VERSION="$v" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please uncomment this line. It appears that commenting this line prevents docker-compose from labeling the resulting elastic and kibana images with the appropriate version tags.
Consider using the docker-compose.yml syntax for specifying the build-args for each of the containers individually instead of passing the build arg as a flag on the next line.
Example which passes the ELK_STACK_VERSION environment variable in as a build argument:
build:
context: ./elasticsearch
args:
ELK_STACK_VERSION: ${ELK_STACK_VERSION}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncommented the line. I did not convert to docker-compose syntax because it doesn't seem to tag the images as expected. I don't have the bandwidth to look into it at the moment, especially since the current tagging implementation isn't broken.
My testing environment consists of Zeek watching a Windows domain and sending that data to RITA/ AC-Hunter. As a part of that domain, I have a workstation running a C2 implant alongside the BeaKer agent. I ensured that the workstation was correctly reporting the C2 connection to the existing version of BeaKer (7.5.2). After working through the bug above, I performed an update to 7.17. I was able to confirm that the new version of the dashboard pulled in the old daily indexes from 7.5.2. Additionally, I was able to confirm that the old daily indexes continued to receive new events from the 7.5.2 winlogbeat agents. Next, I will upgrade the winlogbeat agent on the workstation running the implant to 7.17.9. |
Would you be open to adding a blurb to the end of the upgrade install depending on the resulting version? A reminder for the user to go upgrade their winlogbeat agents to the appropriate version and then to come back and run the next upgrade (if needed) might be helpful. |
Added chmod to give write perms, which matches the permissions of many other folders within the elasticsearch container. |
I was able to build a new installer with the latest changes. I copied it over to my system running 7.17 and selected the option to reinstall. This took care of the snapshot issue, and I was able to re-run the installer to upgrade to 8.x. The post-installation messages look good to me. I'll test the final upgrade for the winlogbeat agents tonight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes #74
BeaKer Server Changes:
sysmon-*
index will still be visible in Kibana. New logs from <7.17.9 will not be ingested.elastic/kibana
service account token automatically, which is now required for Kibanaelasticsearch.username
andelasticsearch.password
entries inkibana.yml
as they are deprecated in favor of the service account tokenbeaker
and attempts to create a snapshot before upgrading to 8.7.0winlogbeat-7.17.9
winlogbeat-8.7.0
, and is processed by an ingest pipeline namedwinlogbeat-8.7.0-routing
sysmon-YYYY-MM-dd
(legacy index pattern), andwinlogbeat-%{[agent.version]}
pattern../kibana/check_kibana.py
in order to parse the Kibana status API response and check whether or not Kibana is finished upgradingELK_STACK_VERSION
environment variable to make it easier to detect the currently installed Elastic version./elasticsearch/export_day.sh
in order to export a day's worth of data from thewinlogbeat-*
indices (emulates the daily indices from previous versions)BeaKer Agent Changes:
C:\Program Files\winlogbeat-*
toC:\Program Files\Winlogbeat-BeaKer
in order to be able to install newer versions of winlogbeat and better detect the currently installed versionBeatsVersion
, that allows the desired version of winlogbeat to be installed to be overridenwinlogbeat.yml
config as needed for 7.17 and 8.xTesting (Ubuntu 20.04):
winlogbeat-7.17.9
data stream.