Mastering OpenVPN
By Eric F Crist and Jan Just Keijser
5/5
()
About this ebook
Master building and integrating secure private networks using OpenVPN
About This Book- Discover how to configure and set up a secure OpenVPN
- Enhance user experience by using multiple authentication methods
- Delve into better reporting, monitoring, logging, and control with OpenVPN
If you are familiar with TCP/IP networking and general system administration, then this book is ideal for you. Some knowledge and understanding of core elements and applications related to Virtual Private Networking is assumed.
What You Will Learn- Identify different VPN protocols (IPSec, PPTP, OpenVPN)
- Build your own PKI and manage certificates
- Deploy your VPN on various devices like PCs, mobile phones, tablets, and more
- Differentiate between the routed and bridged network
- Enhance your VPN with monitoring and logging
- Authenticate against third-party databases like LDAP or the Unix password file
- Troubleshoot an OpenVPN setup that is not performing correctly
Security on the internet is increasingly vital to both businesses and individuals. Encrypting network traffic using Virtual Private Networks is one method to enhance security. The internet, corporate, and “free internet” networks grow more hostile every day. OpenVPN, the most widely used open source VPN package, allows you to create a secure network across these systems, keeping your private data secure. The main advantage of using OpenVPN is its portability, which allows it to be embedded into several systems.
This book is an advanced guide that will help you build secure Virtual Private Networks using OpenVPN. You will begin your journey with an exploration of OpenVPN, while discussing its modes of operation, its clients, its secret keys, and their format types. You will explore PKI: its setting up and working, PAM authentication, and MTU troubleshooting. Next, client-server mode is discussed, the most commonly used deployment model, and you will learn about the two modes of operation using "tun" and "tap" devices.
The book then progresses to more advanced concepts, such as deployment scenarios in tun devices which will include integration with back-end authentication, and securing your OpenVPN server using iptables, scripting, plugins, and using OpenVPN on mobile devices and networks.
Finally, you will discover the strengths and weaknesses of the current OpenVPN implementation, understand the future directions of OpenVPN, and delve into the troubleshooting techniques for OpenVPN.
By the end of the book, you will be able to build secure private networks across the internet and hostile networks with confidence.
Style and approachAn easy-to-follow yet comprehensive guide to building secure Virtual Private Networks using OpenVPN. A progressively complex VPN design is developed with the help of examples. More advanced topics are covered in each chapter, with subjects grouped according to their complexity, as well as their utility.
Eric F Crist
Eric F Crist is an IT professional with experience in hardware and software systems integration. With a few others, he has had a key role in building the OpenVPN community to what it is today. He works in research and development as a principal computer system specialist for St. Jude Medical. His role involves system engineering, configuration management, and cyber security analysis for products related to the Cardiovascular Ablation Technology division. You can find him online at the Freenode and EFNet IRC networks as ecrist. He calls the Twin Cities, Minnesota, his home and lives with his wife, DeeDee, his son, Lance, and his daughter, Taylor.
Related to Mastering OpenVPN
Related ebooks
OpenVPN Building and Integrating Virtual Private Networks Rating: 4 out of 5 stars4/5Mastering the Nmap Scripting Engine Rating: 0 out of 5 stars0 ratingsSSL VPN : Understanding, evaluating and planning secure, web-based remote access Rating: 0 out of 5 stars0 ratingsTroubleshooting OpenVPN Rating: 0 out of 5 stars0 ratingsHands-On Network Forensics: Investigate network attacks and find evidence using common network forensic tools Rating: 0 out of 5 stars0 ratingsMastering Kali Linux for Advanced Penetration Testing Rating: 4 out of 5 stars4/5Nginx Essentials Rating: 0 out of 5 stars0 ratingsNmap Essentials Rating: 4 out of 5 stars4/5Lighttpd Rating: 4 out of 5 stars4/5Learning Nagios 4 Rating: 5 out of 5 stars5/5DevOps for Networking Rating: 0 out of 5 stars0 ratingsMastering NGINX - Second Edition Rating: 0 out of 5 stars0 ratingsMastering Linux Network Administration Rating: 4 out of 5 stars4/5Kali Linux – Assuring Security by Penetration Testing Rating: 3 out of 5 stars3/5Ubuntu Server Essentials Rating: 0 out of 5 stars0 ratingsMastering Python Networking Rating: 5 out of 5 stars5/5OpenVPN Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsWireshark for Security Professionals: Using Wireshark and the Metasploit Framework Rating: 4 out of 5 stars4/5Mastering Ubuntu Server Rating: 5 out of 5 stars5/5Penetration Testing with Raspberry Pi Rating: 5 out of 5 stars5/5Linux Networking Cookbook Rating: 0 out of 5 stars0 ratingsKali Linux Cookbook Rating: 4 out of 5 stars4/5Kali Linux Network Scanning Cookbook Rating: 0 out of 5 stars0 ratingsKali Linux Intrusion and Exploitation Cookbook Rating: 5 out of 5 stars5/5Set Up Your Own IPsec VPN, OpenVPN and WireGuard Server: Build Your Own VPN Rating: 5 out of 5 stars5/5Kali Linux Wireless Penetration Testing Essentials Rating: 5 out of 5 stars5/5Metasploit Bootcamp Rating: 5 out of 5 stars5/5Python Penetration Testing Essentials Rating: 5 out of 5 stars5/5
Networking For You
Networking All-in-One For Dummies Rating: 5 out of 5 stars5/5Cybersecurity: The Beginner's Guide: A comprehensive guide to getting started in cybersecurity Rating: 5 out of 5 stars5/5Linux Bible Rating: 0 out of 5 stars0 ratingsNetworking For Dummies Rating: 5 out of 5 stars5/5Computer Networking: An introductory guide for complete beginners: Computer Networking, #1 Rating: 5 out of 5 stars5/5The Compete Ccna 200-301 Study Guide: Network Engineering Edition Rating: 5 out of 5 stars5/5Quantum Computing For Dummies Rating: 0 out of 5 stars0 ratingsAWS Certified Cloud Practitioner Study Guide: CLF-C01 Exam Rating: 5 out of 5 stars5/5Networking Fundamentals: Develop the networking skills required to pass the Microsoft MTA Networking Fundamentals Exam 98-366 Rating: 0 out of 5 stars0 ratingsMicrosoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsRust In Practice Rating: 0 out of 5 stars0 ratingsWindows Command Line Administration Instant Reference Rating: 0 out of 5 stars0 ratingsFortinet FCP - FortiGate 7.4 Administrator Exam Preparation Rating: 0 out of 5 stars0 ratingsLearning Linux Shell Scripting Rating: 4 out of 5 stars4/5Learning Python Network Programming Rating: 5 out of 5 stars5/5ITIL 4: Digital and IT strategy: Reference and study guide Rating: 5 out of 5 stars5/5Closing the Loop: Systems Thinking for Designers Rating: 0 out of 5 stars0 ratingsDocker: A Quick-Start Beginner's Guide Rating: 4 out of 5 stars4/5Amazon Web Services (AWS) Interview Questions and Answers Rating: 5 out of 5 stars5/5TCP/IP for Everyone Rating: 4 out of 5 stars4/5HTTP/2 in Action Rating: 0 out of 5 stars0 ratingsRereading Marx in the Age of Digital Capitalism Rating: 0 out of 5 stars0 ratingsMicrosoft Certified Azure Fundamentals Study Guide: Exam AZ-900 Rating: 0 out of 5 stars0 ratingsITIL® 4 Direct, Plan and Improve (DPI): Your companion to the ITIL 4 Managing Professional and Strategic Leader DPI certification Rating: 0 out of 5 stars0 ratingsCisco Networking All-in-One For Dummies Rating: 4 out of 5 stars4/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5ITIL® 4 Drive Stakeholder Value (DSV): Your companion to the ITIL 4 Managing Professional DSV certification Rating: 0 out of 5 stars0 ratings
Reviews for Mastering OpenVPN
1 rating0 reviews
Book preview
Mastering OpenVPN - Eric F Crist
Table of Contents
Mastering OpenVPN
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to OpenVPN
What is a VPN?
Types of VPNs
PPTP
IPSec
SSL-based VPNs
OpenVPN
Comparison of VPNs
Advantages and disadvantages of PPTP
Advantages and disadvantages of IPSec
Advantages and disadvantages of SSL-based VPNs
Advantages and disadvantages of OpenVPN
History of OpenVPN
OpenVPN packages
The open source (community) version
The closed source (commercial) Access Server
The mobile platform (mixed) OpenVPN/OpenVPN Connect
Other platforms
OpenVPN internals
The tun/tap driver
The UDP and TCP modes
The encryption protocol
The control and data channels
Ciphers and hashing algorithms
OpenSSL versus PolarSSL
Summary
2. Point-to-point Mode
Pros and cons of the key mode
The first example
TCP protocol and different ports
The TAP mode
The topology subnet
The cleartext tunnel
OpenVPN secret keys
Using multiple keys
Using different encryption and authentication algorithms
Routing
Configuration files versus the command line
The complete setup
Advanced IP-less setup
Three-way routing
Route, net_gateway, vpn_gateway, and metrics
Bridged tap adapter on both ends
Removing the bridges
Combining point-to-point mode with certificates
Summary
3. PKIs and Certificates
An overview of PKI
PKI using Easy-RSA
Building the CA
Certificate revocation list
Server certificates
Client certificates
PKI using ssl-admin
OpenVPN server certificates
OpenVPN client certificates
Other features
Multiple CAs and CRLs
Extra security – hardware tokens, smart cards, and PKCS#11
Background information
Supported platforms
Initializing a hardware token
Generating a certificate/private key pair
Generating a private key on a token
Generating a certificate request
Writing an X.509 certificate to the token
Getting a hardware token ID
Using a hardware token with OpenVPN
Summary
4. Client/Server Mode with tun Devices
Understanding the client/server mode
Setting up the Public Key Infrastructure
Initial setup of the client/server mode
Detailed explanation of the configuration files
Topology subnet versus topology net30
Adding extra security
Using tls-auth keys
Generating a tls-auth key
Checking certificate key usage attributes
Basic production-level configuration files
TCP-based configuration
Configuration files for Windows
Routing and server-side routing
Special parameters for the route option
Masquerading
Redirecting the default gateway
Client-specific configuration – CCD files
How to determine whether a CCD file is properly processed
CCD files and topology net30
Client-side routing
In-depth explanation of the client-config-dir configuration
Client-to-client traffic
The OpenVPN status file
Reliable connection tracking for UDP mode
The OpenVPN management interface
Session key renegotiation
A note on PKCS#11 devices
Using IPv6
Protected IPv6 traffic
Using IPv6 as transit
Advanced configuration options
Proxy ARP
How does Proxy ARP work?
Assigning public IP addresses to clients
Summary
5. Advanced Deployment Scenarios in tun Mode
Enabling file sharing over VPN
Using NetBIOS names
Using nbtstat to troubleshoot connection problems
Using LDAP as a backend authentication mechanism
Troubleshooting the LDAP backend authentication
Filtering OpenVPN
FreeBSD example
A Windows example
Policy-based routing
Windows network locations – public versus private
Background
Changing the TAP-Win adapter location using the redirect-gateway
Using the Group Policy editor to force an adapter to be private
Changing the TAP-Win adapter location using extra gateways
Redirecting all traffic in combination with extra gateways
Using OpenVPN with HTTP or SOCKS proxies
HTTP proxies
SOCKS proxies
Summary
6. Client/Server Mode with tap Devices
The basic setup
Enabling client-to-client traffic
Filtering traffic between clients
Disadvantage of the proxy_arp_pvlan method
Filtering traffic using the pf filter of OpenVPN
Using the tap device (bridging)
Bridging on Linux
Tearing down the bridge
Bridging on Windows
Using an external DHCP server
Checking broadcast and non-IP traffic
Address Resolution Protocol traffic
NetBIOS traffic
Comparing tun mode to tap mode
Layer 2 versus layer 3
Routing differences and iroute
Client-to-client filtering
Broadcast traffic and chattiness
of the network
Bridging
Summary
7. Scripting and Plugins
Scripting
Server-side scripts
--setenv and --setenv-safe
--script-security
--up-restart
--up
--route-up
--tls-verify
--auth-user-pass-verify
--client-connect
--learn-address
--client-disconnect
--route-pre-down
--down
Client-side scripts
--setenv and --setenv-safe
--script-security
--up-restart
--tls-verify
--ipchange
--up
--route-up
--route-pre-down
--down
Examples of server scripts
Client-connect scripts
Client authentication
Client authorization
Example 1—client-selected routes
Example 2—track client connection statistics
Example 3—disconnect user after X minutes
Examples of client scripts
Example 4—mount NFS share
Example 5—using all scripts at once
The server-side script log
Environment variables set in the server-side scripts
--up
--route-up
--tls-verify
--auth-user-pass-verify
--client-connect
--learn-address
--client-disconnect
--route-pre-down and --down
The client-side script log
Environment variables set in the client-side scripts
Plugins
Down-root
The auth-pam plugin
Summary
8. Using OpenVPN on Mobile Devices and Home Routers
Using the OpenVPN for an Android app
Creating an OpenVPN app profile
Using the PKCS#12 file
Using the OpenVPN Connect app for Android
Using the OpenVPN Connect app for iOS
Integrating smart phones into an existing VPN setup
Using a home router as a VPN client
Using a home router as a VPN server
Summary
9. Troubleshooting and Tuning
How to read the log files
Detecting a non-working setup
Fixing common configuration mistakes
Wrong CA certificate in the client configuration
How to fix
Client certificate not recognized by the server
How to fix
Client certificate and private key mismatch
How to fix
The auth and tls-auth key mismatch
How to fix
The MTU size mismatch
How to fix
The Cipher mismatch
How to fix
The Compression mismatch
How to fix
The fragment mismatch
How to fix
The tun versus tap mismatch
How to fix
The client-config-dir issues
How to fix
No access to the tun device in Linux
How to fix
Missing elevated privileges in Windows
How to fix
Troubleshooting routing issues
Drawing a detailed picture
Start in the middle and work your way outward
Find a time to temporarily disable firewall
If all else fails, use tcpdump
How to optimize performance by using ping and iperf
Using ping
Using iperf
Gigabit networking
Analyzing OpenVPN traffic by using tcpdump
Summary
10. Future Directions
Current strengths
Current weaknesses
Scaling at gigabit speeds and above
Where we are going
Improved compression support
Per-client compression
New cryptographic routines
Mixed certificate/username authentication
IPv6 support
Windows privilege separation
Summary
Index
Mastering OpenVPN
Mastering OpenVPN
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2015
Production reference: 1260815
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78355-313-6
www.packtpub.com
Credits
Authors
Eric F Crist
Jan Just Keijser
Reviewers
Stefan Agner
Emmanuel Bretelle
Michael A Cossenas
Guillaume Destuynder
Commissioning Editor
Amarabha Banerjee
Acquisition Editors
Richard Brookes-Bland
Larissa Pinto
Content Development Editor
Pooja Nair
Technical Editor
Mitali Somaiya
Copy Editors
Roshni Banerjee
Rashmi Sawant
Project Coordinator
Judie Jose
Proofreader
Safis Editing
Indexer
Hemangini Bari
Graphics
Sheetal Aute
Production Coordinator
Nitesh Thakur
Cover Work
Nitesh Thakur
About the Authors
Eric F Crist is an IT professional with experience in hardware and software systems integration. With a few others, he has had a key role in building the OpenVPN community to what it is today. He works in research and development as a principal computer system specialist for St. Jude Medical. His role involves system engineering, configuration management, and cyber security analysis for products related to the Cardiovascular Ablation Technology division.
You can find him online at the Freenode and EFNet IRC networks as ecrist. He calls the Twin Cities, Minnesota, his home and lives with his wife, DeeDee, his son, Lance, and his daughter, Taylor.
Jan Just Keijser is an open source professional from Utrecht, the Netherlands. He has a wide range of experience in IT, ranging from providing user support, system administration, and systems programming to network programming. He has worked for various IT companies since 1989. He has been working mainly on Unix/Linux platforms since 1995. He was an active USENET contributor in the early 1990s.
Currently, he is employed as a senior scientific programmer in Amsterdam, the Netherlands, at Nikhef, the institute for subatomic physics from the Dutch Foundation for Fundamental Research on Matter (FOM). He is working on multi-core and many-core computing systems, grid computing, as well as smartcard applications. His open source interests include all types of virtual private networking, including IPSec, PPTP, and of course, OpenVPN. In 2004, he discovered OpenVPN and has been using it ever since.
His first book was OpenVPN 2 Cookbook, Packt Publishing.
About the Reviewers
Stefan Agner completed his bachelor's degree in information technology from the Lucerne University of Applied Sciences and Arts in 2009 and has worked in the field of embedded systems as a software engineer since then. He focuses on driver development and system programming and prefers to work with the open source software stack. Currently, he is working to upstream Linux support for the ARM-based Freescale Vybrid SoC for his employer, Toradex AG.
He describes himself as an open source enthusiast who works with Linux and other free software not only in his professional life as a software engineer, but also in his spare time. At several smaller companies, he successfully deployed and managed OpenVPN as the primary VPN solution. For his private IT infrastructure, he runs OpernWrt-powered routers, which serve as OpenVPN servers. He also likes to blog about technical stuff, such as fascinating projects and interesting problems he comes across.
Emmanuel Bretelle has 10 years of experience in devops, systems, and network administration. He has leveraged OpenVPN, its plugin capabilities, and cross-platform compatibility to help connect employees across the globe to corporate networks.
He has also developed and open sourced two OpenVPN plugins: openvpn-mysql-auth and openvpn-ldap-auth.
When not fiddling around with new technology or automating his way out, he enjoys traveling and chilling out.
Michael A Cossenas is a Linux/network administrator from Athens, Greece.
He has been working as a network security specialist for Digital Sima, a company specializing in LAN/WAN networking. He is now employed as a subcontractor for IBM Greece and manages 50 plus SUSE-based Linux servers as one of their customers.
His first experience with Linux was way back in 1998, using RedHat 5.2. Since then, he has worked on various open source projects, including Zimbra, DRBD, KVM, and Postfix.
He is also an OpenVPN forum moderator.
He works as a subcontractor for IBM Greece in the SO (Strategic Outsourcing) department.
I would like to thank my family (my wife, Froso, my son, Antony, and my daughter, Kate) for supporting me in difficult times.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
Privacy and security on the Internet and in private networks is a growing concern and is increasingly common in the news, where there are breaches of each. Virtual private networks (VPN) were created out of a need for secured communications. The most popular and widely used open source VPN software today is OpenVPN. Mastering OpenVPN aims to educate you on deployment, troubleshooting, and configuration of OpenVPN and provide solid use cases for various scenarios.
What this book covers
Chapter 1, Introduction to OpenVPN, discusses the various types of Virtual Private Networks and some of their various strengths and weaknesses. PPTP, OpenVPN, IPSec, and other protocols are also discussed in this chapter.
Chapter 2, Point-to-point Mode, covers the OpenVPN roots, point-to-point mode, and the initially only supported mode. It also covers the tap mode in a bridged scenario and an uncommon configuration.
Chapter 3, PKIs and Certificates, explains the complex concept of X.509 certificates and PKIs with examples and a demonstration of a couple of utilities. It also covers how to create a certificate chain and deploy that chain to their VPN.
Chapter 4, Client/Server Mode with tun Devices, walks you through the most common deployment mode, a tun or routed, and its setup. It also discusses the passing of client-backed routes along with IPv4 and IPv6.
Chapter 5, Advanced Deployment Scenarios in tun Mode, covers policy-based routing and configuring OpenVPN to integrate your VPN clients with the rest of the LAN. Complex examples of tun mode are examined, showing that they are appropriate even in advanced scenarios.
Chapter 6, Client/Server Mode with tap Devices, discusses the often misused and less commonly deployed tap or bridged mode VPNs. Solid examples of broadcast and OSI layer 2 traffic are demonstrated in this chapter.
Chapter 7, Scripting and Plugins, helps you gain an understanding of the methods to extent the VPN, including authentication, routing, and protocol enhancements. This chapter helps an administrator create a local experience for a worker or a user on the move.
Chapter 8, Using OpenVPN on Mobile Devices and Home Routers, helps you learn how to use home router OSes and features to deploy OpenVPN. We understand that it's not just enterprise or commercial users looking to protect their privacy and data. Increasingly, home users desire to deploy secure connections to their home resources.
Chapter 9, Troubleshooting and Tuning, will help you become an expert in your OpenVPN deployment by learning how to troubleshoot problems and bugs. The ability to identify issues creates a solid and reliable installation and confidence in your users.
Chapter 10, Future Directions, gives you a brief history and lengthier discussion of the future direction of OpenVPN, and the mindset of the developers is revealed. It also helps you understand the reasoning and history behind the various decisions behind features and bugs.
What you need for this book
You should have the following entities for a complete experience of reading and following Mastering OpenVPN:
A Unix, Linux, or Mac OS X system
A Windows system
A server (Windows or Linux, whichever is preferred, Linux or FreeBSD suggested)
A solid understanding (101 or 201 level) of networking (UDP and TCP over IP)
An IRC client or a web browser is also helpful. When you run into trouble or have too many questions, pop in to #openvpn on irc.freenode.net, and look for @janjust or @ecrist. We look forward to talking to you!
Who this book is for
This book is really designed for anyone looking to deploy a VPN solution to any private or enterprise network. OpenVPN can be used for point-to-point tunnels, intra-network connections, and road warriors. The concepts covered in this book can be applied generally across more than just OpenVPN deployments, with the exception of configuration argument specifics.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: You can specify a message digest as parameter to the --auth option.
A block of code is set as follows:
proto udp
port 1194
dev tun
server 10.200.0.0 255.255.255.0
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
proto udp
port 1194
dev tun
server 10.200.0.0 255.255.255.0
Any command-line input or output is written as follows:
# mkdir -p /etc/openvpn/movpn
Note that first character (the prompt) is used to indicate a root-shell (#) or a user shell ($).
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Launch the OpenVPN GUI application, select the configuration basic-udp-client and click on Connect.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
Chapter 1. Introduction to OpenVPN
The Internet in modern society is as ubiquitous as any public utility. When someone buys a home or moves into a new apartment, or a business moves into a new space, an Internet service is the first utility on the list to be ordered, followed by power, heat, trash, and maybe (but not likely) a land line or telephone service. You could even argue that the modern qualifier isn't even necessary. With programs such as One Laptop per Child, coupled with efforts by the likes of Facebook and Google, so-called third-world nations have the Internet where there is no running water, sewers, or even telephone services.
When you have such a wide-reaching service with so many individuals, at a certain point it will be necessary to secure and protect the data transmitted on that network. With most crowds and heavy concentrations of people, there is a more nefarious element looking to take advantage of those with less knowledge. Virtual Private Networks (VPNs) were created out of a greater need for secured communication across an otherwise unprotected infrastructure. The original large-scale network, ARPANET, had very little (if any) protection and authentication and all other nodes were inherently trusted. The network landscapes today are very different and even many casual, nontechnical users are aware of the lack of security of their connections.
Government agencies have long been targets for intelligence. For thousands of years, methods and procedures have been slowly perfected and tuned to protect sensitive information from enemies and other prying eyes. Initially, wax-sealed letters carried by trusted individuals meant you and the receiver could trust a message had arrived safely and untampered. As time and technology have progressed, it became easier to intercept those messages, read or alter them, and send them along their way.
World War II saw some of the greatest advances in cryptography and secure communications. From devices such as the German Enigma machine to the Navajo Code Talkers, communicating securely between troops and command was a never-ending arms race. Today, governments and militaries aren't the only groups with a desire for privacy. Corporations want to maintain data integrity and protection for payment card industry (PCI) standards to protect consumers. Family members want to discuss family matters over private channels, where the community at large isn't able to eavesdrop. Others wish to break through the national firewalls meant to oversee the populous and restrict content deemed controversial or against party politics.
Every day, most people use a VPN or have a use for a VPN, whether they realize it at the time or not. Many different VPN technologies exist, both from commercial vendors and as open source projects. One of the most popular pieces of open source VPN software is OpenVPN. The goal of this book is to make you an OpenVPN master; you will learn not just the technology behind it, but the reasoning, logic, and logistics of everything involved. While this book will mention and touch on the commercial offering from OpenVPN Technologies, Inc., Access Server, the primary focus will be on the open source/community version of OpenVPN.
What is a VPN?
Put simply, a VPN allows an administrator to create a local
network between multiple computers on varying network segments. In some instances, those machines can be on the same LAN, they can be distant from each other across the vast Internet, or they can even be connected across a multitude of connection media such as wireless uplinks, satellite, dial-up-networking, and so on. The P in VPN comes from the added protection to make that virtual network private. Network traffic that is flowing over a VPN is often referred to as inside the (VPN) tunnel, compared to all the other traffic that is outside the tunnel.
In the following figure, network traffic is shown as it traditionally traverses across multiple network segments and the general Internet. Here, this traffic is relatively open to inspection and analysis. Though protected protocols such as HTTPS and SSH are less vulnerable, they are still identifiable; if an attacker is snooping network traffic, they can still see what type of connection is made from which computer to which server.
When a VPN is used, the traffic inside the tunnel is no longer identifiable.
The traffic within a VPN can be anything you would send over a local or wide-area network: web traffic,