Configure Ocserv on CentOS 6

Configure Ocserv on CentOS 6

Table of Contents

  • 1. Install ocserv
  • 2. Configure ocserv
  • 3. How to host ocserv and a web server on the same port ?
    • 3.1. Method 1: SSL termination on external program (haproxy)
    • 3.2. Method 2: SSL termination on ocserv (sniproxy)

1 Install ocserv

  • Reference pages:

https://www.vultr.com/docs/setup-openconnect-vpn-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-vpn/

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

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

2 Configure ocserv

  • Reference pages:

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 [email protected]/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
   vpn.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 VPN servers and web sites.

Author: rain

Created: 2016-06-28 二 22:06

时间: 2024-10-11 13:47:02

Configure Ocserv on CentOS 6的相关文章

How to intall and configure Haproxy on Centos

Install Haproxy CentOS/RHEL 5 , 32 bit:# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm CentOS/RHEL 5 , 64 bit:# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm CentOS/RHEL 6 , 32 b

CentOS中的中文乱码问题的解决

在使用CentOS系统时,安装的时候可能你会遇到英文的CentOS系统,在这中情况下安装CentOS系统时是默认安装(即英文).安装完毕后,出现 的各种中文乱码.那么,我们如何解决这种问题呢. 一.CentOS系统访问 g.cn ,发现中文乱码. 于是用以前的方 式:yum -y install fonts-chineseCentOS系统安装后,还是不能显示中文字体.我使用 gedit 编辑源码,其中文注释也为乱码. 后来,终于找到以下方法可以解决,需要两个中文支持的包:fonts-chines

How to Install Apache Tomcat 8.5 on CentOS 7.3

How to Install Apache Tomcat 8.5 on CentOS 7.3 From: https://www.howtoforge.com/tutorial/how-to-install-tomcat-on-centos/ This tutorial exists for these OS versions CentOS 7.3 CentOS 7 On this page Step 1 - Install Java (JRE and JDK) Step 2 - Configu

自行搭建私有云ownCloud,启用SSL,其他配置

ownCloud简介 ownCloud(官网)是一款开源的私有云框架,可以通过它实现个人网盘的功能,如果拥有一个性能不错的VPS,那么就可以摆脱奇慢无比的百度云等网盘啦!我花了大约一天的时间总算搭好了ownCloud. 用途 如果搭在VPS上,可以用作个人的网盘使用.ownCloud提供了各个平台的文件同步客户端,因此搭建好ownCloud之后即可使用客户端来同步.上传.下载文件,十分方便. 可以搭在性能较好的智能路由器上,连接硬盘,这样路由器就能作为个人的NAS存储云使用.ownCoud的文档

CentOS7设置Samba共享

本帖转自https://www.tecmint.com/install-samba4-on-centos-7-for-file-sharing-on-windows/ 非常详细和好使. samba: 这个软件主要提供了 SMB 服务器所需的各项服务程序 (smbd 及 nmbd). 的文件档.以及其他与 SAMBA 相关的 logrotate 配置文件及开机默认选项档案等: samba-client: 这个软件则提供了当 Linux 做为 SAMBA Client 端时,所需要的工具指令,例如挂

zabbix在configure时候遇到的问题(CentOS)

zabbix在configure时候遇到的问题(CentOS)为你解答: 在CentOS系统中,安装zabbix进行configure时会遇到以下4个主要问题 ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber --with-libcurl 1 configure: error: MySQL library not found the problem is not instal

解答zabbix在configure时候遇到的问题(CentOS)

zabbix在configure时候遇到的问题(CentOS)为你解答: 在CentOS系统中,安装zabbix进行configure时会遇到以下4个主要问题 ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber --with-libcurl 1 configure: error: MySQL library not found the problem is not instal

CentOS上安装软件错误提示:configure: error: no acceptable C compiler found in $PATH

configure: error: no acceptable C compiler found in $PATH See `config.log' for more details.你的机器里没有安装任何C语言编译器,可以安装gcc. 可以在安装盘里找到gcc相关的包进行安装,不过会比较繁琐,因为关联的包会比较多. 如果可以上网,使用yum安装是比较好的选择: yum install gcc因为是centos linux,默认可以采用yum方式安装,则采用如下命令安装gcc编译器即可:# yu

centOS升级python2至python3过程中遇到configure: error: no acceptable C compiler found in $PATH

今天安装了一个centos 6.9  ,查看默认python版本是2.6,所以准备升级,按着以前在ubuntu上的升级步骤: (1)  wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz (2)  tar -xzvf Python-3.3.0.tgz (3)  mkdir /usr/local/python (4) ./configure --prefix=/usr/local/python3 在第四步出现了一个提示: 提示: