From 1380342a267fe4dc951b9dcd03ba1e2962ef26b2 Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 14:07:33 -0500 Subject: [PATCH 1/7] Add teleport-update to build and archive --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2f945dfe92e3f..07fae0ccaba5d 100644 --- a/Makefile +++ b/Makefile @@ -240,7 +240,7 @@ endif # On Windows only build tsh. On all other platforms build teleport, tctl, # and tsh. -BINS_default = teleport tctl tsh tbot fdpass-teleport +BINS_default = teleport tctl tsh tbot fdpass-teleport teleport-update BINS_windows = tsh tctl BINS = $(or $(BINS_$(OS)),$(BINS_default)) BINARIES = $(addprefix $(BUILDDIR)/,$(BINS)) From c7d8791c68423c57f36d40d0a7e28720a1ead94e Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 14:34:24 -0500 Subject: [PATCH 2/7] Add teleport-update to install scripts --- build.assets/install | 2 +- lib/web/scripts/node-join/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.assets/install b/build.assets/install index 691c627d192ce..eb52ec7d99959 100755 --- a/build.assets/install +++ b/build.assets/install @@ -14,7 +14,7 @@ VARDIR=/var/lib/teleport echo "Starting Teleport installation..." cd $(dirname $0) mkdir -p $VARDIR $BINDIR -cp -f teleport tctl tsh tbot $BINDIR/ || exit 1 +cp -f teleport tctl tsh tbot teleport-update $BINDIR/ || exit 1 # # What operating system is the user running? diff --git a/lib/web/scripts/node-join/install.sh b/lib/web/scripts/node-join/install.sh index f1d82b2b3be58..1889bb59ad34b 100755 --- a/lib/web/scripts/node-join/install.sh +++ b/lib/web/scripts/node-join/install.sh @@ -17,7 +17,7 @@ SYSTEMD_UNIT_PATH="/lib/systemd/system/teleport.service" TARGET_PORT_DEFAULT=443 TELEPORT_ARCHIVE_PATH='{{.packageName}}' TELEPORT_BINARY_DIR="/usr/local/bin" -TELEPORT_BINARY_LIST="teleport tctl tsh" +TELEPORT_BINARY_LIST="teleport tctl tsh teleport-update" TELEPORT_CONFIG_PATH="/etc/teleport.yaml" TELEPORT_DATA_DIR="/var/lib/teleport" TELEPORT_DOCS_URL="https://goteleport.com/docs/" From 20583433e34d513a340b53d3f6def4aa5ef3fe3f Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 17:58:50 -0500 Subject: [PATCH 3/7] Add build flags without buildmode pie --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 07fae0ccaba5d..db2adc3825fb1 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,11 @@ GO_LDFLAGS ?= -w -s $(KUBECTL_SETVERSION) ifeq ("$(TELEPORT_DEBUG)","true") BUILDFLAGS ?= $(ADDFLAGS) -gcflags=all="-N -l" BUILDFLAGS_TBOT ?= $(ADDFLAGS) -gcflags=all="-N -l" +BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -gcflags=all="-N -l" else BUILDFLAGS ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath -buildmode=pie BUILDFLAGS_TBOT ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath +BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath endif GO_ENV_OS := $(shell go env GOOS) @@ -312,6 +314,7 @@ endif CGOFLAG = CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie BUILDFLAGS_TBOT = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath +BUILDFLAGS_TELEPORT_UPDATE = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath endif ifeq ("$(OS)","darwin") @@ -397,7 +400,7 @@ $(BUILDDIR)/tbot: .PHONY: $(BUILDDIR)/teleport-update $(BUILDDIR)/teleport-update: - GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -o $(BUILDDIR)/teleport-update $(BUILDFLAGS) ./tool/teleport-update + GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -o $(BUILDDIR)/teleport-update $(BUILDFLAGS_TELEPORT_UPDATE) ./tool/teleport-update TELEPORT_ARGS ?= start .PHONY: teleport-hot-reload From 6ae61a6bc2292cfa98078b7abbc361d6b63d5dac Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 19:59:22 -0500 Subject: [PATCH 4/7] Add helper message for install.sh script --- assets/install-scripts/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/install-scripts/install.sh b/assets/install-scripts/install.sh index 9381051da484a..d105e2ee9bcfa 100755 --- a/assets/install-scripts/install.sh +++ b/assets/install-scripts/install.sh @@ -207,7 +207,7 @@ install_via_zypper() { } -# download .tar.gz file via curl/wget, unzip it and run the install sript +# download .tar.gz file via curl/wget, unzip it and run the install script install_via_curl() { TEMP_DIR=$(mktemp -d -t teleport-XXXXXXXXXX) @@ -387,6 +387,9 @@ install_teleport() { if type fdpass-teleport &>/dev/null; then echo " fdpass-teleport - Teleport Machine ID client." fi + if type teleport-update &>/dev/null; then + echo " teleport-update - Teleport auto-update agent." + fi } # The suffix is "-ent" if we are installing a commercial edition of Teleport and From b9e502e8c96383e6b3a392ba93f9c9b04c6f5c31 Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 20:48:15 -0500 Subject: [PATCH 5/7] Exclude teleport-update from darwin platform --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index db2adc3825fb1..513cf873920ca 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,7 @@ endif # On Windows only build tsh. On all other platforms build teleport, tctl, # and tsh. BINS_default = teleport tctl tsh tbot fdpass-teleport teleport-update +BINS_darwin = teleport tctl tsh tbot fdpass-teleport BINS_windows = tsh tctl BINS = $(or $(BINS_$(OS)),$(BINS_default)) BINARIES = $(addprefix $(BUILDDIR)/,$(BINS)) From 581446815c636f4a097c2b59ed1e815a8dc25dd4 Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Tue, 12 Nov 2024 21:15:28 -0500 Subject: [PATCH 6/7] Add teleport-update to rpm and deb packages --- build.assets/build-package.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.assets/build-package.sh b/build.assets/build-package.sh index 56274d0a1dee8..87522303bf066 100755 --- a/build.assets/build-package.sh +++ b/build.assets/build-package.sh @@ -226,8 +226,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-upgrade" + 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="" From cc1b29b638e2748b2adddfb6c051e50ba268d416 Mon Sep 17 00:00:00 2001 From: Vadym Popov Date: Wed, 13 Nov 2024 14:02:28 -0500 Subject: [PATCH 7/7] Remove teleport-update from deb, rpm packages Add comment for the buildflags --- Makefile | 2 ++ build.assets/build-package.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 513cf873920ca..7012ac04e823d 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -gcflags=all="-N -l" else BUILDFLAGS ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath -buildmode=pie BUILDFLAGS_TBOT ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath +# teleport-update builds with disabled cgo, buildmode=pie is not required. BUILDFLAGS_TELEPORT_UPDATE ?= $(ADDFLAGS) -ldflags '$(GO_LDFLAGS)' -trimpath endif @@ -315,6 +316,7 @@ endif CGOFLAG = CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie BUILDFLAGS_TBOT = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath +# teleport-update builds with disabled cgo, buildmode=pie is not required. BUILDFLAGS_TELEPORT_UPDATE = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath endif diff --git a/build.assets/build-package.sh b/build.assets/build-package.sh index 87522303bf066..56274d0a1dee8 100755 --- a/build.assets/build-package.sh +++ b/build.assets/build-package.sh @@ -226,8 +226,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}/teleport-update ${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 ${TAR_PATH}/teleport-update" + 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" LINUX_SYSTEMD_FILE_LIST="${TAR_PATH}/examples/systemd/teleport.service" EXTRA_DOCKER_OPTIONS="" RPM_SIGN_STANZA=""