(一旦securelevel=1,kernel将不允许装入modlue,所以你的kerneld可能不能正 常工作,而且禁止你访问/dev/kmem,所以有些用到svgalib的程序也不能正常工作 ,象zgv什么的。不过这本来就是安全隐患,所以不工作就不工作好了,呵呵) (关于chattr,lsaddr请man chattr和man lsattr) warning3@hotmail.com /**************************** lkm.c ********************************/ /* Simple lkm to secure Linux. * This module can be used to change the securelevel of Linux. * Running the client will switch the securelevel. * * gcc -O3 -Wall -c lkm.c * insmod lkm * * It is tested in Redhat 5.2 (2.0.36). * (It should be modified if you want to run it in 2.2.x kernel). * It is really very simple,but we just for educational purposes.:-) * *warning3@hotmail.com */ extern void *sys_call_table[]; int sys_secureswitch(int secure) { if(secure==0) securelevel=0; if(secure==1) securelevel=1; return securelevel; } int init_module(void) { sys_call_table[__NR_secureswitch] = (void *)sys_secureswitch; return 0; } void cleanup_module(void) { sys_call_table[__NR_secureswitch] = NULL; return; } /************************ clt.c **************************/ /* * This client can switch the secure level of Linux. * * gcc -O3 -Wall -o clt clt.c * Usage: clt -h/-l *-hswitch to the high secure level. *-lswitch to the low secure level. * * Most of codes are ripped from smiler@tasam.com,thanks smiler.:) *warning3@hotmail.com */ static inline _syscall1(int, secureswitch, int, command); int main(int argc,char **argv) { int ret,level = 0; if (argc < 2) { fprintf(stderr,"Usage: %s [-h/-l]
",argv[0]); exit(-1); } if (argv[1][1] == "h") level++; else if (argv[1][1] != "l") { fprintf(stderr,"Usage: %s [-h/-l]
",argv[0]); exit(-1); } ret = secureswitch(level); if (ret < 0) printf("Hmmm...It seemed that our lkm hasn"t been loaded.;-)
"); else { if (ret == 0) { puts("Now the secure level is changed to 0!
"); } else { puts("Now the secure level is chagned to 1!
"); } } return(1); } 技术网站导航Unix系统安全服务利用Linux系统IP伪装挡住黑客攻击相关资讯 本文评论 查看全部评论 (0)