Name Last Update
.gitignore Loading commit data...
LICENSE.txt Loading commit data...
README.md Loading commit data...
duo_api.py Loading commit data...
duo_api.tmpl Loading commit data...
duo_library.py Loading commit data...
requirements.txt Loading commit data...

README.md

DUO scripts

This repository contains a few scripts to interact with DUO, a multi-factor authentication solutions acquired by Cisco.

Although DUO provides many ways to integrate it and various client libraries, this was not sufficient (or too heavy) for some of the private / not for profit environments I use it with a free (i.e. max 10 user) subscription.

The latest versions, documentation and bugtracker are available on my GitLab instance

Copyright (c) 2019 Frederik Lindenaar. free for distribution under the GNU General Public License, see below

Contents

This repository contains the following scripts:

  • duo_api.py pure Python3 implementation of the DUO client using only standard libraries (i.e. not requiring external libraries) with examples
  • duo_library.py simple example to trigger authentication using DUO's Python client library

Run pydoc <scriptname> for the documentation of each script.

duo_api.py

This Python script implements the client side of the DUO API using only default installed python3 libaries (i.e. no DUO library) and can be used without the need to install other libraries and outside a virtualenv.

The script could be used as library itself though that would defeat the whole purpose (apart from it being very simple/small) but it intended as starting point / template to implement you own custom logic directly. It contains a number of examples of the implemented direct and config-based method to start.

To run the config-file implementation of the client create a config file named duo_api.conf in the same directory as the script using the provided template duo_api.tmpl and configure it for your environment and run it. To use it without config file, comment out the settings and code provided for that, set the configuration values for your environment and run it.

duo_library.py

Sample python script using the DUO API library for python to perform some simple requests to test it and as template to implement a simple client using this library. The logic implemented in this file matches that of the pure Python3 implementation of the API client in duo_api.py to compare them and decide how best to integrate with DUO in your environment. To run this example:

  1. create a virtualenv in this directory with: virtualenv .
  2. activate the virtualenv with: . ./bin/activate
  3. install the required libraries with: pip install -r requirements.txt
  4. update this script and provide your API host, ikey and skey
  5. run the script: python3 duo_library.py

License

These scripts, documentation & configration examples are free software: you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This script, documenatation and configuration examples are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, download it from http://www.gnu.org/licenses/.