class Openvpn < Formula desc "SSL/TLS VPN implementing OSI layer 2 or 3 secure network extension" homepage "https://openvpn.net/index.php/download/community-downloads.html" url "https://swupdate.openvpn.org/community/releases/openvpn-2.4.8.tar.xz" mirror "https://build.openvpn.net/downloads/releases/openvpn-2.4.8.tar.xz" sha256 "fb8ca66bb7807fff595fbdf2a0afd085c02a6aa47715c9aa3171002f9f1a3f91" bottle do sha256 "5d765e9c0b189897133a930ab956c4a861bf36532a225b7d11a4f19cfba91a26" => :catalina sha256 "c4216f771502095c9ef56440c4c6061d907100ad9530bd4f3e9ac8beb98a743e" => :mojave sha256 "3be2664f28a1df4bd39f4f70b68274efa08d02338572aa857820692a0f50f116" => :high_sierra end depends_on "pkg-config" => :build depends_on "lz4" depends_on "lzo" # Requires tuntap for < 10.10 depends_on :macos => :yosemite depends_on "openssl@1.1" depends_on "pkcs11-helper" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--with-crypto-library=openssl", "--enable-pkcs11", "--prefix=#{prefix}" system "make", "install" inreplace "sample/sample-config-files/openvpn-startup.sh", "/etc/openvpn", "#{etc}/openvpn" (doc/"samples").install Dir["sample/sample-*"] (etc/"openvpn").install doc/"samples/sample-config-files/client.conf" (etc/"openvpn").install doc/"samples/sample-config-files/server.conf" # We don't use mbedtls, so this file is unnecessary & somewhat confusing. rm doc/"README.mbedtls" end def post_install (var/"run/openvpn").mkpath end plist_options :startup => true def plist; <<~EOS Label #{plist_name} ProgramArguments #{opt_sbin}/openvpn --config #{etc}/openvpn/openvpn.conf OnDemand RunAtLoad TimeOut 90 WatchPaths #{etc}/openvpn WorkingDirectory #{etc}/openvpn EOS end test do system sbin/"openvpn", "--show-ciphers" end end