前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Configure Ocserv on CentOS 6

Configure Ocserv on CentOS 6

作者头像
RainMark
发布2019-09-04 17:14:40
1.1K0
发布2019-09-04 17:14:40
举报
文章被收录于专栏:RainMark 的文章RainMark 的文章

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-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

  • 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:

代码语言:javascript
复制
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.

代码语言:javascript
复制
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.

代码语言:javascript
复制
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 二 22:06

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-06-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 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)
        相关产品与服务
        SSL 证书
        腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档