Skip to content

Instantly share code, notes, and snippets.

@mgax
Created May 8, 2016 17:02
Show Gist options
  • Save mgax/2f1a3e275a85558764c71e00389a2843 to your computer and use it in GitHub Desktop.
Save mgax/2f1a3e275a85558764c71e00389a2843 to your computer and use it in GitHub Desktop.
Homebrew formula for google-authenticator
class GoogleAuthenticator < Formula
desc "Google Authenticator PAM module"
homepage "https://github.com/google/google-authenticator"
head "https://github.com/google/google-authenticator.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
def install
cd "libpam" do
system "./bootstrap.sh"
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
end
def caveats; <<-EOS.undent
For SSH two-factor authentication, add the following line to /etc/pam.d/sshd:
auth required /usr/local/lib/security/pam_google_authenticator.so nullok
Create a token:
google-authenticator --time-based --disallow-reuse --minimal-window --rate-limit=3 --rate-time=30 -f
EOS
end
test do
system "#{bin}/google-authenticator", "-h"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment