Configure Ocserv on CentOS 6

Configure Ocserv on CentOS 6

Table of Contents

1 Install ocserv

https://www.vultr.com/docs/setup-openconnect-V**-server-for-cisco-anyconnect-on-ubuntu-14-04-x64

https://www.stunnel.info/%E5%9C%A8centos-6-5%E4%B8%8A%E9%85%8D%E7%BD%AEcisco-anyconnect-V**/

http://stackoverflow.com/questions/23085076/readline-readline-h-file-not-found

https://www.youtube.com/watch?v=54WXQ3CmkGw

2 Configure ocserv

http://www.infradead.org/ocserv/manual.html

3 How to host ocserv and a web server on the same port ?

One of the advantages of ocserv is that is an HTTPS-based protocol and it is often used over 443 to allow bypassing certain firewalls. However the 443 TCP port is typically used by an HTTP server on a system. This section will describe methods on how to collocate ocserv with a web server.

3.1 Method 1: SSL termination on external program (haproxy)

To collocate ocserv and an HTTPS server on port 443, haproxy (or similar proxy applications) could be used. haproxy allows forwarding the HTTPS port data to arbitrary servers, based on various criteria. This method, however, has the limitation that client certificate authentication cannot be enforced by ocserv as the SSL session is terminated at haproxy.

The configuration required for haproxy is something along the lines:

frontend www-https
 bind 0.0.0.0:443 ssl crt /etc/ocserv/cert-key.pem
 default_backend ocserv-backend

backend ocserv-backend
 server ocserv unix@/var/run/ocserv-conn.socket check

and ocserv must be configured to accept cleartext connections on ocserv-conn.socket file. That can be achieved using the following configuration snippet.

listen-clear-file =/var/run/ocserv-conn.socket

3.2 Method 2: SSL termination on ocserv (sniproxy)

An alternative method to collocate ocserv and an HTTPS server on port 443, is with sniproxy. Sniproxy allows sharing the HTTPS port as long as the clients advertise the host name they connect to using server name indication (SNI). This is true for the majority of web browsers today. For this to work the web server and ocserv have to be setup to use an alternative port, e.g., ocserv uses 4443, and the web server uses 4444. A configuration of sniproxy that will redirect the traffic to the appropriate server is shown below.

listener 0.0.0.0:443{
 protocol tls
 table TableName

 # we set fallback to be ocserv as older versions of openconnect 
 # don't advertise the hostname they connect to.
 fallback 127.0.0.1:4443}

table TableName {
 # Match exact request hostnames
 V**.example.com 127.0.0.1:4443
 www.example.com 127.0.0.1:4444.*\\.net    127.0.0.1:4444}

Both of the approaches incur a performance penalty and should be considered mostly for low-traffic V** servers and web sites.

Author: rain

Created: 2016-06-28 Tue 22:06

Recommended Posts

Configure Ocserv on CentOS 6
Configure swap space on CentOS7
Configure rsyslog log client on CentOS
Configure python3 environment on centos7 and
Centos7 configure JDK
Configure Nginx reverse proxy based on CentOS 7
Configure Nginx load balancing based on CentOS 7
Configure Nginx forward proxy based on CentOS 7
Install Docker on Centos7
install LNMP on centos7.4
Build k8s1.9.9 on centos7
Install Java on Centos 7
Xfs configuration on centos7
Nodejs install on centos7
Install FFmpeg on CentOS 8
Install RabbitMQ on CentOS 7
How to install and configure VNC on CentOS 8
Install Node.js on Centos
Configure Nginx to start automatically based on CentOS 7
Maven install on centos7
Install MongoDB on CentOS 7
How to install and configure Redis on CentOS 8
Jenkins build on centos
Install Surelog on CentOS8
Configure lamp under centos6.8
Centos7 configure IP address
Deploy vuepress on centos7
Openjdk install on centos7
Install Jenkins on centos7
Use RapidSVN on CentOS7
How to install and configure phpMyAdmin on CentOS 6
Centos7 configure nodejs environment
install RabbitMQ on centos
How to install and configure Owncloud on CentOS 8
Install RabbitMQ on CentOS 7
install Docker on centos6.5
install oracle on centos
Configure CentOS7 GPU environment
Install Elasticsearch 6 on centos7
Install RabbitMQ on CentOS7
Deploy Jenkin on centos7
How to install and configure Redmine on CentOS 8
How to configure FTP server with Vsftpd on CentOS 8
How to install and configure NFS server on CentOS 8
How to configure FTP server with Vsftpd on CentOS 8
Install mysql online on centos
Install ElasticSearch 7.x on CentOS 7
Glusterfs cluster installation on Centos7
Build MariaDB replication on CentOS
Configure tomcat on ubuntu server
Configure static IP under CentOS 7
Install MySQL 8.0.16 on Linux Centos
Deployment of graphite on centos7
Install docker transfer on Centos7
Centos6.5 install and configure mongodb
Centos configure multiple virtual IP
Install docker on Centos system
install EPEL repo on centos
Install Zabbix 3.4 based on CentOS 7
install virtualbox on centos server
Docker EE installation on centos7