openvpn/sample/sample-plugins/client-connect
Frank Lichtenheld ad73d827d3 Update GPL header in all source files to current recommended version
This removes the postal address of the FSF and replaces
it with their URL.

Mostly generated with
sed -i -e 's@if not, write to the Free Software Foundation, Inc.,\
            @if not, see <https://www.gnu.org/licenses/>.@'
sed -i -e '/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA/d'
sed -i -e '/59 Temple Place, Suite 330, Boston, MA  02111-1307  USA/d'

With some manual fix-ups afterwards.

Change-Id: Ic3959970fa9ab993e98d4b38c025fd0efc7b92f2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250803145126.23494-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32481.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2025-08-03 16:55:47 +02:00
..
README Add demo plugin that excercises "CLIENT_CONNECT" and "CLIENT_CONNECT_V2" paths 2020-09-18 07:54:10 +02:00
sample-client-connect.c Update GPL header in all source files to current recommended version 2025-08-03 16:55:47 +02:00

OpenVPN plugin examples.

Examples provided:

sample-client-connect.c

  - hook to all plugin hooks that openvpn offers
  - log which hook got called
  - on CLIENT_CONNECT or CLIENT_CONNECT_V2 set some config variables
    (controlled by "setenv plugin_cc_config ..." and "plugin_cc2_config"
    in openvpn's config)

  - if the environment variable UV_WANT_CC_FAIL is set, fail
  - if the environment variable UV_WANT_CC_DISABLE is set, reject ("disable")
  - if the environment variable UV_WANT_CC_ASYNC is set, go to
    asynchronous/deferred mode on CLIENT_CONNECT, and sleep for
    ${UV_WANT_CC_ASYNC} seconds

  - if the environment variable UV_WANT_CC2_FAIL is set, fail CC2
  - if the environment variable UV_WANT_CC2_DISABLE is set, reject ("disable")
  - if the environment variable UV_WANT_CC2_ASYNC is set, go to
    asynchronous/deferred mode on CLIENT_CONNECT_V2, and sleep for
    ${UV_WANT_CC2_ASYNC} seconds

    (this can be client-controlled with --setenv UV_WANT_CC_ASYNC nnn
     etc. --> for easy testing server code paths)

To build for unixy platforms (not very sophisticated right now, needs gmake):

  .../sample-plugins$ gmake client-connect/sample-client-connect.so

(This plugin has not been tested on Windows, and might not even work due
to its use of fork() and wait().  Let us know if it does or needs patches)


To use in OpenVPN, add to config file:

  plugin sample-client-connect.so (Linux/BSD/etc.)