All of lore.kernel.org
 help / color / mirror / Atom feed
* Cil block inheritance
@ 2021-08-26 11:33 Vit Mojzis
  2021-08-26 12:10 ` Dominick Grift
  0 siblings, 1 reply; 7+ messages in thread
From: Vit Mojzis @ 2021-08-26 11:33 UTC (permalink / raw)
  To: selinux; +Cc: Lukas Vrabec

Hi,
recent changes in block inheritance broke our use case where we use 
block inheritance for generating container policies 
(https://github.com/containers/udica/tree/main/udica/templates). 
Basically the policy is composed by inheriting selected "template" 
blocks, all of which inherit "container" block, so that they can use 
types defined there.

Reproducer:
(block template1 (type t) )
(block template2 (blockinherit template1))
(block b (blockinherit template1) (blockinherit template2))

#semodule -i test.cil
Re-declaration of type t
Previous declaration of type at 
/var/lib/selinux/targeted/tmp/modules/400/test/cil:1
Failed to copy block contents into blockinherit
Failed to resolve AST
semodule: Failed!

This used to work just fine.

The following workaround seems to be working as intended, but I'm not 
sure if it's the best approach. Types are only defined in template1 and 
the rest contains "optional" block, so that I can use types defined in 
template1).

(block template1 (type t))
(block template2
      (optional o
          (allow t t ( file ( read )))
      )
)
(block b (blockinherit template1) (blockinherit template2))

#semodule -i test.cil
#sesearch -A -s b.t
allow b.t b.t:file read;

Any pointers would be appreciated.

Thank you.

Vit


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

end of thread, other threads:[~2021-08-26 19:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 11:33 Cil block inheritance Vit Mojzis
2021-08-26 12:10 ` Dominick Grift
2021-08-26 12:38   ` Vit Mojzis
2021-08-26 13:21     ` Dominick Grift
2021-08-26 14:46       ` Vit Mojzis
2021-08-26 19:25       ` James Carter
2021-08-26 13:46     ` Dominick Grift

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.