/sbin/ifconfig eth0:1 down
同样CAP_NET_ADMIN可以让普通用户增加/删除路由,如下:
/sbin/route add -host 192.168.27.139 gw 192.168.27.2
SIOCADDRT: Operation not permitted
授权NET_ADMIN,如下:
setcap cap_net_admin=eip /sbin/route
再次用普通用户增加路由,如下:
/sbin/route add -host 192.168.27.139 gw 192.168.27.2
/sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.27.139 192.168.27.2 255.255.255.255 UGH 0 0 0 eth0 192.168.27.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.27.2 0.0.0.0 UG 0 0 0 eth0 /sbin/route del -host 192.168.27.139 gw 192.168.27.2
我们看到我们除了可以增加路由之外,也可以删除路由.
最后NET_ADMIN可以帮助我们让普通用户来管理防火墙.
普通用户不能用iptables来管理防火墙,如下:
/sbin/iptables -L -n
iptables v1.4.2: can't initialize iptables table `filter': Permission denied (you must be root) Perhaps iptables or your kernel needs to be upgraded.
我们将CAP_NET_ADMIN授权给iptables程序,注意我们也要将CAP_NET_RAW授权给iptables,CAP_NET_RAW我们后面再解释,如下:
setcap cap_net_admin,cap_net_raw=eip /sbin/iptables-multi
此时就可以用普通用户来管理防火墙了,如下:
/sbin/iptables -A INPUT -p tcp -j ACCEPT
/sbin/iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我们也可以删除防火墙策略,并清空当前的数据流量,如下:
/sbin/iptables -F
/sbin/iptables -Z
/sbin/iptables -X
十八)CAP_NET_RAW 13 (允许使用原始(raw)套接字)
原始套接字编程可以接收到本机网卡上的数据帧或者数据包,对监控网络流量和分析是很有作用的.
最常见的就是ping的实现,如下:
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...旋转锁将在第 10 章进行深入介绍。 如果你对 flags 在传送给 spin_lock_...
linux/binfmts.h 146 include/linux/capability.h 147 include/linux/elf.h ...内核体系结构的深入了解 442 3.4 Linux 内核的类型 444 3.5 设计和实现的...
下面,在具体深入 linux 内核分析研究之前,需要 对内核中进程相关的几个概念做...具体的实现:Processors typically provide this capability with a mode bit in ...
(HHARM9-EDU实验6中断、 14GPIO/key、AD/DA、I2C等) 进一步深入学习其它的...<linux/major.h> #include <linux/blkdev.h> #include <linux/capability.h...
capability of Linux.Based on the SMP support of Linux,the kernel of Linux...随着对中间件研究的深入,相关的技 术会越来越多,所设计的中间件产品性能会更好...
.c 功能:initializes some of the processor’s interrupt handling capability. ...2005-12-30 28 内容 Linux启动函数分析 X86下的Linux启动分析 ARM下的Linux...
amongallthemethodsofimprovingLinuxrealtimecapability,theprimarywayincludesthinning...本课题针对Linux实时调度策略单一性限帛lJLinux实时应用的情况,深入研 究和分析...
Linux下的Capabilities安全机制分析_IT/计算机_专业资料。Linux下的Capabilities...即将 r00t的特权分割成不同的capabIlIty(本文译为权能),每种 权能代表一定的...
(2008)03—0109—04 ResearchofReaI—TimeCapabilityofEmbeddedLinux0SZHANGZi—qiang...开发难度等方面对两者进行一些深入 的对比,以及分析:3.1实时性能 合前面提到的...
capability.h 147 /linux/elf.h 150 /linux/elfcore.h 156 /linux/errupt.h...(spin-lock)来控制对控制台访问旋转锁将在第10章进行深入介绍 如果你对 flags...
热门文档