aad-for-linux / pam_aad

Azure Active Directory PAM Module
GNU General Public License v3.0
22 stars 9 forks source link

Python Implementation #13

Closed oxr463 closed 1 year ago

oxr463 commented 2 years ago

pam_aad.py

import json
import logging
import os
import sys
import adal

with open('/etc/pam_aad.conf', 'r') as f:
    config = json.loads(f.read())

if (config['debug']):
    logging.basicConfig(level=logging.DEBUG)

GRAPH_URL = 'https://graph.microsoft.com'

Source: https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/dev/sample/device_code_sample.py

# Install missing dependency
pip install adal

# Run
sudo python3 pam_aad.py

It can then be called either via pam_exec or openvpn_defer_auth, (See: #39 (comment)).

See: https://github.com/AzureAD/azure-activedirectory-library-for-python

Source: https://github.com/CyberNinjas/pam_aad/issues/41

oxr463 commented 2 years ago

Reference(s):