Chinaunix首页 | 论坛 | 博客
  • 博客访问: 537855
  • 博文数量: 119
  • 博客积分: 3167
  • 博客等级: 中校
  • 技术积分: 1215
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-20 21:21
文章分类

全部博文(119)

文章存档

2015年(21)

2012年(4)

2011年(1)

2007年(11)

2006年(50)

2005年(32)

分类: LINUX

2006-02-01 16:22:41

想实现通过apache的认证页面访问sendip.cgi后在iptables中 对通过验证的这个ip开放某功能 
1. 最好是只对组用户开放suid属性  但是  不知道为什么还是提示错误 只有对other用户也开放suid了
chmod 4711 /sbin/iptables
chown .nobody /sbin/iptables

2. 更改或添加一个apache用户
$apache/bin/htpasswd /usr/local/apache/conf/passwords juey

3. 配置cgi需要验证

vi $apache/conf/httpd.conf


    AllowOverride AuthConfig
#   AllowOverride None
    Options None
    Order allow,deny
    Allow from all


vi /var/www/html/cgi-bin/.htaccess

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/conf/passwords

Require user  juey


Require user  juey

4. 用shell写个简单的cgi页面

#!/bin/bash
# fileName: sendip
echo "Content type: text/html"
echo ""

echo "$REMOTE_ADDR"
iptables -L INPUT | grep "^ACCEPT" | awk '{print $4}'| grep -o "$REMOTE_ADDR"

[ $? -eq 0 ] ||  /sbin/iptables -I INPUT -s $REMOTE_ADDR -p tcp --dport 4567 -j ACCEPT

jscript中onunload事件
http://blog.iyi.cn/start/2005/12/post_98.html




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