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.1.tar.gz"
|
|
sha256 "3d0e409d30d41d797974559ae782a11e6823f38f5000544e604058cd43726528"
|
|
head "https://github.com/cloudflare/cfssl.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "e234b37b5cd985fce65227a810df2ceffd40922155e687e47ec84a470f9efd72" => :high_sierra
|
|
sha256 "474d8c8a9a28ba8ae217382efcf5161742ca7f992ce3fc40a14bbc9686b036d0" => :sierra
|
|
sha256 "9c2fc7027b2136c1d228a84f0abd1bfe80c542f89b650ae864f792e9fc63f3fb" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "libtool"
|
|
|
|
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
|