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

Look into compiling Teleport as a static binary again #4896

Open
webvictim opened this issue Nov 18, 2020 · 5 comments
Open

Look into compiling Teleport as a static binary again #4896

webvictim opened this issue Nov 18, 2020 · 5 comments
Labels
coffee Sasha tracks these mission critical issues. release-engineering

Comments

@webvictim
Copy link
Contributor

There are a number of reasons why we don't compile Teleport as a static binary:

  • (g)libc DNS resolver (the musl implementation has caused issues in the past when running in Kubernetes)
  • PAM
  • BPF
  • sqlite (requires cgo)

It's possible to work around all of these except the current requirement of using the glibc DNS resolver. Go's native resolver has apparently been considerably improved since Teleport was first compiled and can now handle the majority of settings in /etc/nsswitch.conf without trouble. It might be worth investigating whether we can use this instead and remove the dependency on glibc. This would enable us to truly have one Teleport binary with everything compiled in which will work anywhere, so we would no longer need separate CentOS 6 or other builds.

@awly
Copy link
Contributor

awly commented Nov 18, 2020

@webvictim how can we trigger PAM without CGO and libpam?

@webvictim
Copy link
Contributor Author

webvictim commented Nov 19, 2020

I managed to compile the binary on alpine using libpam-devel and musl but didn't test whether PAM worked.

@russjones
Copy link
Contributor

What does Go do? Because I've seen similar issues discussed, for glibc on the Go issue tracker.

@awly
Copy link
Contributor

awly commented Dec 9, 2020

I was able to compile teleport as a static binary, by statically linking C libraries via -ldflags '-extldflags=-static':

$ file build/teleport
build/teleport: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=a2f4c8913c03bd489b208815a72816dcd6c2259f, for GNU/Linux 3.2.0, stripped

Inspired by https://www.arp242.net/static-go.html

The binary starts find, but I'm not sure what features could be broken by this.

@webvictim
Copy link
Contributor Author

This is the same way I compiled it statically too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coffee Sasha tracks these mission critical issues. release-engineering
Projects
None yet
Development

No branches or pull requests

4 participants