62 lines
2.1 KiB
Ruby
62 lines
2.1 KiB
Ruby
class Cfssl < Formula
|
|
desc "CloudFlare's PKI toolkit"
|
|
homepage "https://cfssl.org/"
|
|
url "https://github.com/cloudflare/cfssl/archive/1.3.0.tar.gz"
|
|
sha256 "78322f0f37b5c90d612ce4e18b35c03bfde242d32426ef0db1f859255a778384"
|
|
head "https://github.com/cloudflare/cfssl.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "ab6b90db75e4f558bd3320c86a2785b47a7949b2008c1f49c0dab205e0b69d09" => :high_sierra
|
|
sha256 "fdfa583eb0a8c0446d7344865c6cbfe1ed9850f3ba445fd3da13af634b21a977" => :sierra
|
|
sha256 "d86755e05797a0febb8042f59f1c225c200f4b65d0f61f65a0966463ab5e20c2" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "libtool" => :run
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
cfsslpath = buildpath/"src/github.com/cloudflare/cfssl"
|
|
cfsslpath.install Dir["{*,.git}"]
|
|
cd "src/github.com/cloudflare/cfssl" do
|
|
system "go", "build", "-o", "#{bin}/cfssl", "cmd/cfssl/cfssl.go"
|
|
system "go", "build", "-o", "#{bin}/cfssljson", "cmd/cfssljson/cfssljson.go"
|
|
system "go", "build", "-o", "#{bin}/cfsslmkbundle", "cmd/mkbundle/mkbundle.go"
|
|
end
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
`mkbundle` has been installed as `cfsslmkbundle` to avoid conflict
|
|
with Mono and other tools that ship the same executable.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"request.json").write <<~EOS
|
|
{
|
|
"CN" : "Your Certificate Authority",
|
|
"hosts" : [],
|
|
"key" : {
|
|
"algo" : "rsa",
|
|
"size" : 4096
|
|
},
|
|
"names" : [
|
|
{
|
|
"C" : "US",
|
|
"ST" : "Your State",
|
|
"L" : "Your City",
|
|
"O" : "Your Organization",
|
|
"OU" : "Your Certificate Authority"
|
|
}
|
|
]
|
|
}
|
|
EOS
|
|
shell_output("#{bin}/cfssl genkey -initca request.json > response.json")
|
|
response = JSON.parse(File.read(testpath/"response.json"))
|
|
assert_match(/^-----BEGIN CERTIFICATE-----.*/, response["cert"])
|
|
assert_match(/.*-----END CERTIFICATE-----$/, response["cert"])
|
|
assert_match(/^-----BEGIN RSA PRIVATE KEY-----.*/, response["key"])
|
|
assert_match(/.*-----END RSA PRIVATE KEY-----$/, response["key"])
|
|
end
|
|
end
|