72 lines
2.5 KiB
Ruby
72 lines
2.5 KiB
Ruby
class Stunnel < Formula
|
|
desc "SSL tunneling program"
|
|
homepage "https://www.stunnel.org/"
|
|
url "https://www.stunnel.org/downloads/stunnel-5.47.tar.gz"
|
|
mirror "https://www.usenix.org.uk/mirrors/stunnel/stunnel-5.47.tar.gz"
|
|
sha256 "c4e675db996eb92beef885f72a3ed8af3c7603fea6b99d2873198dd6c0021d0b"
|
|
|
|
bottle do
|
|
sha256 "91379758b74e62f92d2f8c5fcc3a7be31eb17599223d292f285286fdd38287fe" => :high_sierra
|
|
sha256 "791ef871a8083b47c5dd928cbed1ce86047fcadcfa2b47e104413af69e16aaf1" => :sierra
|
|
sha256 "c15d117f60c1d243ce8b0e5353b9160676988eb5157a4f179a2453edaac7144a" => :el_capitan
|
|
end
|
|
|
|
depends_on "openssl"
|
|
|
|
def install
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}",
|
|
"--sysconfdir=#{etc}",
|
|
"--localstatedir=#{var}",
|
|
"--mandir=#{man}",
|
|
"--disable-libwrap",
|
|
"--disable-systemd",
|
|
"--with-ssl=#{Formula["openssl"].opt_prefix}"
|
|
system "make", "install"
|
|
|
|
# This programmatically recreates pem creation used in the tools Makefile
|
|
# which would usually require interactivity to resolve.
|
|
cd "tools" do
|
|
args = %w[req -new -x509 -days 365 -rand stunnel.rnd -config
|
|
openssl.cnf -out stunnel.pem -keyout stunnel.pem -sha256 -subj
|
|
/C=PL/ST=Mazovia\ Province/L=Warsaw/O=Stunnel\ Developers/OU=Provisional\ CA/CN=localhost/]
|
|
system "dd", "if=/dev/urandom", "of=stunnel.rnd", "bs=256", "count=1"
|
|
system "#{Formula["openssl"].opt_bin}/openssl", *args
|
|
chmod 0600, "stunnel.pem"
|
|
(etc/"stunnel").install "stunnel.pem"
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
A bogus SSL server certificate has been installed to:
|
|
#{etc}/stunnel/stunnel.pem
|
|
|
|
This certificate will be used by default unless a config file says otherwise!
|
|
Stunnel will refuse to load the sample configuration file if left unedited.
|
|
|
|
In your stunnel configuration, specify a SSL certificate with
|
|
the "cert =" option for each service.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"tstunnel.conf").write <<~EOS
|
|
cert = #{etc}/stunnel/stunnel.pem
|
|
|
|
setuid = nobody
|
|
setgid = nobody
|
|
|
|
[pop3s]
|
|
accept = 995
|
|
connect = 110
|
|
|
|
[imaps]
|
|
accept = 993
|
|
connect = 143
|
|
EOS
|
|
|
|
assert_match "successful", pipe_output("#{bin}/stunnel #{testpath}/tstunnel.conf 2>&1")
|
|
end
|
|
end
|