From: dac.override@gmail.com (Dominick Grift) Date: Thu, 14 Sep 2017 10:07:44 +0200 Subject: [refpolicy] [PATCH 1/1] Add int_rlimit_inherit interface In-Reply-To: <1B50C12ACFF4CB42B90D2581155DF50205B5D882@Exchange10.columbia.tresys.com> References: <1B50C12ACFF4CB42B90D2581155DF50205B5D882@Exchange10.columbia.tresys.com> Message-ID: <20170914080744.GA17010@julius.enp8s0.d30> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com On Wed, Sep 13, 2017 at 08:34:15PM +0000, David Sugar via refpolicy wrote: > Create new interface init_rlimit_inherit to allow a process started by init to inherit resource limits. systemd allows for setting of resource limits [1] but the default from SELinux is to not allow the inheritance of those limits as a service is started. This interface allows that resource limit inheritance. > > The systemd .service options are LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME= > > [1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html Have you tested this? I just tried this out and i do not seem to need this to get it to work: https://www.youtube.com/watch?v=f8nFGbMBG0s > > Signed-off-by: Dave Sugar > --- > policy/modules/system/init.if | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if > index 09a20311..bf6e37bc 100644 > --- a/policy/modules/system/init.if > +++ b/policy/modules/system/init.if > @@ -712,6 +712,29 @@ interface(`init_getpgid',` > > ######################################## > ## > +## Allow process to inherit resource limits. > +## > +##

> +## This is applicable with systemd when using the > +## options to limit resources - see > +## https://www.freedesktop.org/software/systemd/man/systemd.exec.html#LimitMSGQUEUE= > +##

> +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`init_rlimit_inherit',` > + gen_require(` > + type init_t; > + ') > + > + allow $1 init_t:process rlimitinh; > +') > + > +######################################## > +## > ## Send init a generic signal. > ## > ## > -- > 2.13.5 > _______________________________________________ > refpolicy mailing list > refpolicy at oss.tresys.com > http://oss.tresys.com/mailman/listinfo/refpolicy -- Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20170914/84922207/attachment.bin