Strongswan now supports PAM authentication

November 07, 2012 at 07:40 AM | categories: Centos, Sysadmin, RHEL, Linux, Tips, Security, IPSEC | View Comments

Strongswan release 5.0.1 includes a XAuth PAM plugin which requests username/password XAuth credentials and verifies them against Pluggable Authentication Modules (PAM).

This plugin is not enabled by default to enable it you need to add the following to your ./configure options

--enable-xauth-pam

You do require the pam development headers and libraries on your build machine to successfully compile.

System Configuration

The plugin is configurable in the strongswan.conf file, you are able to change the pam service that is used for authentication.

By default the login pam service is used for authentication.

I will create a new service called ipsec for demonstration.

charon {
    plugins{
        xauth-pam {
            pam_service = ipsec
        }
    }
}

The pam service configuration file is as follows.

#%PAM-1.0
# /etc/pam.d/ipsec
auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        required      pam_deny.so

account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3 type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

Now to use PAM authentication in your connections you set for XAuth:

rightauth2=xauth-pam

Hybrid Authentication:

rightauth=xauth-pam

You are good to go and should be able to use any pam module to authenticate your users to your VPN. The options are endless: SQL, LDAP, RADIUS, LOCAL etc.

Related articles


blog comments powered by Disqus