Git Product home page Git Product logo

macops-keychainminder's Introduction

Keychain Minder

Keychain Minder is a simple OS X SecurityAgentPlugin for monitoring keychain password synchronization in enterprise environments.

Ordinarily when users change their login password, OS X will update the login keychain to match. In enterprise environments, where the password is managed centrally and synchronized with the machine (via LDAP, AD, etc.) this doesn't happen. Instead, OS X has a built-in mechanism that appears after authenticating at the login window to prompt users to update their keychain passwords but many users don't know what a keychain is, don't understand the dialog or have forgotten their password.

Keychain Minder re-creates this built-in mechanism but does so for screensaver and preference pane unlock instead of login. Upon noticing the password does not work for unlocking the keychain, it will pop-up a dialog informing the user and giving them the option to either change the password (using both old and new passwords) or reset the keychain.

Testing

Keychain Minder is no longer in use at Google and while we will continue to maintain it as best as we can, it will not be as well tested on future OS releases. We will still be responding to issues and pull requests.

Keychain Minder has had very little testing so far but has been known to work on 10.9.5, 10.10.5 and 10.11.5.

There's no real reason it shouldn't work on 10.7 and 10.8, it just hasn't been tried. If you find it works, please let us know!

Screenshots

Welcome Known Password Unknown Password

Installation

Download the latest release from the Releases page. It's a standard Apple package, inside a disk image.

If you would like to customize the package there's a Makefile in the Package folder. You'll need The Luggage installed to build it.

By default the package installs KeychainMinder so that it works at the screensaver. In order to do this, it has to:

  1. Restore the screensaver login UI to an older-looking UI. SecurityAgentPlugins do not run under the newer loginwindow-like UI.
  2. Set the screensaver login policy to authenticate-session-owner.

The update_authdb.py script has options to change both of these behaviors.

Uninstallation

sudo /Library/Security/SecurityAgentPlugins/KeychainMinder.bundle/Contents/Resources/uninstall.sh

How it works

During every login the plugin is invoked. It does the following:

  1. Check that the right being authenticated is either system.login.screensaver or system.preferences.*
  2. Retrieve the username and password currently being authenticated.
  3. If both are true, it retrieves the logging in user's default keychain path, makes a temporary hardlink to this path, opens the 'new' keychain file and attempts to unlock it with the password from 2. It then removes this hardlink.
  4. Retrieves an array (encoded as a plist) from /Library/Preferences. It either adds or removes the currently authenticating user's name from this list depending on whether unlocking the keychain in step 3 was successful.

While all of this is happening, launchd is watching the plist file in step 4 for changes and whenever the file is changed, it launches an app embedded in the plugin. The app does the following:

  1. Checks that the currently logged-in user is in the preference file on disk. If not, it exits.
  2. Displays a simple UI explaining that the keychain password is out of sync and asking the user if they remember their previous password. 3a. If the user remembers their password, it asks for both old and new password, validates them both and then updates the login keychain password using SecKeychainChangePassword. This undocumented function from the Security framework will update both the login keychain and Local Items keychain. 3b. If the user does not remember their password, it asks for the new password, validates it is the same as their login password and then resets the login keychain using this new password using SecKeychainResetLogin. This undocumented function from the Security framework will reset both the login and Local Items keychains using the provided password.

The hardlink/open/unlock/unlink dance used in both the plugin and UI app are to avoid locking the Local Items keychain, as doing so can cause issues when trying to update the password or reset.

The undocumented functions used to update the password or reset the keychain could stop working at any time, though the same functions are used by Keychain Access.

Acknowledgements

Thanks to @tomjburgin for inspiration and help getting the plugin working at the screensaver.

macops-keychainminder's People

Contributors

howiekaye avatar marczak avatar prizz avatar russellhancox avatar tburgin avatar verycarefully avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macops-keychainminder's Issues

Pre-compiled Package?

Do you supply an already compiled and packaged mac installer for this?

Thanks,
Ken

Incorrect uninstall path in readme

Hi there,

Noticed that the keychainminder readme gives this path to the uninstallation script:

/Library/SecurityAgentPlugins/KeychainMinder.bundle/Contents/Resources/uninstall.sh

Believe this should actually be:

/Library/Security/SecurityAgentPlugins/KeychainMinder.bundle/Contents/Resources/uninstall.sh

Feature Request: Check 'Local Items Keychain' independently from 'Login Keychain'

We have an issue with people who change their password on their mac due to being prompted by the OS.
This has the effect of successfully updating their Login Keychain password, but still leaves the Local Items keychain with the old password.

This software appears to be checking the Login keychain and then changing both keychains if they are out-of-sync - thereby assuming that both keychains have the same password. Would it be possible for this, instead, to check each of the keychains separately and set the passwords for those that are actually out-of-sync?

Keychain GUI appears if an account other than the logged-in account is used to authenticate.

From @rtrouton on August 19, 2015 13:5

I'm seeing an issue where, if I'm logged into a user account and click on a lock in System Preferences, then log in using another account's admin credentials, the Keychain Minder GUI pops up.

To reproduce:

  1. Set up two accounts, where one has admin rights and the other does not.
  2. Log in as the account that does not have admin rights.
  3. Open System Preferences
  4. Click a lock
  5. Log into the authentication dialog using the account with admin rights' credentials.

Expected behavior:

A. Lock unlocks
B. Keychain Minder GUI does not appear

Observed behavior:

  1. Lock unlocks
  2. Keychain Minder GUI appears.

Note: I was also able to reproduce the behavior when both accounts had admin rights, but I figured the above scenario was the more common of the two.

Copied from original issue: google/macops#39

Pre-packaged version?

Hi all. I am unfamiliar with The Luggage but have still tried to package Keychain Minder with no success. Does anyone have a pre-packaged version of the latest Keychain Minder that they could share?

Thanks!
Scott

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.