On Wed, 2020-09-30 at 13:01 +0200, Harald Welte wrote: > Hi Richard, > > I don't fully understand in which context you need / use those > SELinux GTP hooks, As in the reply to Pablo, I did it for no particular reason other than idle curiosity, and given the attempted move to Open 5G I thought adding MAC support might be useful somewhere along the line. > however one comment from the point of view of somebody who is working > on GGSN/P-GW > software using the GTP kernel module: > > On Wed, Sep 30, 2020 at 10:49:34AM +0100, Richard Haines wrote: > > +selinux_gtp_dev_cmd() > > +~~~~~~~~~~~~~~~~~~~~~ > > +Validate if the caller (current SID) and the GTP device SID have > > the required > > +permission to perform the operation. The GTP/SELinux permission > > map is > > +as follow:: > > + > > + GTP_CMD_NEWPDP = gtp { add } > > + GTP_CMD_DELPDP = gtp { del } > > + GTP_CMD_GETPDP = gtp { get } > > Wouldn't it make sense to differentiate between: > > a) add/del/get on the GTP netdev > b) add/del/get on the indivudual PDP wihin the GTP netdev > > 'a' is typically only created once at startup of a GGSN/P-GW > software, or is > done even at system stat-up time. > > 'b' is performed frequently during runtime as the GGSN/P-GW function > runs, as > subscribers attach to / detach from the cellular network. > > By differentiating between those two, one could further constrain the > permissions > required at runtime. Yes, at first I did separate them (add_dev, del_dev, add_pkt, del_pkt, get_pkt), so if this patchset goes anywhere then I can change it no problem. I guess the '*_pkt' permissions would cover PDP for 3G and PDR & FAR for 5G ?. I didn't implement 'get_dev' but thought it could be useful for retrieving the security context of a device, but that requires passing it back via netlink so thought I would leave it until later. >