ocserv  1.1.6
About: ocserv (OpenConnect VPN Server) is a an SSL VPN GNU/Linux server that uses standard protocols such as TLS 1.2, and Datagram TLS and implements the AnyConnect SSL VPN protocol.
  Fossies Dox: ocserv-1.1.6.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ocserv Documentation

Some Fossies usage hints in advance:

  1. To see the Doxygen generated documentation please click on one of the items in the steelblue colored "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
  2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
  3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies ocserv-1.1.6.tar.xz contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).


The OpenConnect VPN server (ocserv) is an open source Linux SSL VPN server designed for organizations that require a remote access VPN with enterprise user management and control. It follows the openconnect protocol and is the counterpart of the openconnect VPN client. It is also compatible with CISCO's AnyConnect SSL VPN.

The program consists of:

  1. ocserv, the main server application
  2. occtl, the server's control tool. A tool which allows one to query the server for information.
  3. ocpasswd, a tool to administer simple password files.

Supported platforms

The OpenConnect VPN server is designed and tested to work, with both IPv6 and IPv4, on Linux systems. It is, however, known to work on FreeBSD, OpenBSD and other BSD derived systems.

Known limitation is that on platforms, which do not support procfs(5), changes to the configuration must only be made while ocserv(8) is stopped. Not doing so will cause new worker processes picking up the new configuration while ocserv-main will use the previous configuration.

Build dependencies


# Required
apt-get install -y libgnutls28-dev libev-dev
# Optional functionality and testing
apt get install -y libpam0g-dev liblz4-dev libseccomp-dev \
    libreadline-dev libnl-route-3-dev libkrb5-dev libradcli-dev \
    libcurl4-gnutls-dev libcjose-dev libjansson-dev libprotobuf-c-dev \
    libtalloc-dev libhttp-parser-dev protobuf-c-compiler gperf \
    nuttcp lcov libuid-wrapper libpam-wrapper libnss-wrapper \
    libsocket-wrapper gss-ntlmssp haproxy iputils-ping freeradius \
    gawk gnutls-bin iproute2 yajl-tools tcpdump


# Required
yum install -y gnutls-devel libev-devel
# Optional functionality and testing
yum install -y pam-devel lz4-devel libseccomp-devel readline-devel \
    libnl3-devel krb5-devel radcli-devel libcurl-devel cjose-devel \
    jansson-devel protobuf-c-devel libtalloc-devel http-parser-devel \
    protobuf-c gperf nuttcp lcov uid_wrapper pam_wrapper nss_wrapper \
    socket_wrapper gssntlmssp haproxy iputils freeradius gawk \
    gnutls-utils iproute yajl tcpdump

See README-radius for more information on Radius dependencies and its configuration.

Build instructions

To build from a distributed release use:

$ ./configure && make && make check

To test the code coverage of the test suite use the following:

$ ./configure --enable-code-coverage
$ make && make check && make code-coverage-capture

Note that the code coverage reported does not currently include tests which are run within docker.

In addition to the prerequisites listed above, building from git requires the following packages: autoconf, automake, and xz.

To build from the git repository use:

$ autoreconf -fvi
$ ./configure && make

Basic installation instructions

Now you need to generate a certificate. E.g.

$ certtool --generate-privkey > ./test-key.pem
$ certtool --generate-self-signed --load-privkey test-key.pem --outfile test-cert.pem

(make sure you enable encryption or signing)

Create a dedicated user and group for the server unprivileged processes (e.g., 'ocserv'), and then edit the sample.config and set these users on run-as-user and run-as-group options. The run:

# cd doc && ../src/ocserv -f -c sample.config


Several configuration instruction are available in the recipes repository.


To identify the bottlenecks in software under certain loads you can profile ocserv using the following command.

# perf record -g ocserv

After the server is terminated, the output is placed in perf.data. You may examine the output using:

# perf report

Continuous Integration (CI)

We use the gitlab-ci continuous integration system. It is used to test most of the Linux systems (see .gitlab-ci.yml),and is split in two phases, build image creation and compilation/test. The build image creation is done at the openconnect/build-images subproject and uploads the image at the gitlab.com container registry. The compilation/test phase is on every commit to project.

How the VPN works

Please see the technical description page.