Changes between Version 11 and Version 12 of HOWTO


Ignore:
Timestamp:
07/25/14 14:28:11 (10 years ago)
Author:
Samuli Seppänen
Comment:

Fixed formatting up to "How to add dual-factor authentication to an OpenVPN configuration using client-side smart cards"

Legend:

Unmodified
Added
Removed
Modified
  • HOWTO

    v11 v12  
    663663OpenVPN 2.0 and later include a feature that allows the OpenVPN server to securely obtain a username and password from a connecting client, and to use that information as a basis for authenticating the client.
    664664
    665 To use this authentication method, first add the auth-user-pass directive to the client configuration. It will direct the OpenVPN client to query the user for a username/password, passing it on to the server over the secure TLS channel.
     665To use this authentication method, first add the '''auth-user-pass''' directive to the client configuration. It will direct the OpenVPN client to query the user for a username/password, passing it on to the server over the secure TLS channel.
    666666
    667667Next, configure the server to use an authentication plugin, which may be a script, shared object, or DLL. The OpenVPN server will call the plugin every time a VPN client tries to connect, passing it the username/password entered on the client. The authentication plugin can control whether or not the OpenVPN server allows the client to connect by returning a failure (1) or success (0) value.
    668 Using Script Plugins
     668
     669== Using Script Plugins ==
    669670
    670671Script plugins can be used by adding the auth-user-pass-verify directive to the server-side configuration file. For example:
    671 
    672     auth-user-pass-verify auth-pam.pl via-file
    673 
    674 will use the auth-pam.pl perl script to authenticate the username/password of connecting clients. See the description of auth-user-pass-verify in the manual page for more information.
    675 
    676 The auth-pam.pl script is included in the OpenVPN source file distribution in the sample-scripts subdirectory. It will authenticate users on a Linux server using a PAM authentication module, which could in turn implement shadow password, RADIUS, or LDAP authentication. auth-pam.pl is primarily intended for demonstration purposes. For real-world PAM authentication, use the openvpn-auth-pam shared object plugin described below.
    677 Using Shared Object or DLL Plugins
    678 
    679 Shared object or DLL plugins are usually compiled C modules which are loaded by the OpenVPN server at run time. For example if you are using an RPM-based OpenVPN package on Linux, the openvpn-auth-pam plugin should be already built. To use it, add this to the server-side config file:
    680 
    681     plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so login
    682 
     672{{{
     673auth-user-pass-verify auth-pam.pl via-file
     674}}}
     675will use the auth-pam.pl perl script to authenticate the username/password of connecting clients. See the description of '''auth-user-pass-verify''' in the manual page for more information.
     676
     677The '''auth-pam.pl''' script is included in the OpenVPN source file distribution in the sample-scripts subdirectory. It will authenticate users on a Linux server using a PAM authentication module, which could in turn implement shadow password, RADIUS, or LDAP authentication. auth-pam.pl is primarily intended for demonstration purposes. For real-world PAM authentication, use the openvpn-auth-pam shared object plugin described below.
     678
     679== Using Shared Object or DLL Plugins ==
     680
     681Shared object or DLL plugins are usually compiled C modules which are loaded by the OpenVPN server at run time. For example if you are using an RPM-based OpenVPN package on Linux, the '''openvpn-auth-pam''' plugin should be already built. To use it, add this to the server-side config file:
     682{{{
     683plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so login
     684}}}
    683685This will tell the OpenVPN server to validate the username/password entered by clients using the login PAM module.
    684686
    685 For real-world production use, it's better to use the openvpn-auth-pam plugin, because it has several advantages over the auth-pam.pl script:
    686 
    687     The shared object openvpn-auth-pam plugin uses a split-privilege execution model for better security. This means that the OpenVPN server can run with reduced privileges by using the directives user nobody, group nobody, and chroot, and will still be able to authenticate against the root-readable-only shadow password file.
    688     OpenVPN can pass the username/password to a plugin via virtual memory, rather than via a file or the environment, which is better for local security on the server machine.
    689     C-compiled plugin modules generally run faster than scripts.
    690 
    691 If you would like more information on developing your own plugins for use with OpenVPN, see the README files in the plugin subdirectory of the OpenVPN source distribution.
    692 
    693 To build the openvpn-auth-pam plugin on Linux, cd to the plugin/auth-pam directory in the OpenVPN source distribution and run make.
    694 Using username/password authentication as the only form of client authentication
    695 
    696 By default, using auth-user-pass-verify or a username/password-checking plugin on the server will enable dual authentication, requiring that both client-certificate and username/password authentication succeed in order for the client to be authenticated.
     687For real-world production use, it's better to use the '''openvpn-auth-pam''' plugin, because it has several advantages over the '''auth-pam.pl''' script:
     688
     689 * The shared object '''openvpn-auth-pam''' plugin uses a split-privilege execution model for better security. This means that the OpenVPN server can run with reduced privileges by using the directives user '''nobody, group nobody''', and '''chroot''', and will still be able to authenticate against the root-readable-only shadow password file.
     690 * OpenVPN can pass the username/password to a plugin via virtual memory, rather than via a file or the environment, which is better for local security on the server machine.
     691 * C-compiled plugin modules generally run faster than scripts.
     692
     693If you would like more information on developing your own plugins for use with OpenVPN, see the '''README''' files in the '''plugin''' subdirectory of the OpenVPN source distribution.
     694
     695To build the '''openvpn-auth-pam''' plugin on Linux, cd to the '''plugin/auth-pam''' directory in the OpenVPN source distribution and run make.
     696
     697== Using username/password authentication as the only form of client authentication ==
     698
     699By default, using '''auth-user-pass-verify''' or a username/password-checking '''plugin''' on the server will enable dual authentication, requiring that both client-certificate and username/password authentication succeed in order for the client to be authenticated.
    697700
    698701While it is discouraged from a security perspective, it is also possible to disable the use of client certificates, and force username/password authentication only. On the server:
    699 
    700     client-cert-not-required
    701 
     702{{{
     703client-cert-not-required
     704}}}
    702705Such configurations should usually also set:
    703 
    704     username-as-common-name
    705 
     706{{{
     707username-as-common-name
     708}}}
    706709which will tell the server to use the username for indexing purposes as it would use the Common Name of a client which was authenticating via a client certificate.
    707710
    708 Note that client-cert-not-required will not obviate the need for a server certificate, so a client connecting to a server which uses client-cert-not-required may remove the cert and key directives from the client configuration file, but not the ca directive, because it is necessary for the client to verify the server certificate.
    709 How to add dual-factor authentication to an OpenVPN configuration using client-side smart cards
     711Note that '''client-cert-not-required''' will not obviate the need for a server certificate, so a client connecting to a server which uses '''client-cert-not-required''' may remove the '''cert''' and '''key''' directives from the client configuration file, but not the ca directive, because it is necessary for the client to verify the server certificate.
     712= How to add dual-factor authentication to an OpenVPN configuration using client-side smart cards =
    710713
    711714Also see Article: The OpenVPN Smartcard HOWTO