On 2023/01/21 23:35, Divan Santana wrote: > Stuart Henderson <[email protected]> writes: > > > On 2023/01/18 19:49, Divan Santana wrote: > >> Greetings :) > >> > >> I'm wondering if anyone has attempting to build teleport[1] on openbsd. > >> > >> (I'm specifically after tsh functionality). > >> > >> There was a bug[2] about this upstream which was closed due to inactivity. > >> > >> But perhaps some OpenBSD user has attempting or succeeded to build it. > >> > >> There is a freebsd port for it. > >> > >> [1]: https://github.com/gravitational/teleport > >> [2]: https://github.com/gravitational/teleport/issues/840 > >> [3]: https://www.freshports.org/security/teleport > >> > > > > Try it - the problem with termios mentioned in that ~6-year-old issue > > upstream is not likely to be a problem any more, at least on the more > > common machine architectures. > > I don't know much about building packages. But I tried the below and > got these results. > > git clone https://github.com/gravitational/teleport.git gravitational-teleport > cd gravitational-teleport > git checkout tags/v11.2.1 -b v11.2.1 > > > CC=clang > > gmake build/tsh
So you get some different broken things instead :) > It failed with: > > #+begin_example > # github.com/flynn/u2f/u2fhid > > ../../go/pkg/mod/github.com/flynn/[email protected]/u2fhid/hid.go:52:22: > undefined: hid.Devices > > ../../go/pkg/mod/github.com/flynn/[email protected]/u2fhid/hid.go:69:22: > info.Open undefined (type *hid.DeviceInfo has no field or method Open) This depends on https://github.com/flynn/hid which has no OpenBSD support. > # github.com/gravitational/teleport/lib/utils > lib/utils/disk.go:43:24: stat.Blocks undefined (type syscall.Statfs_t has > no field or method Blocks) > lib/utils/disk.go:43:36: stat.Bfree undefined (type syscall.Statfs_t has no > field or method Bfree) > lib/utils/disk.go:43:58: stat.Blocks undefined (type syscall.Statfs_t has > no field or method Blocks) > lib/utils/disk.go:110:20: undefined: syscall.S_IWGRP > lib/utils/disk.go:111:18: undefined: syscall.S_IXGRP > lib/utils/disk.go:119:18: undefined: syscall.S_IWOTH > lib/utils/disk.go:120:16: undefined: syscall.S_IXOTH > gmake: *** [Makefile:290: build/tsh] Error 2 And this is part of Teleport itself, which uses things from the Go syscall package which is not OS-independent, it will need some alternative code to replace these things ("func PercentUsed" to show how much disk space is used, and "func CanUserWriteTo" which has some complex code to try to figure out if the user running it can write to a certain path, rather than just trying to write to that path and doing something with failures. The ones in github.com/gravitational/teleport/lib/utils are probably not too tricky to fix to either do something more sensible on non-Linux systems, or at least stub out the relevant bits (which is probably good enough). The hid code will be trickier to port and will need some lower- level knowledge of the USB stack; OpenBSD doesn't have the hidraw interface used by most newer HID-related code, it might be possible to adapt from the old linux libusb-based version before it changed across to hidraw (upstream commit https://github.com/flynn/hid/commit/c537fb60240f1b3060c3a474400f529db9749c7b) though if you don't need U2F support it might be easier to modify the Teleport code to disable using it. Anyway it's not going to be a particularly straightforward job.
