selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* CIL blockinherit and entering a macro namespace using in
@ 2020-06-18 16:16 bauen1
  2020-06-18 18:56 ` James Carter
  0 siblings, 1 reply; 2+ messages in thread
From: bauen1 @ 2020-06-18 16:16 UTC (permalink / raw)
  To: selinux

Hello,

After getting my CIL policy to work, I have discovered another problem.

According to the manual
https://github.com/SELinuxProject/selinux/blob/master/secilc/docs/cil_container_statements.md#in
`in` can be used to enter a namespace, including macros.
This works, except when using blockinherit and trying to enter a macro
that was inherited.

My use case would be a base file template with a lot of macros, and
using `in` to add more access to the macros where appropiate.

See the test case below, bauen1


(class process (transition))
(class file (read))
(classorder (unordered process file))

(user kernel_u)
(role kernel_r)
(userrole kernel_u kernel_r)
(type kernel_t)
(roletype kernel_r kernel_t)

(sid kernel)
(sidorder (kernel))

(sensitivity s0)
(sensitivityorder (s0))
(level low (s0))
(level high (s0))
(levelrange lowhigh (low high))
(userlevel kernel_u low)
(userrange kernel_u lowhigh)

(context kernel_context (kernel_u kernel_r kernel_t lowhigh))
(sidcontext kernel kernel_context)

(macro test1
    ((type domain))
    (allow domain self (process (all)))
)

(in test1
    (allow domain self (file (all)))
)

(block a
    (macro test2
        ((type domain))
        (allow domain self (process (all)))
    )

    (in test2
        (allow domain self (file (all)))
    )
)

(block b
    (blockabstract b)
    (macro test3
        ((type domain))
        (allow domain self (process (all)))
    )
)

(block c
    (blockinherit b)

    (in test3
        (allow domain self (file (all)))
    )
)

; In Theory all macros: test1, a.test2, c.test3 should result in the
same code



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: CIL blockinherit and entering a macro namespace using in
  2020-06-18 16:16 CIL blockinherit and entering a macro namespace using in bauen1
@ 2020-06-18 18:56 ` James Carter
  0 siblings, 0 replies; 2+ messages in thread
From: James Carter @ 2020-06-18 18:56 UTC (permalink / raw)
  To: bauen1; +Cc: selinux

On Thu, Jun 18, 2020 at 12:17 PM bauen1 <j2468h@googlemail.com> wrote:
>
> Hello,
>
> After getting my CIL policy to work, I have discovered another problem.
>
> According to the manual
> https://github.com/SELinuxProject/selinux/blob/master/secilc/docs/cil_container_statements.md#in
> `in` can be used to enter a namespace, including macros.
> This works, except when using blockinherit and trying to enter a macro
> that was inherited.
>

That is correct. The problem is that "in" is resolved before the
blockinherit. We wanted to keep things simple, so we picked an order
for them to be resolved. There were good arguments for resolving it
the way you would need for your policy, but that is not what was
chosen. Sorry.

Jim


> My use case would be a base file template with a lot of macros, and
> using `in` to add more access to the macros where appropiate.
>
> See the test case below, bauen1
>
>
> (class process (transition))
> (class file (read))
> (classorder (unordered process file))
>
> (user kernel_u)
> (role kernel_r)
> (userrole kernel_u kernel_r)
> (type kernel_t)
> (roletype kernel_r kernel_t)
>
> (sid kernel)
> (sidorder (kernel))
>
> (sensitivity s0)
> (sensitivityorder (s0))
> (level low (s0))
> (level high (s0))
> (levelrange lowhigh (low high))
> (userlevel kernel_u low)
> (userrange kernel_u lowhigh)
>
> (context kernel_context (kernel_u kernel_r kernel_t lowhigh))
> (sidcontext kernel kernel_context)
>
> (macro test1
>     ((type domain))
>     (allow domain self (process (all)))
> )
>
> (in test1
>     (allow domain self (file (all)))
> )
>
> (block a
>     (macro test2
>         ((type domain))
>         (allow domain self (process (all)))
>     )
>
>     (in test2
>         (allow domain self (file (all)))
>     )
> )
>
> (block b
>     (blockabstract b)
>     (macro test3
>         ((type domain))
>         (allow domain self (process (all)))
>     )
> )
>
> (block c
>     (blockinherit b)
>
>     (in test3
>         (allow domain self (file (all)))
>     )
> )
>
> ; In Theory all macros: test1, a.test2, c.test3 should result in the
> same code
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-18 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 16:16 CIL blockinherit and entering a macro namespace using in bauen1
2020-06-18 18:56 ` James Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).