编译Nginx支持Tcp_warppers
Tcp wrappers : Transmission Control Protocol (TCP) Wrappers 为由 inetd 生成的服务提供了增强的安全性。TCP Wrappers 是一种对使用 /etc/inetd.sec 的替换方法。TCP Wrappers 提供防止主机名和主机地址欺骗的保护。欺骗是一种伪装成有效用户或主机以获得对系统进行未经授权的访问的方法。
1、重新编译Nginx
[root@ipython nginx-1.6.1]# tar zxf ../ngx_tcpwrappers.tar.gz -C ./
[root@ipython nginx-1.6.1]# sed -i s'#CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g#CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g#' objs/Makefile
[root@ipython nginx-1.6.1]# ./configure --prefix=/software/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-google_perftools_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/root/pcre-8.35 --with-openssl=/root/openssl-1.0.1i --with-zlib=/root/zlib-1.2.8 --add-module=./ngx_tcpwrappers
####不要make install 哦,编译好即可####
[root@ipython nginx-1.6.1]# make
2、完成升级,以及模块的使用,Nginx还是很奇特的哦~~
####备份可执行文件,复制新的文件####
[root@ipython nginx-1.6.1]# mv /software/nginx/sbin/nginx /software/nginx/conf/@nginx
[root@ipython nginx-1.6.1]# cp objs/nginx /software/nginx/sbin/ ####测试新版本的Nginx####
[root@ipython nginx-1.6.1]# /software/nginx/sbin/nginx -t
nginx: the configuration file /software/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /software/nginx/conf/nginx.conf test is successful ###此时没有加入Tcp_wrappers的配置 测试下访问###
[root@ipython openssl-1.0.1i]# curl -I http://www.ipython.me
HTTP/1.1 200 OK
Server: nginx/1.6.1
Date: Mon, 11 Aug 2014 23:08:08 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 11 Aug 2014 22:45:25 GMT
Connection: keep-alive
ETag: "53e94785-264"
Accept-Ranges: bytes ###平滑升级###
[root@ipython nginx-1.6.1]# make upgrade ##测试模块,拒绝1.1.1.30的Nginx请求## ##在http块里加入如下配置##
tcpwrappers on;
tcpwrappers_daemon nginx;
tcpwrappers_thorough off; ##hosts.deny如下##
[root@ipython nginx-1.6.1]# awk '!/^#/' /etc/hosts.deny
nginx:1.1.1.30 ##重新读取Nginx配置文件##
[root@ipython nginx-1.6.1]# /software/nginx/sbin/nginx -s reload ###此时访问 就是403了###
[root@itchenyi ~]# curl -I http://www.ipython.me
HTTP/1.1 403 Forbidden
Server: nginx/1.6.1
Date: Mon, 11 Aug 2014 23:12:47 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive
3、Tcp_warppers 模块指令
###ngx_Tcp_wrappers 配置指令###
1、tcpwrappers
语法 : tcpwrappers [on|off]
默认值 : tcpwrappers off
作用域 : http, server, location, limit_except
描述 : 模块的开关,开启则使用TCP Wrappers 进行访问控制,关闭以避免浪费性能 2、tcpwrappers_daemon
语法 : tcpwrappers_daemon name
默认值 : tcpwrappers_daemon nginx
作用域 : http, server, location, limit_except
描述 : 该名字的定义用于在/etc/hosts.[allow|deny]识别 3、tcpwrappers_thorough
语法 : tcpwrappers_thorough [on|off]
默认值 : tcpwrappers_thorough off
作用域 : http, server, location, limit_except
描述 : 基于hosts.ctl以检查使用IP地址、用户名、反向DNS解析,模块的开发者也未提供详细的使用说明
» 转载保留版权:IT辰逸 » 《编译Nginx支持Tcp_warppers》» 本文版权采取:BY-NC-SA 协议进行授权,转载注明出处。除IT-Tools、News以及特别标注,本站所有文章均为原创。» 如果喜欢可以:点此订阅本站
编译Nginx支持Tcp_warppers的更多相关文章
- 配置Nginx支持SSL SNI(一个IP绑定多个证书) 以及Haproxy实现多域名证书
概述 传统的每个SSL证书签发,每个证书都需要独立ip,假如你编译openssl和nginx时候开启TLS SNI (Server Name Identification) 支持,这样你可以安装多个S ...
- nginx编译安装支持lua脚本
一.准备编译环境 1.操作系统:CentOS7.6 2.安装编译所需安装包 yum install gcc pcre pcre-devel zlib zlib-devel openssl openss ...
- 转载:Centos7 从零编译Nginx+PHP+MySql 序言 一
这次玩次狠得.除了编译器使用yum安装,其他全部手动编译.哼~ 看似就Nginx.PHP.MySql三个东东,但是它们太尼玛依赖别人了. 没办法,想用它们就得老老实实给它们提供想要的东西. 首先的一些 ...
- [原创]Centos7 从零编译Nginx+PHP+MySql
序言 这次玩次狠得.除了编译器使用yum安装,其他全部手动编译.哼~ 看似就Nginx.PHP.MySql三个东东,但是它们太尼玛依赖别人了. 没办法,想用它们就得老老实实给它们提供想要的东西. 首先 ...
- Nginx 支持 WAF 防护功能实战
WAF(Web Application Firewall),中文名称叫做“Web应用防火墙 WAF的定义是这样的:Web应用防火墙是通过执行一系列针对HTTP/HTTPS的安全策略来专门为Web应用提 ...
- 让nginx支持文件上传的几种模式
文件上传的几种不同语言和不同方法的总结. 第一种模式 : PHP 语言来处理 这个模式比较简单, 用的人也是最多的, 类似的还有用 .net 来实现, jsp来实现, 都是处理表单.只有语言的差别, ...
- 手动编译 Nginx 并安装 VeryNginx
VeryNginx 是个非常有意思且便捷的 Nginx 扩展程序.最近新开了台 VPS,便想体验一下它带来的快感. VeryNginx 有个不超过 5 行的安装方法,但作为强迫症我更喜欢使用自己编译的 ...
- LNMP搭建04 -- 配置Nginx支持PHP
首先建立存放网页文件的目录,执行 mkdri /usr/local/server/www 然后进入到该目录中 cd /usr/local/server/www 然后创建一个测试文件: phpinfo ...
- nginx 支持ipv6设置
为了使nginx支持ipv6 访问需要做以下配置: 1.找到nginx的安装路径: 使用命令:whereis nginx 查看nginx安装路径: 进入nginx执行文件目录: 先用./nginx - ...
随机推荐
- Swift调用Objective-C编写的代码(颜色选择器KKColorListPicker调用)
在Swift项目中,我们可以导入任意用Objective-C写的框架,代码库等.下面以Swift调用Objective-C编写的颜色选择器KKColorListPicker为例. 效果图如下: ...
- Delphi的指针 good
Pointers are like jumps, leading wildly from one part of the data structure to another. Their introd ...
- thinkPHP 模板的使用技巧(十三)
原文:thinkPHP 模板的使用技巧(十三) 模板的使用技巧:页面跳转 .模板包含.模板渲染.模板的继承 页面跳转 <a href='__URL__/index'>我要跳转到首页面,用这 ...
- Oracle varchar2最大支持长度(转)
oerr ora 0650206502, 00000, "PL/SQL: numeric or value error%s"// *Cause: An arithmetic, nu ...
- HDU 3571 N-dimensional Sphere(高斯消元 数论题)
这道题算是比较综合的了,要用到扩展欧几里得,乘法二分,高斯消元. 看了题解才做出来orz 基本思路是这样,建一个n*(n-1)的行列式,然后高斯消元. 关键就是在建行列式时会暴long long,所以 ...
- UVa-Palindromes
题目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- hdu1428之spfa+dfs
漫步校园 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- C# 计算字符串/文件的哈希值(MD5、SHA)
原文 C# 计算字符串的哈希值(MD5.SHA) 已做修改 一.关于本文 本文中是一个类库,包括下面几个函数: /// 1)计算32位MD5码(大小写):Hash_MD5_32 /// 2)计算16位 ...
- Android 布局之LinearLayout 子控件weight权重的作用详析(转)
关于Android开发中的LinearLayout子控件权重android:layout_weigh参数的作用,网上关于其用法有两种截然相反说法: 说法一:值越大,重要性越高,所占用的空间越大: 说法 ...
- WPF-20:richtextbox相关操作(转)
WPF中的richtextbox与winform中的richtextbox的使用不同,看看下面的基本操作: 一.取出richTextBox里面的内容 (1)将richTextBox的内容以字符串的形 ...