You are previewing OpenVPN.
O'Reilly logo

Book Description

This book is a comprehensive guide to using OpenVPN for building both secure VPNs. The book is written in a very friendly style that makes this complex topic easy and a joy to read. It first covers basic VPN concepts, then moves to introduce basic OpenVPN configurations, before covering advanced uses of OpenVPN. This book is for both experienced and new OpenVPN users.

Table of Contents

  1. OpenVPN
    1. OpenVPN
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. Preface
      1. What This Book Covers
      2. What You Need for This Book
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Errata
        2. Questions
    6. 1. VPN—Virtual Private Network
      1. Branches Connected by Dedicated Lines
        1. Broadband Internet Access and VPNs
      2. How Does a VPN Work?
        1. What are VPNs Used For?
        2. Networking Concepts—Protocols and Layers
        3. Tunneling and Overhead
      3. VPN Concepts—Overview
        1. A Proposed Standard for Tunneling
        2. Protocols Implemented on OSI Layer 2
        3. Protocols Implemented on OSI Layer 3
        4. Protocols Implemented on OSI Layer 4
        5. OpenVPN—An SSL/TLS-Based Solution
      4. Summary
    7. 2. VPN Security
      1. VPN Security
      2. Privacy—Encrypting the Traffic
        1. Symmetric Encryption and Pre-Shared Keys
        2. Reliability and Authentication
          1. The Problem of Complexity in Classic VPNs
        3. Asymmetric Encryption with SSL/TLS
      3. SSL/TLS Security
        1. Understanding SSL/TLS Certificates
        2. Trusted Certificates
        3. Self-Signed Certificates
          1. Certificates and VPNs
      4. Summary
    8. 3. OpenVPN
      1. Advantages of OpenVPN
      2. History of OpenVPN
        1. OpenVPN Version 1
        2. OpenVPN Version 2
      3. Networking with OpenVPN
        1. OpenVPN and Firewalls
        2. Configuring OpenVPN
        3. Problems with OpenVPN
      4. OpenVPN Compared to IPsec VPN
      5. Sources for Help and Documentation
      6. The Project Community
        1. Documentation in the Software Packages
      7. Summary
    9. 4. Installing OpenVPN
      1. Prerequisites
      2. Obtaining the Software
      3. Installing OpenVPN on Windows
        1. Downloading and Starting Installation
        2. Selecting Components and Location
        3. Finishing Installation
        4. Testing the Installation—A First Look at the Panel Applet
      4. Installing OpenVPN on Mac OS X (Tunnelblick)
        1. Testing the Installation—The Tunnelblick Panel Applet
      5. Installing OpenVPN on SuSE Linux
        1. Using YaST to Install Software
      6. Installing OpenVPN on Redhat Fedora Using yum
      7. Installing OpenVPN on RPM-Based Systems
        1. Using wget to Download OpenVPN RPMs
        2. Testing Installation and Installing with rpm
        3. Installing OpenVPN and the LZO Library with wget and RPM
        4. Using rpm to Obtain Information on the Installed OpenVPN Version
      8. Installing OpenVPN on Debian
        1. Installing Debian Packages
        2. Using Aptitude to Search and Install Packages
        3. OpenVPN—The Files Installed on Debian
      9. Installing OpenVPN on FreeBSD
        1. Installing a Newer Version of OpenVPN on FreeBSD—The Port System
          1. Installing the Port System with sysinstall
          2. Downloading and Installing a BSD Port
      10. Troubleshooting—Advanced Installation Methods
        1. Installing OpenVPN from Source Code
        2. Building Your Own RPM File from the OpenVPN Source Code
        3. Building and Distributing Your Own DEB Packages
        4. Enabling Linux Kernel Support for TUN/TAP Devices
          1. Using Menuconfig to Enable TUN/TAP Support
      11. Internet Links, Installation Guidelines, and Help
      12. Summary
    10. 5. Configuring an OpenVPN Server—The First Tunnel
      1. OpenVPN on Microsoft Windows
        1. Generating a Static OpenVPN Key
          1. Creating a Sample Connection
          2. Adapting the Sample Configuration File Provided by OpenVPN
          3. Starting and Testing the Tunnel
        2. A Brief Look at Windows OpenVPN Network Interfaces
      2. Connecting Windows and Linux
        1. File Exchange between Windows and Linux
          1. Installing WinSCP
          2. Transferring the Key File from Windows to Linux with WinSCP
          3. The Second Pitfall—Carriage Return/End of Line
        2. Configuring the Linux System
        3. Testing the Tunnel
          1. A Look at the Linux Network Interfaces
        4. Running OpenVPN Automatically
          1. OpenVPN as Server on Windows
          2. OpenVPN as Server on Linux
          3. Runlevels and init Scripts on Linux
          4. Using runlevel and init to Change and Check Runlevels
          5. The System Control for Runlevels
          6. Managing init Scripts
        5. Using Webmin to Manage init Scripts
        6. Using SuSE's YaST Module System Services (Runlevel)
      3. Troubleshooting Firewall Issues
        1. Deactivating Windows XP Service Pack 2 Firewall
        2. Stopping the SuSE Firewall
      4. Summary
    11. 6. Setting Up OpenVPN with X509 Certificates
      1. Creating Certificates
      2. Certificate Generation on Windows XP with easy-rsa
        1. Setting Variables—Editing vars.bat
        2. Creating the Diffie-Hellman Key
        3. Building the Certificate Authority
        4. Generating Server and Client Keys
      3. Distributing the Files to the VPN Partners
      4. Configuring OpenVPN to Use Certificates
      5. Using easy-rsa on Linux
        1. Preparing Variables in vars
        2. Creating the Diffie-Hellman Key and the Certificate Authority
        3. Creating the First Server Certificate/Key Pair
        4. Creating Further Certificates and Keys
      6. Troubleshooting
      7. Summary
    12. 7. The Command openvpn and its Configuration File
      1. Syntax of openvpn
        1. OpenVPN Command-Line Parameters
      2. Using OpenVPN at the Command Line
        1. Parameters Used in the Standard Configuration File for a Static Key Client
        2. Compressing the Data
        3. Controlling and Restarting the Tunnel
        4. Debugging Output—Troubleshooting
      3. Configuring OpenVPN with Certificates—Simple TLS Mode
      4. Overview of OpenVPN Parameters
        1. General Tunnel Options
        2. Routing
        3. Controlling the Tunnel
        4. Scripting
        5. Logging
        6. Specifying a User and Group
        7. The Management Interface
        8. Proxies
        9. Encryption Parameters
        10. Testing the Crypto System with --test-crypto
        11. SSL Information—Command Line
        12. Server Mode
          1. Server Mode Parameters
          2. --client-config Options
        13. Client Mode Parameters
          1. Push Options
      5. Important Windows-Specific Options
      6. Summary
    13. 8. Securing OpenVPN Tunnels and Servers
      1. Securing and Stabilizing OpenVPN
      2. Linux and Firewalls
        1. Debian Linux and Webmin with Shorewall
          1. Installing Webmin and Shorewall
          2. Preparing Webmin and Shorewall for the First Start
          3. Starting Webmin
          4. Configuring the Shorewall with Webmin
          5. Creating Zones
          6. Editing Interfaces
          7. Default Policies
          8. Adding Firewall Rules
        2. Troubleshooting Shorewall—Editing the Configuration Files
        3. OpenVPN and SuSEfirewall
        4. Troubleshooting OpenVPN Routing and Firewalls
          1. Configuring a Router without a Firewall
          2. iptables—The Standard Linux Firewall Tool
      3. Configuring the Windows Firewall for OpenVPN
      4. Summary
    14. 9. Advanced Certificate Management
      1. Certificate Management and Security
      2. Installing xca
      3. Using xca
        1. Creating a Database
        2. Importing a CA Certificate
        3. Creating and Signing a New Server/Client Certificate
        4. Revoking Certificates with xca
      4. Using TinyCA2 to Manage Certificates
        1. Importing Our CA
        2. Using TinyCA2 for CA Administration
        3. Creating New Certificates and Keys
        4. Exporting Keys and Certificates with TinyCA2
        5. Revoking Certificates with TinyCA2
      5. Summary
    15. 10. Advanced OpenVPN Configuration
      1. Tunneling a Proxy Server and Protecting the Proxy
      2. Scripting OpenVPN—An Overview
      3. Using Authentication Methods
      4. Using a Client Configuration Directory with Per-Client Configurations
      5. Individual Firewall Rules for Connecting Clients
      6. Distributed Compilation through VPN Tunnels with distcc
      7. Ethernet Bridging with OpenVPN
      8. Automatic Installation for Windows Clients
      9. Summary
    16. 11. Troubleshooting and Monitoring
      1. Testing the Network Connectivity
      2. Checking Interfaces, Routing, and Connectivity on the VPN Servers
      3. Debugging with tcpdump and IPTraf
      4. Using OpenVPN Protocol and Status Files for Debugging
      5. Scanning Servers with Nmap
      6. Monitoring Tools
        1. ntop
        2. Munin
      7. Hints to Other Tools
      8. Summary
    17. A. Internet Resources
      1. VPN Basics
      2. OpenVPN Resources
      3. Configuration
      4. Scripts and More
      5. Network Tools
      6. Howtos
      7. Openvpn GUIs