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

Build tsh with static libfido2 in buildbox and Centos7 #11849

Merged
merged 10 commits into from
Apr 18, 2022

Conversation

codingllama
Copy link
Contributor

@codingllama codingllama commented Apr 8, 2022

Build tsh with static libfido2, libcbor,libcrypto and libudev-zero.

Dockerfiles for buildbox and Centos7 changed. FIPS and macOS to be addressed at a later date.

Add the tsh fido2 diag hidden command for ease of testing.

#9160

@codingllama codingllama force-pushed the codingllama/fido2-build branch from 6227b4f to ec961af Compare April 12, 2022 22:46
@codingllama codingllama marked this pull request as ready for review April 12, 2022 22:51
@github-actions github-actions bot requested review from atburke and timothyb89 April 12, 2022 22:51
@github-actions github-actions bot added the tsh tsh - Teleport's command line tool for logging into nodes running Teleport. label Apr 12, 2022
@codingllama codingllama requested review from espadolini and timothyb89 and removed request for timothyb89 and atburke April 12, 2022 22:52
@codingllama
Copy link
Contributor Author

FYI @zmb3 @russjones

Buildbox:

$ ldd build/tsh
	linux-vdso.so.1 (0x00007ffc5e308000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe89c7de000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe89c5da000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe89c1e9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe89c9fd000)

Centos:

$ ldd build/tsh
	linux-vdso.so.1 =>  (0x00007ffdb37e5000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f06036d6000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f06034d2000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f0603104000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f06038f2000)

Tried the builds against Debian 7/8 and Ubuntu 14/16/18. Some nice folks tried against Ubuntu 20 as well. The verdict is:

  • Debian 7 is a no-go, glibc is too old even for the Centos build
  • Debian 8 and Ubuntu 14/16 like the Centos build (glibc again)
  • Newer distros are able to run either.

Copy link
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eudev is GPL, libudev from systemd is LGPL, so we can't use the former and we can only dynamically link the latter. 😭

Perhaps we can try with illiliti/libudev-zero? Either that or we bite the bullet and rewrite libfido2 in go, maybe using flynn/hid for zero-dependency hardware detection.

build.assets/Dockerfile Outdated Show resolved Hide resolved
build.assets/Dockerfile Show resolved Hide resolved
.gitignore Show resolved Hide resolved
lib/auth/webauthncli/fido2_common.go Show resolved Hide resolved
@codingllama
Copy link
Contributor Author

eudev is GPL, libudev from systemd is LGPL, so we can't use the former and we can only dynamically link the latter. 😭

libfido2 hard-depends on libudev and is BSD-2, which confuses my non-layer brain. ¯\(ツ)

Perhaps we can try with illiliti/libudev-zero?

I'm OK moving to illiliti/libudev-zero, as it does seem to work. My concern is that, as a single-author library, it's way more likely to be dropped on the floor, whereas eudev appears to be more mature. I do have to say it's a lot easier to build, though...

@zmb3

Either that or we bite the bullet and rewrite libfido2 in go, maybe using flynn/hid for zero-dependency hardware detection

Yep, I've had my sights on that for a while. If we can pull off libfido2 I do think that's better, because we leverage Yubico's work. Time is the main factor now, as I can't make the next release if I have to rewrite libfido2, but post release this could change.

@codingllama
Copy link
Contributor Author

  • Debian 7 is a no-go, glibc is too old even for the Centos build

Just a quick update, but I tried the "old" U2F tsh in Debian 7 and it doesn't run either, so I think that ship sailed already.

# buildbox build (lifted from `make build/tsh`)
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CGO_LDFLAGS="-Wl,-Bstatic -lelf -lz -Wl,-Bdynamic" go build -tags "" -o build/tsh  -ldflags '-w -s' ./tool/tsh

# centos7 build (lifted from `make build/tsh`)
$ GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags "" -o build/tsh  -ldflags '-w -s' ./tool/tsh

# Debian 7
$ ./tsh  # buildbox binary
./tsh: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./tsh)

$ ./tsh  # centos7 binary
./tsh: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./tsh)

@codingllama codingllama force-pushed the codingllama/fido2-build branch from ec961af to 35577f4 Compare April 13, 2022 16:02
@codingllama
Copy link
Contributor Author

libudev-zero experiment: (commit) (branch).

@codingllama codingllama force-pushed the codingllama/fido2-build branch 2 times, most recently from fd4e017 to 714e54f Compare April 14, 2022 14:27
@codingllama
Copy link
Contributor Author

PTAL? Now building with illiliti/libudev-zero.

build.assets/Dockerfile Show resolved Hide resolved
build.assets/Dockerfile Outdated Show resolved Hide resolved
build.assets/Dockerfile Show resolved Hide resolved
build.assets/Dockerfile-centos7 Outdated Show resolved Hide resolved
@codingllama
Copy link
Contributor Author

Friendly ping @timothyb89.

Makefile Show resolved Hide resolved
@codingllama codingllama force-pushed the codingllama/fido2-build branch from f21e0d0 to 9707467 Compare April 18, 2022 13:42
@codingllama codingllama enabled auto-merge (squash) April 18, 2022 13:43
@codingllama codingllama merged commit 9c89c00 into master Apr 18, 2022
@codingllama codingllama deleted the codingllama/fido2-build branch April 18, 2022 14:07
codingllama added a commit that referenced this pull request Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants