Skip to content

Commit

Permalink
[master] Add support for building fdpass-teleport (#42731) (#42875)
Browse files Browse the repository at this point in the history
* Add support for building `fdpass-teleport` (#42731)

* Add support for building `fdpass-teleport`

* bumped e ref

* bump e ref
  • Loading branch information
fheinecke committed Jun 25, 2024
1 parent 0722133 commit 5c0a83c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ RUST_TARGET_ARCH ?= $(CARGO_TARGET_$(OS)_$(ARCH))

CARGO_TARGET_darwin_amd64 := x86_64-apple-darwin
CARGO_TARGET_darwin_arm64 := aarch64-apple-darwin
CARGO_TARGET_linux_arm := arm-unknown-linux-gnueabihf
CARGO_TARGET_linux_arm64 := aarch64-unknown-linux-gnu
CARGO_TARGET_linux_386 := i686-unknown-linux-gnu
CARGO_TARGET_linux_amd64 := x86_64-unknown-linux-gnu

CARGO_TARGET := --target=${CARGO_TARGET_${OS}_${ARCH}}
CARGO_TARGET := --target=$(RUST_TARGET_ARCH)

# If set to 1, Windows RDP client is not built.
RDPCLIENT_SKIP_BUILD ?= 0
Expand Down Expand Up @@ -208,7 +210,7 @@ endif

# On Windows only build tsh. On all other platforms build teleport, tctl,
# and tsh.
BINS_default = teleport tctl tsh tbot
BINS_default = teleport tctl tsh tbot fdpass-teleport
BINS_windows = tsh tctl
BINS = $(or $(BINS_$(OS)),$(BINS_default))
BINARIES = $(addprefix $(BUILDDIR)/,$(BINS))
Expand Down Expand Up @@ -366,6 +368,11 @@ teleport-hot-reload:
--build="make $(BUILDDIR)/teleport" \
--command="$(BUILDDIR)/teleport $(TELEPORT_ARGS)"

.PHONY: $(BUILDDIR)/fdpass-teleport
$(BUILDDIR)/fdpass-teleport:
cd tool/fdpass-teleport && cargo build --release --locked $(CARGO_TARGET)
install tool/fdpass-teleport/target/$(RUST_TARGET_ARCH)/release/fdpass-teleport $(BUILDDIR)/

#
# BPF support (IF ENABLED)
# Requires a recent version of clang and libbpf installed.
Expand Down Expand Up @@ -578,6 +585,7 @@ release-darwin: $(RELEASE_darwin_arm64) $(RELEASE_darwin_amd64)
lipo -create -output $(BUILDDIR)/tctl $(BUILDDIR_arm64)/tctl $(BUILDDIR_amd64)/tctl
lipo -create -output $(BUILDDIR)/tsh $(BUILDDIR_arm64)/tsh $(BUILDDIR_amd64)/tsh
lipo -create -output $(BUILDDIR)/tbot $(BUILDDIR_arm64)/tbot $(BUILDDIR_amd64)/tbot
lipo -create -output $(BUILDDIR)/fdpass-teleport $(BUILDDIR_arm64)/fdpass-teleport $(BUILDDIR_amd64)/fdpass-teleport
$(MAKE) ARCH=universal build-archive
@if [ -f e/Makefile ]; then $(MAKE) -C e release; fi
endif
Expand Down
2 changes: 1 addition & 1 deletion assets/aws/files/install-hardened.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install -d -m 0755 -o teleport -g adm /run/teleport /etc/teleport.d
# 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} /usr/local/bin
install -m 755 /tmp/teleport/{tctl,tsh,teleport,tbot,fdpass-teleport} /usr/local/bin
rm -rf /tmp/teleport /tmp/teleport.tar.gz

if [[ "${TELEPORT_FIPS}" == 1 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion build.assets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ RUN curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --p
rustc --version && \
rustup component add rustfmt clippy && \
rustup target add wasm32-unknown-unknown && \
if [ "$BUILDARCH" = "amd64" ]; then rustup target add aarch64-unknown-linux-gnu; fi
if [ "$BUILDARCH" = "amd64" ]; then rustup target add aarch64-unknown-linux-gnu i686-unknown-linux-gnu; fi

ARG WASM_PACK_VERSION
# Install wasm-pack for targeting WebAssembly from Rust.
Expand Down
1 change: 1 addition & 0 deletions build.assets/Dockerfile-arm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ RUN mkdir -p $RUSTUP_HOME && chmod a+w $RUSTUP_HOME && \
# will run builds using the Rust toolchains we install here.
USER ci
RUN curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION && \
rustup target add arm-unknown-linux-gnueabihf && \
rustup --version && \
cargo --version && \
rustc --version
Expand Down
6 changes: 3 additions & 3 deletions build.assets/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,16 @@ if [[ "${PACKAGE_TYPE}" == "pkg" ]]; then
ARCH_TAG="-${PACKAGE_ARCH}"
fi
SIGN_PKG="true"
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot"
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport"
BUNDLE_ID="${b:-com.gravitational.teleport}"
if [[ "${TELEPORT_TYPE}" == "ent" ]]; then
PKG_FILENAME="teleport-ent-${TELEPORT_VERSION}${ARCH_TAG}.${PACKAGE_TYPE}"
else
PKG_FILENAME="teleport-${TELEPORT_VERSION}${ARCH_TAG}.${PACKAGE_TYPE}"
fi
else
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${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}/teleport"
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=""
Expand Down
2 changes: 1 addition & 1 deletion e
Submodule e updated from 65723b to 72a1ad
2 changes: 2 additions & 0 deletions tool/fdpass-teleport/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

0 comments on commit 5c0a83c

Please sign in to comment.