1*593733abSMauro Carvalho Chehab======================================== 2*593733abSMauro Carvalho ChehabNetLabel Linux Security Module Interface 3*593733abSMauro Carvalho Chehab======================================== 4*593733abSMauro Carvalho Chehab 5*593733abSMauro Carvalho ChehabPaul Moore, paul.moore@hp.com 6*593733abSMauro Carvalho Chehab 7*593733abSMauro Carvalho ChehabMay 17, 2006 8*593733abSMauro Carvalho Chehab 9*593733abSMauro Carvalho ChehabOverview 10*593733abSMauro Carvalho Chehab======== 11*593733abSMauro Carvalho Chehab 12*593733abSMauro Carvalho ChehabNetLabel is a mechanism which can set and retrieve security attributes from 13*593733abSMauro Carvalho Chehabnetwork packets. It is intended to be used by LSM developers who want to make 14*593733abSMauro Carvalho Chehabuse of a common code base for several different packet labeling protocols. 15*593733abSMauro Carvalho ChehabThe NetLabel security module API is defined in 'include/net/netlabel.h' but a 16*593733abSMauro Carvalho Chehabbrief overview is given below. 17*593733abSMauro Carvalho Chehab 18*593733abSMauro Carvalho ChehabNetLabel Security Attributes 19*593733abSMauro Carvalho Chehab============================ 20*593733abSMauro Carvalho Chehab 21*593733abSMauro Carvalho ChehabSince NetLabel supports multiple different packet labeling protocols and LSMs 22*593733abSMauro Carvalho Chehabit uses the concept of security attributes to refer to the packet's security 23*593733abSMauro Carvalho Chehablabels. The NetLabel security attributes are defined by the 24*593733abSMauro Carvalho Chehab'netlbl_lsm_secattr' structure in the NetLabel header file. Internally the 25*593733abSMauro Carvalho ChehabNetLabel subsystem converts the security attributes to and from the correct 26*593733abSMauro Carvalho Chehablow-level packet label depending on the NetLabel build time and run time 27*593733abSMauro Carvalho Chehabconfiguration. It is up to the LSM developer to translate the NetLabel 28*593733abSMauro Carvalho Chehabsecurity attributes into whatever security identifiers are in use for their 29*593733abSMauro Carvalho Chehabparticular LSM. 30*593733abSMauro Carvalho Chehab 31*593733abSMauro Carvalho ChehabNetLabel LSM Protocol Operations 32*593733abSMauro Carvalho Chehab================================ 33*593733abSMauro Carvalho Chehab 34*593733abSMauro Carvalho ChehabThese are the functions which allow the LSM developer to manipulate the labels 35*593733abSMauro Carvalho Chehabon outgoing packets as well as read the labels on incoming packets. Functions 36*593733abSMauro Carvalho Chehabexist to operate both on sockets as well as the sk_buffs directly. These high 37*593733abSMauro Carvalho Chehablevel functions are translated into low level protocol operations based on how 38*593733abSMauro Carvalho Chehabthe administrator has configured the NetLabel subsystem. 39*593733abSMauro Carvalho Chehab 40*593733abSMauro Carvalho ChehabNetLabel Label Mapping Cache Operations 41*593733abSMauro Carvalho Chehab======================================= 42*593733abSMauro Carvalho Chehab 43*593733abSMauro Carvalho ChehabDepending on the exact configuration, translation between the network packet 44*593733abSMauro Carvalho Chehablabel and the internal LSM security identifier can be time consuming. The 45*593733abSMauro Carvalho ChehabNetLabel label mapping cache is a caching mechanism which can be used to 46*593733abSMauro Carvalho Chehabsidestep much of this overhead once a mapping has been established. Once the 47*593733abSMauro Carvalho ChehabLSM has received a packet, used NetLabel to decode its security attributes, 48*593733abSMauro Carvalho Chehaband translated the security attributes into a LSM internal identifier the LSM 49*593733abSMauro Carvalho Chehabcan use the NetLabel caching functions to associate the LSM internal 50*593733abSMauro Carvalho Chehabidentifier with the network packet's label. This means that in the future 51*593733abSMauro Carvalho Chehabwhen a incoming packet matches a cached value not only are the internal 52*593733abSMauro Carvalho ChehabNetLabel translation mechanisms bypassed but the LSM translation mechanisms are 53*593733abSMauro Carvalho Chehabbypassed as well which should result in a significant reduction in overhead. 54