65 lines
2.5 KiB
Ruby
65 lines
2.5 KiB
Ruby
class Teleport < Formula
|
|
desc "Modern SSH server for teams managing distributed infrastructure"
|
|
homepage "https://gravitational.com/teleport"
|
|
url "https://github.com/gravitational/teleport/archive/v6.2.0.tar.gz"
|
|
sha256 "bf479d580dc0f9187493645b6e3aa7e5458e46ff4c632169fc688946a6265ba2"
|
|
license "Apache-2.0"
|
|
head "https://github.com/gravitational/teleport.git"
|
|
|
|
# We check the Git tags instead of using the `GithubLatest` strategy, as the
|
|
# "latest" version can be incorrect. As of writing, two major versions of
|
|
# `teleport` are being maintained side by side and the "latest" tag can point
|
|
# to a release from the older major version.
|
|
livecheck do
|
|
url :stable
|
|
strategy :git
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "67ad1eca544f962f4a43dd9a1143c7f13855ea5d0d0323f4751181cb217eb9b9"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "078db6f2483e1a9911f1827ca12da233f735941b1aada8e93b9c21e2c2457270"
|
|
sha256 cellar: :any_skip_relocation, catalina: "ab2242678144fb2421a0a202c661314c1fc6fc13c2891d48ae341b3d44966a6f"
|
|
sha256 cellar: :any_skip_relocation, mojave: "53e8a9077a0ba3576508525b3104194da8cb02e7488f7a403a6ce42d8bb27a5b"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
uses_from_macos "curl" => :test
|
|
uses_from_macos "netcat" => :test
|
|
uses_from_macos "zip"
|
|
|
|
conflicts_with "etsh", because: "both install `tsh` binaries"
|
|
|
|
# Keep this in sync with https://github.com/gravitational/teleport/tree/v#{version}
|
|
resource "webassets" do
|
|
url "https://github.com/gravitational/webassets/archive/8c2812c169fa6bd5f31c13160bd93ef8b317bbc9.tar.gz"
|
|
sha256 "14445b0864d759347c1f53dc144a346b1974b8ded49031d7f0b7227f5d49d407"
|
|
end
|
|
|
|
def install
|
|
(buildpath/"webassets").install resource("webassets")
|
|
ENV.deparallelize { system "make", "full" }
|
|
bin.install Dir["build/*"]
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/teleport version")
|
|
(testpath/"config.yml").write shell_output("#{bin}/teleport configure")
|
|
.gsub("0.0.0.0", "127.0.0.1")
|
|
.gsub("/var/lib/teleport", testpath)
|
|
.gsub("/var/run", testpath)
|
|
.gsub(/https_(.*)/, "")
|
|
begin
|
|
pid = spawn("#{bin}/teleport start -c #{testpath}/config.yml")
|
|
sleep 5
|
|
system "/usr/bin/curl", "--insecure", "https://localhost:3080"
|
|
system "/usr/bin/nc", "-z", "localhost", "3022"
|
|
system "/usr/bin/nc", "-z", "localhost", "3023"
|
|
system "/usr/bin/nc", "-z", "localhost", "3025"
|
|
ensure
|
|
Process.kill(9, pid)
|
|
end
|
|
end
|
|
end
|