编译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 - ...
随机推荐
- 【android】下载文件至本应用程序的file文件夹或者sdcard
一.推断是否有sdcard卡 //推断是否有SD卡 //ture:有SD卡 //false:没有SD卡 public boolean avaiableMedia(){ String status ...
- HTML属性
- 经典的C++库【转帖】
源地址:http://www.deuxmille.org/archives/1472 基础类1. Dinkumware C++ Library 参考站点:http://www.dinkumware.c ...
- Gap 锁
14.3.1 InnoDB Locking InnoDB 锁 本章节描述InnoDB 使用的锁类型: Shared and Exclusive Locks Intention Locks Record ...
- uva--562Dividing coins +dp
题意: 给定一堆硬币,然后将他们分成两部分,使得两部分的差值最小;输出这个最小的差值. 思路: 想了好久都没想到一个合适的状态转移方程.后面看了别人的题解后,才知道能够转成背包问题求解. 我们将全部的 ...
- 《转》Linux下的多线程编程
原地址:http://linux.chinaunix.net/doc/program/2001-08-11/642.shtml 1 引言 线程(thread)技术早在60年代就被提出,但真正应用多线程 ...
- HDU 1498 50 years, 50 colors(最小点覆盖,坑称号)
50 years, 50 colors Problem Description On Octorber 21st, HDU 50-year-celebration, 50-color balloons ...
- wkhtmtopdf--高分辨率转HTML成PDF--目录篇
原文:wkhtmtopdf--高分辨率转HTML成PDF--目录篇 wkhtmtopdf--高分辨率转HTML成PDF(一):简述wkhtmtopdf的简介和安装 wkhtmtopdf--高分辨率转H ...
- 10 个迅速提升你 Git 水平的提示(转)
最近我们推出了两个教程:熟悉Git的基本功能和 让你在开发团队中熟练的使用Git . 我们所讨论的命令足够一个开发者在Git使用方面游刃有余.在这篇文章中,我们试图探索怎样有效的管理你的时间和充分的使 ...
- Web工程师的工具箱 | 酷壳 - CoolShell.cn
Web工程师的工具箱 | 酷壳 - CoolShell.cn Web工程师的工具箱 2012年12月19日 陈皓 发表评论 阅读评论 30,168 人阅读 本文出自Ivan Zuzak 的&l ...