Giter Site home page Giter Site logo

wooodhead / sudo-touchid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattrajca/sudo-touchid

0.0 2.0 0.0 1.5 MB

A fork of `sudo` with Touch ID support.

Home Page: https://twitter.com/mattrajca

Makefile 2.97% C 57.27% Objective-C 0.32% Shell 31.60% Yacc 1.48% Prolog 0.01% M4 0.23% Perl 0.34% Groff 4.02% Pascal 0.45% Lex 0.78% C++ 0.53%

sudo-touchid's Introduction

sudo-touchid

sudo-touchid is a fork of sudo with Touch ID support on macOS (powered by the LocalAuthentication framework). Once compiled, it will allow you to authenticate sudo commands with Touch ID in the Terminal on supported Macs (such as the late 2016 MacBook Pros).

Since Darwin sources for macOS 10.12 are not available yet, this project is based on sudo sources corresponding to OS X 10.11.6 and obtained from opensource.apple.com.

Warnings

Please note:

  • This version of sudo is based on OS X 10.11.6 sources. I am not sure if enough has changed in macOS 10.12 to cause any malfunctions.
  • I am not a security expert. While I am using this as a fun experiment on my personal computer, your security needs may vary.

Building

To build sudo-touchid, simply open the included Xcode project file with Xcode 8+, select the Build All target, and click Build.

Running

If we try running our newly-built sudo executable now, we'll get an error:

sudo must be owned by uid 0 and have the setuid bit set

To fix this, we can use our system's sudo command and the chown/chmod commands to give our newly-built sudo the permissions it needs:

cd (built-products-directory)

sudo chown root:wheel sudo && sudo chmod 4755 sudo

Now if we try running our copy of sudo, it should work:

cd (built-products-directory)

./sudo -s

If you don't have a Mac with a biometric sensor, sudo-touchid will fall back to the regular password prompt. If you'd still like to test whether the LocalAuthentication framework is working correctly, you can change the kAuthPolicy constant from LAPolicyDeviceOwnerAuthenticationWithBiometrics to LAPolicyDeviceOwnerAuthentication in the code. This will present a dialog box asking the user for his or her password:

While not useful in practice, you can use this to verify that the LocalAuthentication code does in fact work.

Installing

Replacing the system's sudo program is quite risky (can prevent your Mac from booting) and requires disabling System Integrity Protection (aka "Rootless").

Instead of replacing sudo, we can install our build under /usr/local/bin and give the path precedence over /usr/bin, this way our build is found first.

sudo cp (built-products-directory)/sudo /usr/local/bin/sudo

sudo chown root:wheel /usr/local/bin/sudo && sudo chmod 4755 /usr/local/bin/sudo

You can set up your PATH by adding export PATH=/usr/local/bin:$PATH to .bashrc (thanks @edenzik).

Now you should be able to enter sudo in any Terminal (or iTerm) window and authenticate with Touch ID!

sudo-touchid's People

Contributors

mattrajca avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.