Merge pull request #207020 from Homebrew/bump-qpdf-11.10.0
[Homebrew/homebrew-core.git] / Formula / g / google-authenticator-libpam.rb
blobdb50d721ae14900a55af506b692d4b0ad7ea6973
1 class GoogleAuthenticatorLibpam < Formula
2   desc "PAM module for two-factor authentication"
3   homepage "https://github.com/google/google-authenticator-libpam"
4   url "https://github.com/google/google-authenticator-libpam/archive/refs/tags/1.10.tar.gz"
5   sha256 "6fe08e7a73ed8f176569c3ad6ad95a5677873e59300d463a2d962c92685a8596"
6   license "Apache-2.0"
8   bottle do
9     sha256 cellar: :any,                 arm64_sequoia:  "0fa32fdd385e9319cee1c3acb1101789a37dcbb1fa8d215ab4a919c9ff830008"
10     sha256 cellar: :any,                 arm64_sonoma:   "c130f29a24800a76d13547a22463c9ad4ee38214760ab53e9f3962b00d4493a1"
11     sha256 cellar: :any,                 arm64_ventura:  "c37f8bf7b51cc2be2491a9d8fceabcbdbf9bea26e401bc36bae438327f3f947e"
12     sha256 cellar: :any,                 arm64_monterey: "7050f1ebe26b7ca31601eef8cab6231b9b0e8856e59d9c47c4d2bce99803e8c8"
13     sha256 cellar: :any,                 sonoma:         "2043b4d7e700e9716e2e20c7289794e3f744db11e33f8ff97531d884f9a78ace"
14     sha256 cellar: :any,                 ventura:        "a08e6a718f468c1ccc218258ad304b57dec57a14a7dd4384c00edcf6ae45548a"
15     sha256 cellar: :any,                 monterey:       "e59df1d930b00b2caf4f03e9b2e9c0a6f0502706e98bb1f2c0873d96ce9f7a32"
16     sha256 cellar: :any_skip_relocation, x86_64_linux:   "9d9a5c7680d94e3ff83b8c38eec4450c933e15d9135b7e270508f500b0ebe920"
17   end
19   depends_on "autoconf" => :build
20   depends_on "automake" => :build
21   depends_on "libtool" => :build
22   depends_on "qrencode"
24   on_linux do
25     depends_on "linux-pam"
26   end
28   def install
29     ENV.append "LDFLAGS", "-Wl,-rpath,#{Formula["qrencode"].lib}"
30     system "./bootstrap.sh"
31     system "./configure", *std_configure_args,
32                           "--disable-silent-rules"
33     system "make", "install"
34   end
36   def caveats
37     <<~EOS
38       Add 2-factor authentication for ssh:
39         echo "auth required #{opt_lib}/security/pam_google_authenticator.so" \\
40         | sudo tee -a /etc/pam.d/sshd
42       Add 2-factor authentication for ssh allowing users to log in without OTP:
43         echo "auth required #{opt_lib}/security/pam_google_authenticator.so" \\
44         "nullok" | sudo tee -a /etc/pam.d/sshd
46       (Or just manually edit /etc/pam.d/sshd)
47     EOS
48   end
50   test do
51     system bin/"google-authenticator", "--force", "--time-based",
52            "--disallow-reuse", "--rate-limit=3", "--rate-time=30",
53            "--window-size=3", "--no-confirm"
54   end
55 end