SecSign ID Plugin: Unix PAM - Integration Tutorial

2016-11-28 5 minutes to read

Two-Factor Authentication for PAM

The Pluggable Authentication Modules (PAM) is a software library which offers a general programming interface for authentication services. By using the PAM-API one does no longer need to define the settings for every single authentication application. Instead, individual standarized modules can be used. The modules can be assigned to individual services in the configuration file. There is no need to change the compilation of the corresponding software. PAM is available for AIX, HP-UX, Solaris, Linux, FreeBSD, NetBSD, Mac OS X and DragonFly BSD.

PAM Overview
Integration

Integration of the plugin into your setup

SecSign ID Integration

Please configure your desired integration of the SecSign ID Two Factor Authentication

Choose a system, where you want to add the secure login

Do you need your own ID Server inside your protected network or prefer if we manage and maintain it for you

The location to save the assigned SecSign IDs to a user account or the IDM alltogether

System to protect
?
The System you want to protect - Choose a system, where you want to add the secure login
SecSign ID Server location
?
Do you need your own ID Server inside your protected network or prefer if we manage and maintain it for you
User account location
?
The system to save the assigned SecSign IDs to a user account or the IDM alltogether
edit the settings to change the integration
Authentication
2FA
2FA blind
2FA no AP
2SA
2SA no AP
2SA blind
OTP
Enrollment
Custom ID
Pattern
IDP Custom Website
Enrollment initiated by SP
Enrollment with IDM
Show Network
Hide Network
Fullscreen
Request Solution
x
The authentication was successful
Application

Areas of application

There are several areas of application for secure Two-Factor Authentication with the SecSign ID Pluggable Authentication Module.

We offer the SecSign ID RADIUS Proxy for authentication services using the RADIUS Server and Active Directory. This way the SecSign IDs are requested from the Active Directory as compared to the configuration file.

  • SSH
  • FTP
  • Apache HTTP Auth
  • Desktop Logins
Authentication Process

Authentication Process

The user provides, with an SSH connection for this example, his user name and password. He receives a push-notification to his smartphone within seconds, providing the service name and address of the service he wants to log in to. As soon as he confirms the request the SSH connection is established.

That is everything there is to do for the user to enjoy truly secure Two-Factor Authentication and prevent access to the system even with leaked password information.

That is how the authentication for the SSH example works:

pam-sequence-1

  1. A SSH client opens the SSH connection to the server.
  2. The SSHd application accepts the request and in turn places an authentication request to the PAM library.
  3. The corresponding configuration file is reviewed for the correct PAMs. In the example it is asked for the user password, just like for SSH connections.
  4. In the second step the SecSign ID PAM is called.
  5. The SecSign ID PAM loads the configuration file and looks for the corresponding user’s SecSign ID.
  6. In the next step the SecSign ID Server is notified about the SecSign ID authentication request.
  7. The SecSign ID Server sends a push-notification to the user’s smartphone.
  8. The user can now accept the login on his smartphone.
  9. The PAM requests the authentication status from the SecSign ID Server. If the login is accepted that information is forwarded to the PAM.
  10. The SecSign ID PAM evaluates the server’s answer and determines if the authentication is valid. The PAM status is sent to the PAM library if the authentication is verified.
  11. The PAM library checks for additional authentication routines and forwards the authentication confirmation to the application, in this case SSHd.
  12. SSHd receives confirmation from the PAM about the valid authentication and establishes a SSH connection.
Setup

Setup

Download the SecSign ID PAM archive and unpack it. The library contains four files:

  • Makefile: Is used to compile the source library
  • libsecsinid.c: C library for the SecSign ID Two-Factor Authentication
  • libsecsinid.h: Corresponding header-file with type definitions and function prototypes
  • secsignid.c: PAM to use the SecSign ID
  • secsignid.config: Comfiguration file which combines user name and corresponding SecSign ID

To compile and accurately render the program the following requirements must be met:

  • Unix Platform or Mac
  • gcc compiler
  • libcurl installed
  • libpam installed
  • Internet connection (the SecSignID server communicates via Port 443)

The gcc compiler and libcurl can be installed with Debian:

su
apt-get update
apt-get install build-essential
apt-get install curl 

and with Ubuntu:

sudo apt-get install libpam0g-dev 
sudo apt-get install libcurl4-gnutls-dev 

and with RHEL:

yum groupinstall "Development Tools"
yum install curl-devel
yum install pam.i686
yum install pam-devel

The easiest way to install the compiler gcc, libcurl and libpam on Mac OS X is via Homebrew.

PAM Configuration

PAM Configuration

The file secsignid.c contains configuration settings for the module. Paths to the configuration file and the log- and debug files can be adjusted.

Configuration file

The configuration file secsignid.config combines the user name and corresponding SecSign ID. The file should be stored at /etc/secsignid/secsignid.config or at a location with root- or admin access rights. The path to the configuration file is set in the file secsignid.c with the constant CONFIGFILE.

#define CONFIGFILE "/etc/secsignid/secsignid.config"

General Settings:
The SecSign ID transmits several details to the ID-Server, which in turn provides these to the user’s smartphone, including service name, the corresponding IP-address or URL:

# ID related settings, will be displayed on the users app
secservicename=testPAM_internal
secserviceaddress=your-url.com

Output:
The parameter secoutput determines if the console prints status messages like in the example below.

Start SecSignID 2FA ...
Press enter to proceed ...
SecSignID 2FA successful ...

If secoutput=1 the user will see the status messages and needs to press enter before authenticating (this is due to PAM buffering messages without a prompt).

If the parameter secoutputid is set to true, the users SecSign ID will be displayed during the login.

# displays that the 2FA has started [true|false]
secoutput=true

# displays the SecSignID at login [true|false]
secoutputid=true

Interval:
DThe PAM Plugin incorporates an interval function. After a successful login, this function skips the 2FA if a user attempts a new login in a given time frame (in minutes). This function is skipped if 0.

# skip 2FA if previous login was less than x minutes ago
secintervalmin=10

For the interval function to work, secsignid.c defines a path to a writable folder. Whenever a user successfully authenticates via 2FA, the PAM will create a file with the username and timestamp. For every login, PAM checks the timestamp of the last 2FA login and decides if another 2FA is needed. Make sure, that you create the folder and set the correct access rights.

#define INTERVALFILEFOLDER "/etc/secsignid/lockfiles/"

User Mapping with the Login Name:
If the user authenticates via SSH (for example), the administrator can decide if the user’s SecSign ID is the same as his login name or if the ID is set manually.

An automatic mapping with the login name is recommended for On-Premise ID Servers only. If you use the public Cloud ID Server, you have to use manual mapping.

# automatic secsign id user mapping, AD user name equals SecSignID [true|false]
# only recommended for On-Premise Servers setups, otherwise false
secadusername = true

Manual SecSign ID Mapping:
If you use the manual mapping, each user needs an entry with the following schema for mapping the linux username and the SecSignId:

# manual secsign id user mapping if secadusername=false
#username=secsignid
someLinuxUsername=someSecSignID
ID Server endpoints

If you want to use your own On-Premise ID Server, you can change the endpoints in libsecsignid.c. The predefined cloud endpoints are the following:

char *secSignIDServer  = "https://httpapi.secsign.com";
char *secSignIDServerFallback = "https://httpapi2.secsign.com";

Modify the urls to fit your On-Premise ID Server configuration.

Debugging

The library contains a debug modus, which releases any interface communication. That enables the verification of request transmission and requests for session status. To activate the debug modus the following constants have to be adjusted.

DEBUGTYPE specifies how the debug output is handled:

  • NO = No debugging
  • YES = Output on StdOut
  • FILEDEBUG = Output in file

DEBUGFILEPATH describes the path for the debug-file. The file has to be be writeable with the program. If no debug-file exists one is automatically generated.

#define DEBUGTYPE FILEDEBUG
#define DEBUGFILEPATH "/etc/secsignid/secsignid.debug" 
Logging

Logging is meant for interface error. Technical errors (for example wrong syntax for the parameter) and API error (for example nonexistent user) are logged. Logs are either defined in the Syslog or a separate file:

  • FILELOG = Errors are written in a file, the second parameter is the file name.
  • SYSLOG = Errors are written in the Syslog, the second parameter is ignored but must be present.
  • NO = No log is written, the second parameter is ignored but must be present.
#define LOGTYPE FILELOG
#define LOGFILEPATH "/etc/secsignid/secsignid.log" 
Compilation and Installation

Compilation and Installation

To compile the PAM open the shell or the terminal, respectively, switch to the unpacked directory containing the C-script and enter make. The program pam_secsignid.so is created.

The program can be compiled manually:

gcc -fPIC -DPIC -shared -rdynamic -o pam_secsignid.so secsignid.c libsecsignid.c -lcurl

After the successful compilation the file has to be stored in the PAM directory. Normally, it is /lib/security or /lib/x86_64-linux-gnu/security:

cp pam_secsignid.so /lib/security/pam_secsignid.so 

or

cp pam_secsignid.so /lib64/security/pam_secsignid.so 

Your own ID-Server

On premise installations of SecSign ID offer the flexibility to connect with your preferred servers, services, and devices. And you can customize the SecSign ID with your own organization’s branding.

Learn More
On Premise 2FA ID

Latest Blog Posts, Updates & Features

SecSign ID Server passed FIDO Certification

We are happy to announce that the SecSign ID server has passed the official FIDO certification program of the FIDO Alliance. This will allow you to use the complete FIDO2/WebAuthn standard for passwordless 2FA sign-ins in your exi ...

Mehr Lesen

Two-Factor Authentication with Fido2 / WebAuth

The FIDO2 Project is a set of standards developed by the FIDO Alliance and the World Wide Web Consortium (W3C) to create a strong authentication protocol for the web. It consist mainly of the WebAuth standard for the browser part ...

Mehr Lesen

Protecting the Home Office VPN with 2FA

In the recent weeks, home office work has increased potentially. And while employees are practicing social distancing from their home computer, attackers are working hard to exploit security issues in this situation that is unfami ...

Mehr Lesen
SecSign 2FA