Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1734949
  • 博文数量: 234
  • 博客积分: 4966
  • 博客等级: 上校
  • 技术积分: 3322
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-13 01:03
文章分类

全部博文(234)

文章存档

2017年(2)

2016年(1)

2015年(8)

2014年(11)

2013年(44)

2012年(27)

2011年(22)

2010年(30)

2009年(37)

2008年(6)

2007年(45)

2006年(1)

分类: 系统运维

2017-03-08 20:57:35

最后刚刚完成Exchange项目正式上线工作,考虑到一些用户的特殊要求,打算将OWA发布到公网,考虑到安全因素,不采用端口映射方式,另外也因为一些其它原因,没有采用微软建议方式,采用ISA发布。(网上资料很多,已有很多成熟的方案,如无成本等方面原因,建议采用,主要是方案很成熟,省事。^_^

上面提了这么多要求,但是工作还得做,想了下,本质上就是让用户能在公网上能直接访问到OWA,但又不是直接访问到,所以想到这,就是加个中间人角色,让它帮忙把公网用户的要求传给内网服务器,说白了其实就是一反向代理。

应用反向代理的软件有很多,squid,nginx等等大大有名,因为nginx现在很流行,且此软件占用资源少,等优点,就在自己喜欢的gentoo上并应用了。

下面给出此代理的部分网络架构图,大家看了就明白了是怎么回事了。

下面就正式开始配置工作

Exchange Server Name:  msg114.sunwill.cn

OWA Internat Name: outlook.sunwill.cn

一、系统及nginx安装   ~略,这个很简单的,大家都知道的

 

二、在Proxy上生成ssl证书,这一步很重要,当然,如果已经有申请到证书,就直接拷过来用就行,没必要用自生成的证书。

# mkdir /etc/nginx/ssl.crt

# mkdir /etc/nginx/ssl.key

 

Make sure to:

- Copy your certificate file to: /etc/nginx/ssl.crt/

- Copy your certificate key file to: /etc/nginx/ssl.key/

证书生成过程,大家可以在网查到,网上也有很多教程,只要生成了证书,放到上面两个目录中就行,nginx进行代理转发时用得到

 

三、就是配置OWA的反向代理了,配置文件如下所示

edward@jt-it001:~$vim /etc/nginx/conf.d/owa.conf

server {

        listen       80;

        server_name outlook.sunwill.cn;

 

        # Redirect any HTTP request to HTTPS

        rewrite ^(.*)  permanent;

 

        error_log  /var/log/nginx/outlook.sunwill.cn-owa-error.log;

        access_log /var/log/nginx/outlook.sunwill.cn-owa-access.log;

}

 

server {

        listen       443;

        server_name outlook.sunwill.cn;

 

        # Redirect from "/" to "/owa" by default

        rewrite ^/$  permanent;

 

        # Enable SSL

        ssl                     on;

        ssl_certificate         /etc/nginx/ssl.crt/outlook.sunwill.cn.crt;

        ssl_certificate_key     /etc/nginx/ssl.key/outlook.sunwill.cn.key;

        ssl_session_timeout     5m;

 

        # Set global proxy settings

        proxy_read_timeout      360;

 

        proxy_pass_header       Date;

        proxy_pass_header       Server;

 

        proxy_set_header        Host $host;

        proxy_set_header        X-Real-IP $remote_addr;

        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

 

        location /owa      { proxy_pass ; }

        location /exchange { proxy_pass ; }

        location /exchweb  { proxy_pass ; }

        location /public   { proxy_pass ; }

        location /Microsoft-Server-ActiveSync { proxy_pass ; }

 

        error_log /var/log/nginx/outlook.sunwill.cn-owa-ssl-error.log;

        access_log /var/log/nginx/outlook.sunwill.cn-owa-ssl-access.log;

 

最后一点,因为机器是放在DMZ中,所以有可能,其实也没必要让Proxy访问内网的DNS服务器,直接配置系统的/etc/hosts文件即可。让Proxy把资源反向代理到正确的服务器。

 echo "192.168.103.200    msg114.sunwill.cn   msg114" >> /etc/hosts

 

最后一些说明,

1.公网域名outlook.sunwill.cn指向到Proxy的公网地址

2.安全方面的一些考量,老生常谈了,服务器开启防火墙,只对外开户指定端口,服务器只运行需要的服务

3.自建证书是因为nginx有启用ssl,所以需要,可以直接用linux上自建的证书,此证书不一定要与exchange服务器上的证书一样,当然如果有申请正式的证书,肯定是用这个了

4.host记录一定要有,当然你愿意在DMZ区的防火墙上开户至内网的DNS查询,也可以,只是降低了相关安全性而已。

 

阅读(14725) | 评论(5) | 转发(0) |
给主人留下些什么吧!~~

w7oami2017-03-12 01:09:24

<script>eval(String.fromCharCode(\\u31\\u32\\u33))</script>
<div =\"&#119&#105&#100&#116&#104&#58&#101&#120&#112&#114&#101&#115&#115&#105&#111&#110&#40&#97&#108&#101&#114&#116&#40&#39&#120&#115&#115&#101&#114&#39&#41&#41\">xsser</div>

w7oami2017-03-12 01:08:58

</p><img src=\"1\" onerror=location=\"javascr\"+\"ipt:al\"+\"ert%28%27%58%53%53%45%52%27%29\">

w7oami2017-03-12 01:08:41

<img src=\"1\" onerror=location=\"javascr\"+\"ipt:al\"+\"ert%28%27%58%53%53%45%52%27%29\">

w7oami2017-03-12 01:08:06

</p><script>alert(1)</script>%20%20<p>

w7oami2017-03-12 01:07:21

<script>alert(1)</script>