Skip to content

Commit

Permalink
fix: remove fipsmodule by hand to make sure the whole /opt/datadog-ag…
Browse files Browse the repository at this point in the history
…ent is removed during uninstall

Signed-off-by: Nicolas Guerguadj <nicolas.guerguadj@datadoghq.com>
  • Loading branch information
Kaderinho committed Sep 12, 2024
1 parent 235a5ef commit f967f16
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions omnibus/package-scripts/agent-deb/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
INSTALL_DIR=/opt/datadog-agent
LOG_DIR=/var/log/datadog
CONFIG_DIR=/etc/datadog-agent
FIPS_MODULE_PATH=/opt/datadog-fips-proxy/embedded/ssl/fipsmodule.cnf

# Remove the symlink to the binary.
rm -f "/usr/bin/datadog-agent"
Expand All @@ -19,6 +20,9 @@ case "$1" in
deluser dd-agent --quiet
echo "Deleting dd-agent group"
(getent group dd-agent >/dev/null && delgroup dd-agent --quiet) || true
# We explicitly remove the ssl directory because files within this folder are generated via a script
# outside of omnibus (omnibus only removes files present in the package).
rm -rf "${FIPS_MODULE_PATH}" || true
echo "Force-deleting $INSTALL_DIR"
rm -rf $INSTALL_DIR
rm -rf $LOG_DIR
Expand Down
4 changes: 4 additions & 0 deletions omnibus/package-scripts/agent-rpm/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# .rpm: STEP 5 of 6

CONFIG_DIR=/etc/datadog-agent
FIPS_MODULE_PATH=/opt/datadog-fips-proxy/embedded/ssl/fipsmodule.cnf

# Remove the symlink to the binary.
rm -f "/usr/bin/datadog-agent"
Expand All @@ -15,6 +16,9 @@ case "$*" in
# We don't delete the dd-agent user/group (see https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Allocation_Strategies)
rm "$CONFIG_DIR/install_info" || true
rm "$CONFIG_DIR/install.json" || true
# We explicitly remove the ssl directory because files within this folder are generated via a script
# outside of omnibus (omnibus only removes files present in the package).
rm -rf "${FIPS_MODULE_PATH}" || true
;;
1)
# We're upgrading.
Expand Down
4 changes: 4 additions & 0 deletions omnibus/package-scripts/installer-deb/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
PACKAGES_DIR=/opt/datadog-packages
INSTALL_DIR=/opt/datadog-installer
RUN_DIR=/var/run/datadog-installer
FIPS_MODULE_PATH=/opt/datadog-fips-proxy/embedded/ssl/fipsmodule.cnf

set -e

Expand All @@ -15,6 +16,9 @@ case "$1" in
datadog-installer purge || true
rm -f "/usr/bin/datadog-bootstrap"
echo "Force-deleting $INSTALL_DIR $PACKAGES_DIR $RUN_DIR"
# We explicitly remove the ssl directory because files within this folder are generated via a script
# outside of omnibus (omnibus only removes files present in the package).
rm -rf "${FIPS_MODULE_PATH}" || true
rm -rf $PACKAGES_DIR
rm -rf $RUN_DIR
rm -rf $INSTALL_DIR
Expand Down
4 changes: 4 additions & 0 deletions omnibus/package-scripts/installer-rpm/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
PACKAGES_DIR=/opt/datadog-packages
INSTALL_DIR=/opt/datadog-installer
RUN_DIR=/var/run/datadog-installer
FIPS_MODULE_PATH=/opt/datadog-fips-proxy/embedded/ssl/fipsmodule.cnf

set -e

Expand All @@ -18,6 +19,9 @@ fi
datadog-installer purge || true
rm -f "/usr/bin/datadog-bootstrap"
echo "Force-deleting $INSTALL_DIR $PACKAGES_DIR $RUN_DIR"
# We explicitly remove the ssl directory because files within this folder are generated via a script
# outside of omnibus (omnibus only removes files present in the package).
rm -rf "${FIPS_MODULE_PATH}" || true
rm -rf $PACKAGES_DIR
rm -rf $RUN_DIR
rm -rf $INSTALL_DIR
Expand Down

0 comments on commit f967f16

Please sign in to comment.