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.2.tar.gz"
|
|
sha256 "69ddddb25beebe65e6fe316b9ab3472eae1cd21b2f377447ddc104624233e419"
|
|
head "https://github.com/cloudflare/cfssl.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "fcb0d745472f74dd799bfff8099a2330a8262fb24358a679b4dd417c8ef0552b" => :high_sierra
|
|
sha256 "046cddc312759ba84d66a0f0242eb32aa54b4015011ce8ebb7d8e0978306e1e9" => :sierra
|
|
sha256 "c354f5d2b7767ccd9ec5b50901a7be8e541f1ba0eb6c7c3d2ddc3b89ea3fb574" => :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
|