




已阅读5页,还剩50页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
安全协议与标准 linfb 2008 10 Linux安全的实现机制 用户与文件 从POST到sh 用户级安全 认证 授权Authentication AuthorizationPAMPluggableAuthenticationModulesSUIDPermissionsetuidetc 基本概念 认证 鉴别Authentication谁是谁授权Authorization能干什么鉴别手段基于口令 令牌 卡 指纹 声音等信息授权方法访问控制矩阵ACL ACM PAM 传统的AA应用程序自己管理PAM标准库PAMinLinux PAMhistory PAMwasfirstproposedbySunMicrosystemsinanOpenSoftwareFoundationRequestforComments RFC 86 0datedOctober1995 ItwasadoptedastheauthenticationframeworkoftheCommonDesktopEnvironment Asastand aloneinfrastructure PAMfirstappearedfromanopen source Linux PAM developmentinRedHatLinux3 0 4inAugust1996 PAMiscurrentlysupportedintheAIXoperatingsystem DragonFlyBSD FreeBSD HP UX Linux MacOSX NetBSDandSolaris PAMwaslaterstandardizedaspartoftheX OpenUNIXstandardizationprocess resultingintheX OpenSingleSign on XSSO standard 鉴别AuthenticationbeforePAM Everyapplicationrequireditsownsecurityandauthenticationmechanism 鉴别AuthenticationwithPAM isthisuserauthorizedtouseme PAM框架 PAMimpl PAMisused forexample todynamicallylinksystembinaries Dynamiclinkingdoesnecessitatearecoverymechanismtoaddresspotentialproblemsinthelinkerorinsharedlibraries Onewayofimplementingarecoverymechanismistosupplya rescuedirectorythatcontainsstaticallylinkedversionsofimportantsystembinaries ThismethodisusedinbothNetBSDandFreeBSD PAM有四部分组成 第一部分是libpam 是实现PAMAPI的库 第二部分是PAM配置文件 etc pam conf 第三部分有一套动态可装载两进位对象组成 常常用来调用一些处理实际鉴别 authentication 工作的服务模块 最后模块是使用PAMAPI的系统命令组成 如login us ftp telnetetc PAMAPI include includeintpam start intpam end constchar pam strerror pam set item pam get item pam authenticate pam chauthtok PAM LOGIN http www thkukuk de pam pam login pam loginiswrittenspecificlyforPAMauthentication Itisbasedontheversionfromtheutil Linuxpackage fromwhichallcodefornon PAMsupportwasremoved Instead supportforthemostimportantfeaturesoftheloginprogramfromtheshadowsuitewasadded PAM例子导读 X OpenSingleSign onService XSSO PluggableAuthenticationModuleshttp www opengroup org onlinepubs 008329799 toc htm 授权PrinciplesofAuthorization AuthorizationinLinuxbasedonfilepermissionsException rootisallowedtodoeverythingOnceloggedin userscannotchangetheiridentityexceptthroughaSUIDprogram whichallowsthemtorunacommandassomeoneelse mostoftenroot user group useruseridgroupgroupid cat etc passwd shadow cat etc groups ls看权限 linden localhost lltotal0 rw rw r 1lindenlinden02007 12 1020 28my docd l b crwx s FilePermissions PermFileDirectoryRreadlistWchangechangecontentXexecutecan cd SUIDProgramrunswitheffectiveN AuserIDofownerSGIDProgramrunswitheffectiveFilescreatedindirinheritGIDofownerthesameGIDasthedirStickybitN AOnlytheownerofthefileandtheownerofthedirmaydeletefilesinthisdir ChangingPermissions ls l chmod Settingfilepermissions chown changefileownerandgroup chgrp changegroupownershipumask 关于SUID 有时 没有被授权的用户需要完成某项任务 一个例子是passwd程序 它允许用户改变口令 这就要求改变 etc passwd文件的口令域 然而系统管理员决不允许普通用户拥有直接改变这个文件的权利 因为这绝对不是一个好主意 为了解决这个问题 SUID SGID便应运而生 UNIX允许程序被授权 当程序被执行的时候 拥有超级用户的权限 完成时又回到普通用户的权限 这个主意很好 所以AT T对它申请了专利 SUID SGID程序在执行时的RealUid可以通过函数setuid 改变 SUIDPrograms ExamplesofSUIDprograms passwd Allowsuserstoupdatethe etc shadowfilemount AllowsuserstomountafloppyorCDsu Runsashellasanotheruser aftersupplyingthepasswordsudo RunsaparticularcommandasanotheruserVariousgames totrackhighscores AllSUIDprogramsshouldbeknowntotheadministratorandchecked updatedforsecurityproblems SUID SGID文件可能是被植入的 查找SUID属性文件 find usr bin typef perm 2000 printSGID find usr bin typef perm 4000 print 其他可疑文件 任何人 同组 都可写的文件 可能是入侵的遗留 find perm 2 print find perm 20无主文件 find dev nouser print find dev nogroup print LinuxA Z 侧重安全机制 CMOS口令LILO GRUB口令磁盘 分区加密虚拟磁盘文件权限访问控制特权操作事件审计 获取package src 搜索Debian的软件包源码http www debian org distrib packages search packageshttp packages debian org stable Fedora8 LXR 看源码的工具 首推LXR 其次也可以使用sourceinsight或则source navigator LXR可以自己安装也可以使用网上公用的LXR 如http lxr linux no linux 本地临时的LXR 2 6 21 5 http 211 87 235 73 lxr outdate CMOS口令 PowerButtonPowerOnBIOSSelfTestPasswd开机口令vs CMOS口令进入CMOS典型按键 del f1 f2 tab esc BIOS passwd CMOS电池 lilo口令 singlemode在 lilo conf中设定口令 restrictedpassword a3xsf8d lilo口令的作用过程查lilo的源程序bootsect S bsect c lilo c GRUB口令 Grub的口令机制 boot grub grub confpassword md5则必须先输入口令才能进一步操作grub或者单独针对某项启用口令password boot grub menu admin lst还有lock选项可用为了产生md5后的grub md5crypt Kernelimage vmlinuz Kernelimage被lilo grub 曾经linux有自己的bootsect 读入到内存 解压缩 重定位 跳转到 Kernel从start kernel 被执行http lxr linux no linux init main c L513http 211 87 235 73 lxr http source init main c L502Kernel做了重要的初始化 然后Kernel创建1号内核线程init 其装载 sbin init 配置文件是 etc inittab init Kernel然后启动用户进程initstart kernel rest init kernel thread init NULL CLONE KERNEL init run init process sbin init execve init filename argv init envp init init读取配置文件inittab etc inittab中的几行 Rungettysinstandardrunlevels1 2345 respawn sbin mingettytty12 2345 respawn sbin mingettytty23 2345 respawn sbin mingettytty3 System V http packages debian org etch sysvinit mingetty 查mingetty的来历 rpm qf sbin mingettymingetty 1 06 2Google mingetty Debiansoftwarepackagedirectorieshttp packages debian org stable admin mingetty下载mingetty 0 9 4 orig tar gz得到唯一的mingetty c mingetty inmingetty cdo prompt showloginprompt optionallyprecededby etc issuecontentsopen tty setupttyasstandard input output error while logname get logname 0 execl PATH LOGIN PATH LOGIN logname NULL 说明 从指定的tty获得用户名 并启动login程序 ALT F1 F2 F6 F7 F8 dev tty0 dev pts 0tty initvty initkbd init 2419staticstructcdevtty cdev console cdev 2420 ifdefCONFIG UNIX98 PTYS2421staticstructcdevptmx cdev 2422 endif2423 ifdefCONFIG VT2424staticstructcdevvc0 cdev 2425 endif login inlogin c retcode pam get item pamh PAM USER constvoid 用户可以有几次机会输入口令但是会有故意的延迟数次失败 则退出init会把mingetty再次起动 login c关键部分缩写 childPid fork if childPid wait NULL login进程等着exit 0 下面是子进程 用户的shell setsid opentty ttyn setuid pwd pw uid chdir pwd pw dir execvp bin sh sh cexec pwd pw shell login cinshadow 4 0 18 1 orig tar gz http packages debian org etch loginPAM PCB uid setuid setuid setgid sys setuid setreuid setregid sys setreuid inPCB404 processcredentials 405uid tuid euid suid fsuid 406gid tgid egid sgid fsgid 407intngroups 408gid tgroups NGROUPS 409kernel cap tcap effective cap inheritable cap permitted 410intkeep capabilities 1 411structuser struct user bash Bashhttp packages debian org etch bash 试图访问一个自己的或者别人的文件 用户使用文件时linux内核是怎样使用权限信息做访问控制的 用户身份vs 文件的权限信息典型数据文件 rw r r 自己可读写 别人只读intfd open my or your file name r w x m 打开文件准备用来读 写 执行如果创建新文件 则mode指示了其权限属性longsys open filename flags mode sys open permission andmore sys open filp open open namei may open permission permission 207intpermission structinode inode intmask structnameidata nd 208 intretval 210intsubmask 212 OrdinarypermissionroutinesdonotunderstandAPPEND 213submask mask223 k 在某个函数中对代码适当修改可以允许特定用户有任意权限 sys open permission vfs permission security inode permission 尝试改permission 在 etc passwd有两个普通用户linden和susanlinden x 500 500 home linden bin bashsusa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 成都发布疫情应急处置预案(3篇)
- 学习信阳市防汛应急预案(3篇)
- 儿童误乐场所安全应急预案(3篇)
- 广西金融职业技术学院《抽样调查》2024-2025学年第一学期期末试卷
- 秦皇岛工业职业技术学院《小学教育研究方法》2024-2025学年第一学期期末试卷
- 河北政法职业学院《生物制药设备与工程设计》2024-2025学年第一学期期末试卷
- 青海柴达木职业技术学院《行书2》2024-2025学年第一学期期末试卷
- 广安职业技术学院《乒乓球俱乐部(初级)》2024-2025学年第一学期期末试卷
- 重庆电子工程职业学院《大学体育Ⅱ》2024-2025学年第一学期期末试卷
- 江西软件职业技术大学《市场调研》2024-2025学年第一学期期末试卷
- 《液压与气动控制》课件
- GA/T 1280-2024银行自助设备安全性规范
- 带状疱疹后神经痛的诊治课件
- 火灾地震逃生演练课件
- 广东省深圳市2024-2025学年高一上学期期中考试数学试卷(含答案)
- 第6讲立体几何(2022-2023年高考真题)(原卷版)
- 中医耳针技术
- 山东省第二届化学分析检验人员行业职业技能竞赛理论试题库资料(含答案)
- AQ 1097-2014 井工煤矿安全设施设计编制导则(正式版)
- NBT 47013.13-2015 承压设备无损检测 第13部分:脉冲涡流检测
- 2024年三亚市海棠区营商环境建设局一级科员招录1人《行政职业能力测验》高频考点、难点(含详细答案)
评论
0/150
提交评论