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.2.tar.xz" mirror "https://build.openvpn.net/downloads/releases/openvpn-2.4.2.tar.xz" sha256 "df5c4f384b7df6b08a2f6fa8a84b9fd382baf59c2cef1836f82e2a7f62f1bff9" bottle do sha256 "a5a6702461c9cfeed907c9ef9dcc6e52a8d7518a4c51c15ba8eea5a1340d1ba9" => :sierra sha256 "3a1cddedd2d3d4677427152274bd293914ed162aa1fd956073f5c92c55a29dbb" => :el_capitan sha256 "9ea5b9133b56e6b36c9de3c512a24d28fb171b4420150ea3672525a5ff1187a6" => :yosemite end # Requires tuntap for < 10.10 depends_on :macos => :yosemite depends_on "pkg-config" => :build depends_on "lzo" depends_on "openssl" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--with-crypto-library=openssl", "--prefix=#{prefix}" system "make", "install" # Install OpenVPN's new contrib helper allowing the use of # macOS keychain certificates with OpenVPN. cd "contrib/keychain-mcd" do system "make" sbin.install "keychain-mcd" man8.install "keychain-mcd.8" end 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 PolarSSL, so this file is unnecessary & somewhat confusing. rm doc/"README.polarssl" end def post_install (var/"run/openvpn").mkpath end plist_options :startup => true def plist; <<-EOS.undent 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