Book Image

OpenVPN 2 Cookbook

Book Image

OpenVPN 2 Cookbook

Overview of this book

Table of Contents (19 chapters)
OpenVPN 2 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using client-connect/client-disconnect scripts


This recipe will demonstrate how to set up a client-connect script that gets executed on the server side when a new client connects. Similarly, a client-disconnect script can be specified that is executed when a client disconnects from the server. Client-connect and client-disconnect scripts can be used for several purposes:

  • Extra authentication

  • Opening and closing firewall ports

  • Assigning specific IP address to special clients

  • Writing out connection-specific configuration lines for a client

In this recipe, we will use a client-connect script to push a custom message to an OpenVPN client, based on the time of the day when the client connects.

Getting ready

Install OpenVPN 2.1 or higher on two computers. Make sure the computers are connected over a network. Set up the client and server certificates using the first recipe from Chapter 2. For this recipe, the server computer was running CentOS 5 Linux and OpenVPN 2.1.1. The client was running Windows...