Skip to content

Commit

Permalink
feat(command): Enable the datacollector service when disabled (#7)
Browse files Browse the repository at this point in the history
When pre-installing the Lacwork agent on an image, the Lacework support team suggests we disable the datacollector service. Therefore, this script needs to enable it.

This PR also improves Kubernetes nodes detection.

Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
  • Loading branch information
JPLachance authored Mar 2, 2021
1 parent d272375 commit 8578d5f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setup_lacework_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOKEN='{{ Token }}'
TAGS='{{ Tags }}'

# TODO: Handle systems that don't have systemctl
if systemctl is-active --quiet kubelet; then
if systemctl list-unit-files | grep kube; then
echo "This host appears to be a Kubernetes node, please use the Kubernetes deployment method (https://support.lacework.com/hc/en-us/articles/360005263034-Deploy-on-Kubernetes)."
exit 0
fi
Expand All @@ -18,6 +18,7 @@ if [ ! -d "$LACEWORK_INSTALL_PATH" ]; then
echo "Lacework agent not installed, installing..."

# TODO: Add the support for hosts that don't have curl installed
# TODO: Verify the signature of the install.sh script
curl https://packages.lacework.net/install.sh >/tmp/install.sh

chmod +x /tmp/install.sh
Expand All @@ -39,4 +40,11 @@ cat >"$LACEWORK_INSTALL_PATH/config/config.json" <<EOF
}
EOF

# Make sure the Lacework datacollector service is enabled and running
if ! systemctl is-active --quiet datacollector; then
echo "Enabling the Lacework datacollector service"
systemctl enable datacollector
systemctl start datacollector
fi

echo "Lacework configured successfully!"

0 comments on commit 8578d5f

Please sign in to comment.