• Stars
    star
    341
  • Rank 121,426 (Top 3 %)
  • Language
    C
  • Created over 13 years ago
  • Updated 29 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Duo two-factor authentication for Unix systems

Duo Unix

Build Status Issues Forks Stars License

Duo two-factor authentication for Unix systems.

Duo Unix includes a PAM module or alternatively a stand alone executable that can be used to protect programs such as SSH or Sudo.

This repository is meant to be used for development or cutting edge versions of Duo Unix. For production deployments Duo recommends using our stable release tarballs or packages. Instructions can be found on our documentation page Duo Unix Docs

Getting Started

These instructions are geared towards getting you up and running on your local machine for development and testing purposes. See the deployment section for notes on how to deploy Duo Unix in production.

Prerequisites

You will likely want to have some kind of virtual machine when developing Duo Unix. If Duo Unix is configured incorrectly it has the potential to lock you out of a system. It's better to have that happen on a virtual machine instead of your computer.

We recommend something like Vagrant or Docker

Installing

Install the necessary third party libraries.

  • Debian based Systems
$ sudo apt-get install autoconf libtool libpam-dev libssl-dev make
  • RHEL based systems
$ sudo yum install autoconf libtool pam-devel openssl-devel
  • RHEL 7 and CentOS 7 systems with SELinux enabled
$ sudo yum install selinux-policy-devel bzip2

Clone the Duo Unix project down and enter the directory

$ git clone <paste the url here>
$ cd duo_unix/

Run bootstrap to generate the configure script.

$ ./bootstrap

Run configure to generate your makefiles.

$ ./configure --with-pam --prefix=/usr

Build the project locally

$ make

Install the project. The install location will be the same as the prefix you specified in the configure step.

$ sudo make install

After installation add your integration keys to the config files

  • Visit the Duo Admin Panel and create a "Unix" integration if you don't have one already
  • Copy your ikey, skey, and api_host into the proper fields of the config files
$ vim /etc/duo/login_duo.conf
$ vim /etc/duo/pam_duo.conf

Finally, test an auth!

$ sudo login_duo -f myusername 'echo "Hello World"'

You should only see "Hello World" if the authentication succeeds.

Running the tests

The additional prereq for running the tests is python

#  RHEL Based
$ sudo yum install python
#  Debian Based
$ sudo apt-get install python

To run all the automated tests simply run

$ sudo make check

To run an individual test file

$ cd tests/
$ python test_login_duo.py

To run an individual test suite

$ cd tests/
$ python test_login_duo.py TestLoginDuoConfig

To run an individual test case

$ cd tests/
$ python test_login_duo.py TestLoginDuoConfig.test_empty_args

Python Tests

For Duo Unix we use the python unittest library to do our testing. Each suite typically starts by creating a mock duo service. After we create that service we perform a series of tests to verify that this software is working as expected. Although we use the unittest library these are not truely "unit tests" as manage subprocesses and generally employ blackbox testing. The true "unit tests" for Duo Unix are the unity tests.

Testing with coverage

To generate coverate reports you'll need to compile Duo Unix with the --with-coverage options. Please note that in order to view HTML version of the coverage reports you'll also need to install the python package gcovr.

To see the testing coverage of the Duo PAM for example you would run the following at the repository root.

$ ./configure --with-coverage --with-pam
$ ./collect_coverage.sh
$ $BROWSER coverage/pam_duo.html

Note that configuring Duo Unix --with-coverage disables any compiler optimizations to allow the profiler to better match executed instructions with lines of code.

Other testing tips

Each test creates the mockduo server for you, but if you need to run it manually to test things you can. Below is an example of running a mockduo server in one session and authenticating against it in another.

$ cd tests/
$ python mockduo.py certs/mockduo.pem
Now in a separate terminal window
$ ../login_duo/login_duo -d -c confs/mockduo.conf -f my_username echo "Success"

This mock server can be a bit brittle so you may have to restart it if you start seeing very weird behavior.

Static analysis

Install cppcheck

$ cppcheck --quiet --force -i tests --suppressions-list=.false_positive.txt --error-exitcode=1 .

Deployment

For production deployments Duo recommends using our stable release tarballs or packages. Instructions can be found on our documentation page Duo Unix Docs

TLS 1.2 and 1.3 Support

Duo Unix uses the system's OpenSSL library for TLS operations. It will use the highest TLS version available when making API calls to Duo. TLS 1.2 support requires OpenSSL 1.0.1 or higher; TLS 1.3 support requires OpenSSL 1.1.1 or higher.

Contributing

Please read CODEOFCONDUCT.md and CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

License

This project is licensed under the GPLv2 License - see the LICENSE file for details

Support

Report any bugs, feature requests, etc. to [email protected]

More Repositories

1

duo_client_python

Python library for interacting with the Duo Auth, Admin, and Accounts APIs
Python
130
star
2

duo_python

Duo two-factor authentication for Python web applications
JavaScript
95
star
3

duo_php

Duo two-factor authentication for PHP web applications
JavaScript
83
star
4

duo_openvpn

Duo two-factor authentication for OpenVPN.
Python
65
star
5

duo_api_golang

Go
53
star
6

duo_nodejs

Duo two-factor authentication for web Node.js applications
JavaScript
46
star
7

duo_log_sync

Python
34
star
8

duo_wordpress

Duo two-factor authentication for WordPress logins
PHP
31
star
9

duo_java

Duo two-factor authentication for Java web applications
Java
30
star
10

duo_api_csharp

C#
30
star
11

duo_api_php

PHP
28
star
12

duo_dotnet

Duo two-factor authentication for ASP.NET web applications
JavaScript
28
star
13

duo_ruby

Duo two-factor authentication for Ruby web applications
JavaScript
26
star
14

duo_api_swift

Duo Security API Client for Swift
Objective-C
23
star
15

duo_client_java

Java
22
star
16

libduo

Duo two-factor authentication API in C
C
21
star
17

duo_universal_python

Duo OIDC-based two-factor authentication for Python web applications
Python
21
star
18

duo_universal_php

Duo OIDC-based two-factor authentication for PHP web applications
PHP
21
star
19

duo_api_nodejs

JavaScript
20
star
20

duo_openvpn_as

Python
19
star
21

duo_universal_csharp

Duo OIDC-based two-factor authentication for .NET web applications
C#
18
star
22

duo_shibboleth

Duo two-factor authentication for Shibboleth
Java
17
star
23

duo_confluence

Duo two-factor authentication for Confluence.
JavaScript
14
star
24

duo_api_ruby

Ruby
14
star
25

duo_web_sdk

Duo Web JavaScript in ES6 Module for easy install
JavaScript
14
star
26

duo_universal_nodejs

Duo OIDC-based two-factor authentication for NodeJS web applications
TypeScript
14
star
27

duo_universal_java

Duo OIDC-based two-factor authentication for Java web applications
Java
14
star
28

duo_jira

Duo two-factor authentication for Atlassian JIRA
JavaScript
12
star
29

ykpiv-ssh-agent-helper

A dumb little utility to streamline the use of ssh-agent with PIV-enabled YubiKeys on OS X.
Objective-C
12
star
30

duo_coldfusion

Duo two-factor authentication for ColdFusion web applications
JavaScript
10
star
31

puppet-duo_unix

Puppet
9
star
32

duo_perl

Duo two-factor authentication for Perl web applications
JavaScript
9
star
33

duo_splunk

Duo two-factor authentication for Splunk
Python
7
star
34

duo_universal_golang

Duo OIDC-based two-factor authentication for Go web applications
Go
7
star
35

duo_drupal

Duo two-factor authentication for Drupal 6.x/7.x sites
JavaScript
6
star
36

duo_api_perl

Perl
5
star
37

duo_mediawiki

Duo two-factor authentication for MediaWiki
JavaScript
4
star
38

duo_universal_atlassian

Duo two-factor authentication plugin for Jira or Confluence with the Duo Universal Prompt.
Java
3
star
39

duo_classicasp

Duo two-factor authentication for Classic ASP web applications
JavaScript
2
star
40

duo_universal_wordpress

Duo two-factor authentication plugin for Wordpress with the Duo Universal Prompt.
PHP
2
star
41

duo_oam_plugin

Duo integrates with Oracle Access Manager to add two-factor authentication to your single sign-on logins, complete with inline self-service enrollment and Duo Prompt.
Java
1
star