Skip to content

Commit

Permalink
[v8]: desktop access backports (#9201)
Browse files Browse the repository at this point in the history
* Expose endpoint for fetching single desktop (#9041)

* updates endpoints

* Exposes an endpoint for fetching a single desktop by name

* Apply suggestions from code review

Co-authored-by: Zac Bergquist <[email protected]>

* changes inaccurate desktopUUID to desktopName

Co-authored-by: Zac Bergquist <[email protected]>

* docs: LDAP service account setup (#8875)

* updating docs with service account tutorial

* minor corrections

* Apply suggestions from code review

Co-authored-by: Zac Bergquist <[email protected]>

* wording changes based on CR

* minor changes and fixes and adds updated photos with new naming convention

* Updating documentation

* updating gpo instructions to actually make sense

* nits

* adding instructions for exporting ca

* removing unhelpful screen shot

* Fixes quotes and updates to LDAPS

Co-authored-by: Ben Arent <[email protected]>

* clarifying comment

Co-authored-by: Zac Bergquist <[email protected]>
Co-authored-by: Ben Arent <[email protected]>

* Enhance LDAP desktop discovery (#9152)

* Refactor component heartbeat callbacks

Consolidate the OK/degraded broadcasts so the same logic isn't
duplicated for each component.

* Periodically update discovered desktops

Fixes #8644

* Allow customizing the desktop search

With this change, we support a discovery base DN other than '*',
and add support for further filtering the results with additional
LDAP filters.

Additionally, we filter out group managed service accounts, which
show up in LDAP searches for (objectClass=computer), despite not
being comptuers. (This is mostly harmless, as the service accounts
aren't present in DNS, so Teleport just ignores them. It does, however,
log a DNS error message that could be confusing, so we explicitly
filter these out just to be safe. This was discovered when testing
on AWS managed AD, which creates a gMSA for DNS.

* simplify connection establishment (#9098)

* Adds username and initial screen size to the websocket parameter string and sends over tdp during the connection process

* simplifications from CR

* fixes // //

* Update e ref

* Create separate builds for CentOS7 (+fips)

Add new buildboxes for centos7 and centos7-fips.

For now, we will continue to support both CentOS 6 and 7.
Eventually we will drop support for CentOS 6, and the only
supported CentOS builds will be these new CentOS 7 builds.

Fixes #9028

* [auto] Update webassets in zmb3/desktop-access-backports (#9210)

444cf33 simplify connection establishment (#480) gravitational/webapps@444cf33

[source: -w teleport-v8] [target: -t zmb3/desktop-access-backports]

Co-authored-by: Isaiah Becker-Mayer <[email protected]>
Co-authored-by: Ben Arent <[email protected]>
  • Loading branch information
3 people authored Dec 3, 2021
1 parent 66bbd05 commit 5123b3f
Show file tree
Hide file tree
Showing 40 changed files with 1,424 additions and 488 deletions.
273 changes: 243 additions & 30 deletions .drone.yml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions api/types/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,13 @@ func (d *WindowsDesktopV3) LabelsString() string {
func (d *WindowsDesktopV3) GetDomain() string {
return d.Spec.Domain
}

// Origin returns the origin value of the resource.
func (d *WindowsDesktopV3) Origin() string {
return d.Metadata.Labels[OriginLabel]
}

// SetOrigin sets the origin value of the resource.
func (d *WindowsDesktopV3) SetOrigin(o string) {
d.Metadata.Labels[OriginLabel] = o
}
51 changes: 21 additions & 30 deletions build.assets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,6 @@ ARG GID
RUN (groupadd ci --gid=$GID -o && useradd ci --uid=$UID --gid=$GID --create-home --shell=/bin/sh && \
mkdir -p -m0700 /var/lib/teleport && chown -R ci /var/lib/teleport)

# Install Rust
#
# Rust installation based on official rust image Dockerfile here:
# https://github.com/rust-lang/docker-rust/blob/master/1.56.0/bullseye/Dockerfile
#
# The original Rust docker image uses a script to install `rustup`, and from
# there rustc and associated tools.
#
# Rather than execute an arbitrary `rustup` installation script, we are cherry-
# picking the appropriate files off the official docker image and then installing
# the extra tooling/targets we need.

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.56.1

COPY --from=rust:1.56.1 /usr/local/rustup /usr/local/rustup
COPY --from=rust:1.56.1 /usr/local/cargo /usr/local/cargo
RUN set -eux \
rustup --version; \
cargo --version; \
rustup component add --toolchain 1.56.1-x86_64-unknown-linux-gnu rustfmt clippy; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup target add i686-unknown-linux-gnu; \
rustup target add arm-unknown-linux-gnueabihf; \
rustup target add aarch64-unknown-linux-gnu; \
rustup target list | grep installed; \
rustc --version;

# Install etcd.
RUN (curl -L https://github.com/coreos/etcd/releases/download/v3.3.9/etcd-v3.3.9-linux-amd64.tar.gz | tar -xz && \
cp etcd-v3.3.9-linux-amd64/etcd* /bin/)
Expand Down Expand Up @@ -163,5 +133,26 @@ RUN make -C /opt/pam_teleport install

ENV SOFTHSM2_PATH "/usr/lib/softhsm/libsofthsm2.so"

# Install Rust
ARG RUST_VERSION
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=$RUST_VERSION

RUN mkdir -p $RUSTUP_HOME && chmod a+w $RUSTUP_HOME && \
mkdir -p $CARGO_HOME/registry && chmod -R a+w $CARGO_HOME

USER ci
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION && \
rustup --version && \
cargo --version && \
rustc --version && \
rustup component add --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu rustfmt clippy && \
rustup target add i686-unknown-linux-gnu && \
rustup target add arm-unknown-linux-gnueabihf && \
rustup target add aarch64-unknown-linux-gnu && \
cargo install cbindgen

VOLUME ["/go/src/github.com/gravitational/teleport"]
EXPOSE 6600 2379 2380
2 changes: 2 additions & 0 deletions build.assets/Dockerfile-arm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG RUNTIME
FROM quay.io/gravitational/teleport-buildbox:$RUNTIME

USER root

RUN apt-get -y update && \
apt-get -y install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu && \
apt-get -y autoclean && apt-get -y clean
60 changes: 60 additions & 0 deletions build.assets/Dockerfile-centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM centos:7

ENV LANGUAGE=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8

ARG RUNTIME
ARG RUST_VERSION

ARG UID
ARG GID
RUN (groupadd ci --gid=$GID -o && useradd ci --uid=$UID --gid=$GID --create-home --shell=/bin/sh && \
mkdir -p -m0700 /var/lib/teleport && chown -R ci /var/lib/teleport)

# Install dev tools (make, etc) and a Perl package needed to build OpenSSL.
RUN yum groupinstall -y "Development Tools"
RUN yum install -y pam-devel net-tools tree git zip libatomic perl-IPC-Cmd && \
yum clean all

# Install etcd.
RUN (curl -L https://github.com/coreos/etcd/releases/download/v3.3.9/etcd-v3.3.9-linux-amd64.tar.gz | tar -xz && \
cp etcd-v3.3.9-linux-amd64/etcd* /bin/)

# Install Go.
RUN mkdir -p /opt && cd /opt && curl https://storage.googleapis.com/golang/$RUNTIME.linux-amd64.tar.gz | tar xz && \
mkdir -p /go/src/github.com/gravitational/teleport && \
chmod a+w /go && \
chmod a+w /var/lib && \
/opt/go/bin/go version

# Install PAM module and policies for testing.
COPY pam/ /opt/pam_teleport/
RUN make -C /opt/pam_teleport install

# Install Rust.
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=$RUST_VERSION

RUN mkdir -p $RUSTUP_HOME && chmod a+w $RUSTUP_HOME && \
mkdir -p $CARGO_HOME/registry && chmod -R a+w $CARGO_HOME

RUN chmod a-w /

USER ci
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION && \
rustup --version && \
cargo --version && \
rustc --version && \
rustup component add --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu rustfmt clippy && \
cargo install cbindgen

ENV GOPATH="/go" \
GOROOT="/opt/go" \
PATH="/opt/bin:$PATH:/opt/go/bin:/go/bin:/go/src/github.com/gravitational/teleport/build"

VOLUME ["/go/src/github.com/gravitational/teleport"]
EXPOSE 6600 2379 2380
69 changes: 69 additions & 0 deletions build.assets/Dockerfile-centos7-fips
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM centos:7

ENV LANGUAGE=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8

ARG RUST_VERSION
ARG BORINGCRYPTO_RUNTIME
ARG GO_BOOTSTRAP_RUNTIME=go1.9.7

ARG UID
ARG GID
RUN (groupadd ci --gid=$GID -o && useradd ci --uid=$UID --gid=$GID --create-home --shell=/bin/sh && \
mkdir -p -m0700 /var/lib/teleport && chown -R ci /var/lib/teleport)

# Install dev tools (make, etc) and a Perl package needed to build OpenSSL.
RUN yum groupinstall -y "Development Tools"
RUN yum install -y pam-devel net-tools tree git zip libatomic perl-IPC-Cmd && \
yum clean all

# Install etcd.
RUN (curl -L https://github.com/coreos/etcd/releases/download/v3.3.9/etcd-v3.3.9-linux-amd64.tar.gz | tar -xz && \
cp etcd-v3.3.9-linux-amd64/etcd* /bin/)

# BoringCrypto (unlike regular Go) requires glibc 2.14, so we have to build from source.
# 1) Install older binary Go runtime for bootstrapping
# 2) Get source for the correct Go boringcrypto runtime and compile it with Go bootstrap runtime
# 3) Erase Go bootstrap runtime and create build directories
# 4) Print compiled Go version
RUN mkdir -p /go-bootstrap && cd /go-bootstrap && curl https://dl.google.com/go/${GO_BOOTSTRAP_RUNTIME}.linux-amd64.tar.gz | tar xz && \
mkdir -p /opt && cd /opt && curl https://go-boringcrypto.storage.googleapis.com/${BORINGCRYPTO_RUNTIME}.src.tar.gz | tar xz && \
cd /opt/go/src && GOROOT_BOOTSTRAP=/go-bootstrap/go ./make.bash && \
rm -rf /go-bootstrap && \
mkdir -p /go/src/github.com/gravitational/teleport && \
chmod a+w /go && \
chmod a+w /var/lib && \
chmod a-w / && \
/opt/go/bin/go version

# Install PAM module and policies for testing.
COPY pam/ /opt/pam_teleport/
RUN make -C /opt/pam_teleport install

# Install Rust.
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=$RUST_VERSION

RUN mkdir -p $RUSTUP_HOME && chmod a+w $RUSTUP_HOME && \
mkdir -p $CARGO_HOME/registry && chmod -R a+w $CARGO_HOME

RUN chmod a-w /

USER ci
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION && \
rustup --version && \
cargo --version && \
rustc --version && \
rustup component add --toolchain $RUST_VERSION-x86_64-unknown-linux-gnu rustfmt clippy && \
cargo install cbindgen

ENV GOPATH="/go" \
GOROOT="/opt/go" \
PATH="/opt/bin:$PATH:/opt/go/bin:/go/bin:/go/src/github.com/gravitational/teleport/build"

VOLUME ["/go/src/github.com/gravitational/teleport"]
EXPOSE 6600 2379 2380
85 changes: 79 additions & 6 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TEST_KUBE ?=
OS ?= linux
ARCH ?= amd64
RUNTIME ?= go1.17.3
RUST_VERSION ?= 1.56.1
BORINGCRYPTO_RUNTIME=$(RUNTIME)b7
LIBBPF_VERSION ?= 0.3.1

Expand All @@ -30,6 +31,8 @@ GOGO_PROTO_TAG ?= v1.3.2
BUILDBOX=quay.io/gravitational/teleport-buildbox:$(RUNTIME)
BUILDBOX_FIPS=quay.io/gravitational/teleport-buildbox-fips:$(RUNTIME)
BUILDBOX_CENTOS6=quay.io/gravitational/teleport-buildbox-centos6:$(RUNTIME)
BUILDBOX_CENTOS7=quay.io/gravitational/teleport-buildbox-centos7:$(RUNTIME)
BUILDBOX_CENTOS7_FIPS=quay.io/gravitational/teleport-buildbox-centos7-fips:$(RUNTIME)
BUILDBOX_ARM=quay.io/gravitational/teleport-buildbox-arm:$(RUNTIME)
BUILDBOX_ARM_FIPS=quay.io/gravitational/teleport-buildbox-arm-fips:$(RUNTIME)

Expand Down Expand Up @@ -107,6 +110,7 @@ buildbox:
--build-arg UID=$(UID) \
--build-arg GID=$(GID) \
--build-arg RUNTIME=$(RUNTIME) \
--build-arg RUST_VERSION=$(RUST_VERSION) \
--build-arg PROTOC_VER=$(PROTOC_VER) \
--build-arg GOGO_PROTO_TAG=$(GOGO_PROTO_TAG) \
--build-arg PROTOC_PLATFORM=$(PROTOC_PLATFORM) \
Expand Down Expand Up @@ -147,6 +151,34 @@ buildbox-centos6:
# CentOS 6 FIPS builds were removed in Teleport 7.0
# https://github.com/gravitational/teleport/issues/7207

#
# Builds a Docker buildbox for CentOS 7 builds
#
.PHONY:buildbox-centos7
buildbox-centos7:
@if [[ $${DRONE} == "true" ]] && ! docker inspect --type=image $(BUILDBOX_CENTOS7) 2>&1 >/dev/null; then docker pull $(BUILDBOX_CENTOS7) || true; fi;
docker build \
--build-arg UID=$(UID) \
--build-arg GID=$(GID) \
--build-arg RUNTIME=$(RUNTIME) \
--build-arg RUST_VERSION=$(RUST_VERSION) \
--cache-from $(BUILDBOX_CENTOS7) \
--tag $(BUILDBOX_CENTOS7) -f Dockerfile-centos7 .

#
# Builds a Docker buildbox for CentOS 7 FIPS builds
#
.PHONY:buildbox-centos7-fips
buildbox-centos7-fips:
@if [[ $${DRONE} == "true" ]] && ! docker inspect --type=image $(BUILDBOX_CENTOS7_FIPS) 2>&1 >/dev/null; then docker pull $(BUILDBOX_CENTOS7_FIPS) || true; fi;
docker build \
--build-arg UID=$(UID) \
--build-arg GID=$(GID) \
--build-arg BORINGCRYPTO_RUNTIME=$(BORINGCRYPTO_RUNTIME) \
--build-arg RUST_VERSION=$(RUST_VERSION) \
--cache-from $(BUILDBOX_CENTOS7_FIPS) \
--tag $(BUILDBOX_CENTOS7_FIPS) -f Dockerfile-centos7-fips .

#
# Builds a Docker buildbox for ARMv7/ARM64 builds
# ARM buildboxes use a regular Teleport buildbox as a base which already has a user
Expand Down Expand Up @@ -287,6 +319,14 @@ release-arm64: buildbox-arm
release-amd64-centos6: buildbox-centos6
$(MAKE) release-centos6 ARCH=amd64

.PHONY: release-amd64-centos7
release-amd64-centos7: buildbox-centos7
$(MAKE) release-centos7 ARCH=amd64

.PHONY: release-amd64-centos7-fips
release-amd64-centos7-fips: buildbox-centos7-fips
$(MAKE) release-centos7-fips ARCH=amd64 FIPS=yes

#
# Create a Teleport FIPS package using the build container.
# This is a special case because it only builds and packages the Enterprise FIPS binaries, no OSS.
Expand All @@ -300,12 +340,30 @@ release-fips: buildbox-fips

#
# Create a Teleport package for CentOS 6 using the build container.
# DELETE IN 9.0 (zmb3)
#
.PHONY:release-centos6
release-centos6: buildbox-centos6
docker run $(DOCKERFLAGS) -i $(NOROOT) $(BUILDBOX_CENTOS6) \
/usr/bin/make release -e ADDFLAGS="$(ADDFLAGS)" OS=$(OS) ARCH=$(ARCH) RUNTIME=$(RUNTIME) REPRODUCIBLE=no

#
# Create a Teleport package for CentOS 7 using the build container.
#
.PHONY:release-centos7
release-centos7: buildbox-centos7
docker run $(DOCKERFLAGS) -i $(NOROOT) $(BUILDBOX_CENTOS7) \
/usr/bin/make release -e ADDFLAGS="$(ADDFLAGS)" OS=$(OS) ARCH=$(ARCH) RUNTIME=$(RUNTIME) REPRODUCIBLE=no

#
# Create a Teleport FIPS package for CentOS 7 using the build container.
# This only builds and packages enterprise FIPS binaries, no OSS.
#
.PHONY:release-centos7-fips
release-centos7-fips:
docker run $(DOCKERFLAGS) -i $(NOROOT) $(BUILDBOX_CENTOS7_FIPS) \
/usr/bin/make -C e release -e ADDFLAGS="$(ADDFLAGS)" OS=$(OS) ARCH=$(ARCH) RUNTIME=$(RUNTIME) FIPS=yes VERSION=$(VERSION) GITTAG=v$(VERSION) REPRODUCIBLE=no

#
# Create a Windows Teleport package using the build container.
#
Expand All @@ -325,18 +383,33 @@ release-windows-unsigned: buildbox
#
# Run docs tester to detect problems.
#
.PHONY: docsbox
.PHONY:docsbox
docsbox:
if ! docker inspect --type=image $(DOCSBOX) 2>&1 >/dev/null; then docker pull $(DOCSBOX) || true; fi

.PHONY: test-docs
test-docs: DOCS_VERSION := $(shell grep -E ^VERSION $(MAKEFILE_ROOT_DIR)/Makefile | cut -d= -f2 | cut -d. -f1-2)
.PHONY:test-docs
test-docs: docsbox
docker run -i $(NOROOT) -v $$(pwd)/..:/src/content/$(DOCS_VERSION) $(DOCSBOX) \
docker run --platform=linux/amd64 -i $(NOROOT) -v $$(pwd)/..:/src/content $(DOCSBOX) \
/bin/sh -c "yarn markdown-lint-external-links"

# build-centos6-assets builds assets needed by CentOS 6 in a container.
.PHONY: build-centos6-assets
#
# Builds assets needed by CentOS 6 in a container.
#
.PHONY:build-centos6-assets
build-centos6-assets:
docker build -t buildbox-centos6-assets -f Dockerfile-centos6-assets .
docker run -v $$(pwd):/centos6.assets -it buildbox-centos6-assets cp /centos6-assets.tar.gz /centos6.assets

#
# Print the Go version used to build Teleport.
#
.PHONY:print-go-version
print-go-version:
@echo $(RUNTIME)

#
# Print the Rust version used to build Teleport.
#
.PHONY:print-rust-version
print-rust-version:
@echo $(RUST_VERSION)
3 changes: 3 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,3 +739,6 @@ const UserSingleUseCertTTL = time.Minute
// StandardHTTPSPort is the default port used for the https URI scheme,
// cf. RFC 7230 § 2.7.2.
const StandardHTTPSPort = 443

// StandardRDPPort is the default port used for RDP.
const StandardRDPPort = 3389
Binary file added docs/img/desktop-access/ad-new-user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/desktop-access/apply-gpo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/desktop-access/create-and-link-gpo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/desktop-access/remove-authenticated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/desktop-access/select-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5123b3f

Please sign in to comment.