GithubHelp home page GithubHelp logo

mvpk666 / aad-login Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bureado/aad-login

0.0 2.0 0.0 144 KB

Allows Linux user authentication to Azure AD via pam_exec

License: Apache License 2.0

Shell 37.64% JavaScript 62.36%

aad-login's Introduction

aad-login

Allows Linux user authentication to Azure AD via pam_exec

Prerequisites

  • An Azure AD directory has been created, and some users exist
  • Node.js and npm are installed in the Linux VM
  • A directory application has been created (native client type) and you have the Client ID
  • Your PAM distribution has pam_exec.so

User provisioning

This utility doesn't provision the user. In other words, you need to ensure the user you'll be logging in with is visible by NSS. A simple sudo useradd -m <user> might be enough for a handful of users.

An exception of this would be the aad-login-self-provisioning script which attempts to create the user upon a failed getent. This is experimental. Ideally you are doing this to delegate management of your Linux VMs and therefore will be using groups (like sudo) to delegate requiring you to provision the user beforehand.

Installing

You can download the tarfile and:

sudo tar xzf aad-login_0.1.tar.gz -C /
cd /opt/aad-login
sudo npm install

Configuring

First, open /opt/aad-login/aad-login.js with your favorite editor and put your directory and client ID in.

Then, open /etc/pam.d/common-auth and add:

auth sufficient pam_exec.so expose_authtok /usr/local/bin/aad-login

ideally at the beginning of your ruleset. Other rules might need to use try_firstpass for convenience.

CentOS doesn't have common-auth so you need to include this rule in the relevant PAM file, such as /etc/pam.d/sshd or /etc/pam.d/system-auth.

Caveats

A freshly created user will have a temporary password that has to be changed via the portal. A convenient way to get this done is to visit portal.azure.com (even if you don't have an Azure account) with those credentials and change them before attempting to SSH.

In CentOS 7.x (and other SELinux-enabled distros) you need to disable the policy:

sudo setenforce 0

The self-provisioning beta doesn't guarantee UID consistency across VMs, nor delegates access to groups like sudo. Therefore, an important TODO is to detect group membership.

Warnings

This is sample code and comes with no warranties.

Tested in Ubuntu 14.04. Any changes to common-auth might result in unexpected behaviour in authentication including multiple password prompts and inability to join with local credentials.

aad-login's People

Contributors

bureado 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.