Skip to content
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

[teleport-update] Move teleport binaries to new path {deb,rpm} #49110

Merged
merged 19 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
65b4088
Move teleport binaries to new path
vapopov Nov 16, 2024
cc23056
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 19, 2024
3ac63a0
Use link/unlink command to manage links
vapopov Nov 19, 2024
80de703
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 19, 2024
4855745
Move teleport binaries under standard path for distroless
vapopov Nov 20, 2024
89b32da
Fix wrong move path
vapopov Nov 20, 2024
a16f9c6
Create missing directory
vapopov Nov 20, 2024
a1da9f1
Rename link/unlink commands
vapopov Nov 20, 2024
981c042
Exclude teleport-update from docker image
vapopov Nov 20, 2024
28c5e93
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 20, 2024
df249f2
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 21, 2024
7ebb1e2
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 22, 2024
dd5594d
Add teleport-update to AMI image build
vapopov Nov 22, 2024
62ee8c3
Fix RPM build, fpm automatically manage scripts
vapopov Nov 22, 2024
d109f68
Fix AMI build, add missing teleport.service
vapopov Nov 22, 2024
98b8149
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 5, 2024
8a0fb1f
Move binaries to /opt/teleport/system
vapopov Dec 5, 2024
7b428d0
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 13, 2024
347710f
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion assets/aws/files/install-hardened.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ usermod -a -G adm teleport
# Setup teleport run dir for pid files
install -d -m 0700 -o teleport -g adm /var/lib/teleport
install -d -m 0755 -o teleport -g adm /run/teleport /etc/teleport.d
# Setup teleport/system directory
install -d -m 0755 -o teleport -g adm /opt/teleport/system/bin
install -d -m 0755 -o teleport -g adm /opt/teleport/system/lib/systemd/system

# Extract tarball to /tmp/teleport to get the binaries out
mkdir /tmp/teleport
tar -C /tmp/teleport -x -z -f /tmp/teleport.tar.gz --strip-components=1
install -m 755 /tmp/teleport/{tctl,tsh,teleport,tbot,fdpass-teleport} /usr/local/bin
install -m 755 /tmp/teleport/{tctl,tsh,teleport,tbot,fdpass-teleport,teleport-update} /opt/teleport/system/bin
install -m 755 /tmp/teleport/examples/systemd/teleport.service /opt/teleport/system/lib/systemd/system
/opt/teleport/system/bin/teleport-update link-package
rm -rf /tmp/teleport /tmp/teleport.tar.gz

if [[ "${TELEPORT_FIPS}" == 1 ]]; then
Expand Down
19 changes: 12 additions & 7 deletions build.assets/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ TARBALL_DIRECTORY="$s"
GNUPG_DIR=${GNUPG_DIR:-/tmp/gnupg}

# linux package configuration
LINUX_BINARY_DIR=/usr/local/bin
LINUX_SYSTEMD_DIR=/lib/systemd/system
LINUX_BINARY_DIR=/opt/teleport/system/bin
LINUX_SYSTEMD_DIR=/opt/teleport/system/lib/systemd/system
LINUX_CONFIG_DIR=/etc
LINUX_DATA_DIR=/var/lib/teleport

Expand Down Expand Up @@ -229,8 +229,8 @@ if [[ "${PACKAGE_TYPE}" == "pkg" ]]; then
PKG_FILENAME="teleport-bin-${TELEPORT_VERSION}${ARCH_TAG}.${PACKAGE_TYPE}"
fi
else
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/examples/systemd/teleport.service ${TAR_PATH}/examples/systemd/post-upgrade"
LINUX_BINARY_FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport"
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport-update ${TAR_PATH}/examples/systemd/teleport.service ${TAR_PATH}/examples/systemd/post-install ${TAR_PATH}/examples/systemd/before-remove"
LINUX_BINARY_FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport ${TAR_PATH}/teleport-update"
LINUX_SYSTEMD_FILE_LIST="${TAR_PATH}/examples/systemd/teleport.service"
EXTRA_DOCKER_OPTIONS=""
RPM_SIGN_STANZA=""
Expand Down Expand Up @@ -294,8 +294,12 @@ if [[ "${PACKAGE_TYPE}" != "pkg" ]]; then
CONFIG_FILE_STANZA="--config-files /src/buildroot${LINUX_CONFIG_DIR}/${LINUX_CONFIG_FILE} "
fi

# include post-upgrade script
mv -v ${TAR_PATH}/examples/systemd/post-upgrade ${PACKAGE_TEMPDIR}
# include post-install and before-remove script
mv -v ${TAR_PATH}/examples/systemd/post-install ${PACKAGE_TEMPDIR}
mv -v ${TAR_PATH}/examples/systemd/before-remove ${PACKAGE_TEMPDIR}

# create versions folder
mkdir -p ${PACKAGE_TEMPDIR}/buildroot${LINUX_DATA_DIR}/versions

# /var/lib/teleport
# shellcheck disable=SC2174
Expand Down Expand Up @@ -371,7 +375,8 @@ else
--provides teleport \
--prefix / \
--verbose \
--after-upgrade /src/post-upgrade \
--after-install /src/post-install \
--before-remove /src/before-remove \
${CONFIG_FILE_STANZA} \
${FILE_PERMISSIONS_STANZA} \
"${LICENSE_STANZA[@]}" \
Expand Down
3 changes: 3 additions & 0 deletions build.assets/charts/Dockerfile-distroless
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ COPY $TELEPORT_DEB_FILE_NAME ./$TELEPORT_DEB_FILE_NAME
RUN dpkg-deb -R $TELEPORT_DEB_FILE_NAME /opt/staging && \
mkdir -p /opt/staging/etc/teleport && \
mkdir -p /opt/staging/var/lib/dpkg/status.d/ && \
mkdir -p /opt/staging/usr/local/bin && \
mv /opt/staging/DEBIAN/control /opt/staging/var/lib/dpkg/status.d/teleport && \
mv /opt/staging/opt/teleport/system/bin/* /opt/staging/usr/local/bin/ && \
rm -f /opt/staging/usr/local/bin/teleport-update && \
rm -rf /opt/staging/DEBIAN

FROM $BASE_IMAGE
Expand Down
3 changes: 3 additions & 0 deletions build.assets/charts/Dockerfile-distroless-fips
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ COPY $TELEPORT_DEB_FILE_NAME ./$TELEPORT_DEB_FILE_NAME
RUN dpkg-deb -R $TELEPORT_DEB_FILE_NAME /opt/staging && \
mkdir -p /opt/staging/etc/teleport && \
mkdir -p /opt/staging/var/lib/dpkg/status.d/ && \
mkdir -p /opt/staging/usr/local/bin && \
mv /opt/staging/DEBIAN/control /opt/staging/var/lib/dpkg/status.d/teleport && \
mv /opt/staging/opt/teleport/system/bin/* /opt/staging/usr/local/bin/ && \
rm -f /opt/staging/usr/local/bin/teleport-update && \
rm -rf /opt/staging/DEBIAN

FROM $BASE_IMAGE
Expand Down
2 changes: 1 addition & 1 deletion build.assets/charts/Dockerfile-tbot-distroless
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ENV TELEPORT_DEB_FILE_NAME=teleport${TELEPORT_RELEASE_INFIX}_${TELEPORT_VERSION}
RUN --mount=type=bind,target=/ctx dpkg-deb -R /ctx/$TELEPORT_DEB_FILE_NAME /opt/staging

FROM $BASE_IMAGE
COPY --from=teleport /opt/staging/usr/local/bin/tbot /usr/local/bin/tbot
COPY --from=teleport /opt/staging/opt/teleport/system/bin/tbot /usr/local/bin/tbot
ENTRYPOINT ["/usr/local/bin/tbot"]
2 changes: 1 addition & 1 deletion build.assets/charts/Dockerfile-tbot-distroless-fips
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ENV TELEPORT_DEB_FILE_NAME=teleport${TELEPORT_RELEASE_INFIX}_${TELEPORT_VERSION}
RUN --mount=type=bind,target=/ctx dpkg-deb -R /ctx/$TELEPORT_DEB_FILE_NAME /opt/staging

FROM $BASE_IMAGE
COPY --from=teleport /opt/staging/usr/local/bin/tbot /usr/local/bin/tbot
COPY --from=teleport /opt/staging/opt/teleport/system/bin/tbot /usr/local/bin/tbot
ENTRYPOINT ["/usr/local/bin/tbot", "--fips"]
8 changes: 8 additions & 0 deletions examples/systemd/before-remove
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This before remove script is run each time the teleport package is removed.

set -eu

echo "Removing symlinks from Teleport system paths..."
/opt/teleport/system/bin/teleport-update unlink-package || true
8 changes: 8 additions & 0 deletions examples/systemd/post-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This post install script is run each time the teleport package is installed/upgraded.

set -eu

echo "Teleport system symlinks creation..."
/opt/teleport/system/bin/teleport-update link-package
8 changes: 1 addition & 7 deletions examples/systemd/post-upgrade
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

# this post upgrade script is run each time the teleport package is upgraded
# This post upgrade script is run each time the teleport package is upgraded.

set -eu

# skip reload and restart when systemd is disabled. This is only relevant when
# testing in a container.
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
Loading